IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

APIs Google Discussion :

Interdire la géolocalisation si coordonnées sur terre [Google Maps]


Sujet :

APIs Google

  1. #21
    Membre régulier
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 320
    Points : 74
    Points
    74
    Par défaut
    ...MAIS que fait-on après ???? rien lol


    aprés la géolocalisation le script main.php enregistre les coordonnées dans le fichier texte puis on revient a la page ou l'on demande de cliquer pour se géolocaliser a nouveau c est tout...

    cdt

  2. #22
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 070
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 070
    Points : 44 677
    Points
    44 677
    Par défaut
    Dans ce cas je ne vois pas ce qui coince, les compétences? elle s’acquirent et les forums sont là en cas de pépin

    PS: je ne saisie pas la finalité.

  3. #23
    Membre régulier
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 320
    Points : 74
    Points
    74
    Par défaut
    tu as certainement raison

    cdt

  4. #24
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 070
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 070
    Points : 44 677
    Points
    44 677
    Par défaut
    Trouvée sur la toile la fonction de test en PHP, et à peine modifiée
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    <?php
    //============================================================================//
    // sur base de http://www.assemblysys.com/dataServices/php_pointinpolygon.php //
    //============================================================================//
    function pointStringToCoordinates($pointString) {
      //$coordinates = explode(" ", $pointString);
      $coordinates = explode(",", $pointString);
      return array("x" => $coordinates[0], "y" => $coordinates[1]);
    }
    function pointInPolygon($point, $polygon) {
      // Transform string coordinates into arrays with x and y values
      $point = pointStringToCoordinates($point);
      $vertices = array();
      foreach ($polygon as $vertex) {
        $vertices[] = pointStringToCoordinates($vertex);
      }
      // Check if the point is inside the polygon or on the boundary
      $intersections = 0;
      $vertices_count = count($vertices);
     
      for ($i=1; $i < $vertices_count; $i++) {
        $vertex1 = $vertices[$i-1];
        $vertex2 = $vertices[$i];
        if ($vertex1['y'] == $vertex2['y'] and $vertex1['y'] == $point['y'] and $point['x'] > min($vertex1['x'], $vertex2['x']) and $point['x'] < max($vertex1['x'], $vertex2['x'])) { // Check if point is on an horizontal polygon boundary
          //return "boundary";
          return TRUE;
        }
        if ($point['y'] > min($vertex1['y'], $vertex2['y']) and $point['y'] <= max($vertex1['y'], $vertex2['y']) and $point['x'] <= max($vertex1['x'], $vertex2['x']) and $vertex1['y'] != $vertex2['y']) {
          $xinters = ($point['y'] - $vertex1['y']) * ($vertex2['x'] - $vertex1['x']) / ($vertex2['y'] - $vertex1['y']) + $vertex1['x'];
          if ($xinters == $point['x']) { // Check if point is on the polygon boundary (other than horizontal)
            //return "boundary";
            return TRUE;
          }
          if ($vertex1['x'] == $vertex2['x'] || $point['x'] <= $xinters) {
            $intersections++;
          }
        }
      }
      // If the number of edges we passed through is odd, then it's in the polygon.
      if ($intersections % 2 != 0) {
        //return "inside";
        return TRUE;
      } else {
        //return "outside";
        return FALSE;
      }
    }
    ?>
    il te suffira de déclarer ton polygone comme suit
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <?php
    // les datas du polygone
    $la_zone = array( '44.774524, -1.163864',
                      '44.696481, -1.240768',
                      '44.551824, -1.28746',
                      '44.55476,  -1.248322',
                      '44.63788,  -1.114426',
                      '44.642124, -0.998082',
                      '44.685254, -1.010742',
                      '44.774524, -1.163864');
    ?>

  5. #25
    Membre régulier
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 320
    Points : 74
    Points
    74
    Par défaut
    Bonsoir et merci de ton aide

    Bon j 'essai de comprendre le script . je test le fonctionnement mais je n’obtiens pour l'instant que le echo des coordonnées du gps


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
     
     
    <?php
     
     
    $lat = $_GET['lat'];
    $long = $_GET['long'];
    $virg=(",");
     
     
    $coordinates=("$lat$virg$long");
     
     
    echo"$coordinates";   /////// ok verification les coordonnees du gps sont  contenu dans la variable
    echo"<br>";
     
     
    //============================================================================//
    // sur base de http://www.assemblysys.com/dataServices/php_pointinpolygon.php //
    //============================================================================//
    function pointStringToCoordinates($pointString) {
      //$coordinates = explode(" ", $pointString);
      $coordinates = explode(",", $pointString);
     
     
     
     
     
     
     
    echo"<br>";
     
    echo" $coordinates[0]";//////   pas de coordonnées dans l 'echo  ????? ne devrais je pas retrouver mes coordonnees ?
     
    echo"<br>";
     
     
    echo"$coordinates[1]";////// pas de coordonnées dans l 'echo  ?????
     
     
      return array("x" => $coordinates[0], "y" => $coordinates[1]);
     
     
     
    }
    function pointInPolygon($point, $polygon) {
      // Transform string coordinates into arrays with x and y values
      $point = pointStringToCoordinates($point);
      $vertices = array();
      foreach ($polygon as $vertex) {
        $vertices[] = pointStringToCoordinates($vertex);
     
     
    echo"$vertex";   /////////  test
     
     
      }
      // Check if the point is inside the polygon or on the boundary
      $intersections = 0;
      $vertices_count = count($vertices);
     
      for ($i=1; $i < $vertices_count; $i++) {
        $vertex1 = $vertices[$i-1];
        $vertex2 = $vertices[$i];
        if ($vertex1['y'] == $vertex2['y'] and $vertex1['y'] == $point['y'] and $point['x'] > min($vertex1['x'], $vertex2['x']) and $point['x'] < max($vertex1['x'], $vertex2['x'])) { // Check if point is on an horizontal polygon boundary
          //return "boundary";
          return TRUE;
        }
        if ($point['y'] > min($vertex1['y'], $vertex2['y']) and $point['y'] <= max($vertex1['y'], $vertex2['y']) and $point['x'] <= max($vertex1['x'], $vertex2['x']) and $vertex1['y'] != $vertex2['y']) {
          $xinters = ($point['y'] - $vertex1['y']) * ($vertex2['x'] - $vertex1['x']) / ($vertex2['y'] - $vertex1['y']) + $vertex1['x'];
          if ($xinters == $point['x']) { // Check if point is on the polygon boundary (other than horizontal)
            //return "boundary";
            return TRUE;
          }
          if ($vertex1['x'] == $vertex2['x'] || $point['x'] <= $xinters) {
            $intersections++;
          }
        }
      }
      // If the number of edges we passed through is odd, then it's in the polygon.
      if ($intersections % 2 != 0) {
        //return "inside";
        return TRUE;
     
     
     
     
      } else {
        //return "outside";
        return FALSE;
     
      }
    }
     
     
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    ?>

  6. #26
    Membre régulier
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 320
    Points : 74
    Points
    74
    Par défaut
    Les variables suivantes doivent bien contenir mes coordonneés


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    echo" $coordinates[0]";
     
    echo" $coordinates[1]";

  7. #27
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 070
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 070
    Points : 44 677
    Points
    44 677
    Par défaut
    Si tu n'as pas de résultat lorsque tu fais ton echo c'est que tu ne passes pas dans la fonction, nulle part tu n'appelles la fonction de test, pointInPolygon.

    Tu pourrais avoir quelque chose comme
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    <?php
    // recup. des datas
    if( !empty($_GET['lng'])){
      $lng = floatval( $_GET[ "lng"]);
      if( !empty($_GET['lat'])){
        $lat = floatval( $_GET[ 'lat']);
        // mise au format fonction
        $point = implode( "," , array( $lat, $lng));
        // test du point
        $result = pointInPolygon($point, $la_zone);// ? 'INSIDE' : 'OUTSIDE';    
        // chaine affichage
        if( $result){
          $chaine = '<span class="result valide">Ce point est dans la zone</span>';
        }
        else{
          $chaine = '<span class="result erreur">Ce point est hors zone.</span>';
        }
      }
    }
    ?>

  8. #28
    Membre régulier
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 320
    Points : 74
    Points
    74
    Par défaut
    Bonsoir NoSmoking,


    Je test ce script mais sans sucés sachant que cela ne provoque pas d'erreur mais cela ne me donne pas pour autant le résultat voulu . J 'ai beaucoup de mal

    Bon je cherche encore @++

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
     
    <?php
     
     
    $lat = $_GET['lat'];
    $lng = $_GET['lng'];
     
     
     
    if( !empty($_GET['lng'])){
      $lng = floatval( $_GET[ "lng"]);
      if( !empty($_GET['lat'])){
        $lat = floatval( $_GET[ 'lat']);
        // mise au format fonction
        $point = implode( "," , array( $lat, $lng));
     
     
    // les datas du polygone
    $la_zone = array( '44.774524, -1.163864',
                      '44.696481, -1.240768',
                      '44.551824, -1.28746',
                      '44.55476,  -1.248322',
                      '44.63788,  -1.114426',
                      '44.642124, -0.998082',
                      '44.685254, -1.010742',
                      '44.774524, -1.163864');
     
     
     
     
        // test du point
        $result = pointInPolygon($point, $la_zone);// ? 'INSIDE' : 'OUTSIDE';    
     
     
     
     
        // chaine affichage
        if( $result){
          $chaine = '<span class="result valide">Ce point est dans la zone</span>';
        }
        else{
          $chaine = '<span class="result erreur">Ce point est hors zone.</span>';
     
     
     
     
     
        }
      }
    }

  9. #29
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 070
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 070
    Points : 44 677
    Points
    44 677
    Par défaut
    Il ne faut oublier de synthétiser tout ce que l'on a mis ci dessus.

    A final tu pourrais avoir un fichier qui ressemblerait à cela
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    <?php
    header('Content-Type: text/html; charset=utf-8');
    //============================================================================//
    // sur base de http://www.assemblysys.com/dataServices/php_pointinpolygon.php //
    //============================================================================//
    function pointStringToCoordinates($pointString) {
      //$coordinates = explode(" ", $pointString);
      $coordinates = explode(",", $pointString);
      return array("x" => $coordinates[0], "y" => $coordinates[1]);
    }
    function pointInPolygon($point, $polygon) {
      // Transform string coordinates into arrays with x and y values
      $point = pointStringToCoordinates($point);
      $vertices = array();
      foreach ($polygon as $vertex) {
        $vertices[] = pointStringToCoordinates($vertex);
      }
      // Check if the point is inside the polygon or on the boundary
      $intersections = 0;
      $vertices_count = count($vertices);
     
      for ($i=1; $i < $vertices_count; $i++) {
        $vertex1 = $vertices[$i-1];
        $vertex2 = $vertices[$i];
        if ($vertex1['y'] == $vertex2['y'] and $vertex1['y'] == $point['y'] and $point['x'] > min($vertex1['x'], $vertex2['x']) and $point['x'] < max($vertex1['x'], $vertex2['x'])) { // Check if point is on an horizontal polygon boundary
          //return "boundary";
          return TRUE;
        }
        if ($point['y'] > min($vertex1['y'], $vertex2['y']) and $point['y'] <= max($vertex1['y'], $vertex2['y']) and $point['x'] <= max($vertex1['x'], $vertex2['x']) and $vertex1['y'] != $vertex2['y']) {
          $xinters = ($point['y'] - $vertex1['y']) * ($vertex2['x'] - $vertex1['x']) / ($vertex2['y'] - $vertex1['y']) + $vertex1['x'];
          if ($xinters == $point['x']) { // Check if point is on the polygon boundary (other than horizontal)
            //return "boundary";
            return TRUE;
          }
          if ($vertex1['x'] == $vertex2['x'] || $point['x'] <= $xinters) {
            $intersections++;
          }
        }
      }
      // If the number of edges we passed through is odd, then it's in the polygon.
      if ($intersections % 2 != 0) {
        //return "inside";
        return TRUE;
      } else {
        //return "outside";
        return FALSE;
      }
    }
     
    // les datas du polygone
    $la_zone = array( '44.774524, -1.163864',
                      '44.696481, -1.240768',
                      '44.551824, -1.28746',
                      '44.55476,  -1.248322',
                      '44.63788,  -1.114426',
                      '44.642124, -0.998082',
                      '44.685254, -1.010742',
                      '44.774524, -1.163864');
    ?>
    <!DOCTYPE html>
    <html lang="fr">
    <head>
    <meta charset="UTF-8">
    <title>Lat-Lng in polyGone</title>
    <style>
    </style>
    <script>
    function getLocalisation(){
      if( navigator.geolocation){
        //navigator.geolocation.watchPosition(
        navigator.geolocation.getCurrentPosition(
          function( pos){
              document.getElementById('latitude').value  = pos.coords.latitude;
              document.getElementById('longitude').value = pos.coords.longitude;
              document.getElementById('localisation').submit();
            },
            function(erreur){
              if( window.console) console.log( erreur);
              alert( erreur.message || erreur.code);
            },
            {
              'maximumAge':0,
              'timeout':2000
            }
        );
      }
      else{
        alert( 'c\'est balot!!');
      }
    }
    </script>
    </head>
    <body>
    <form id="localisation" action="<?php echo basename(__FILE__) ?>" method="GET">
      <input type="hidden" name="lat" id="latitude">
      <input type="hidden" name="lng" id="longitude">
      <input type="button" name="envoyer" onclick="getLocalisation();" value="Localisation">
    </form>
    <?php
    // recup. des datas
    if( !empty($_GET['lng'])){
      $lng = floatval( $_GET[ "lng"]);
      if( !empty($_GET['lat'])){
        $lat = floatval( $_GET[ 'lat']);
        // mise au format fonction
        $point = implode( "," , array( $lat, $lng));
        // test du point
        $result = pointInPolygon($point, $la_zone);// ? 'INTERIEUR' : 'OUTSIDE';    
        // chaine affichage
        if( $result){
          $chaine = '<span class="result valide">Ce point est dans la zone</span>';
        }
        else{
          $chaine = '<span class="result erreur">Ce point est hors zone.</span>';
        }
    ?>
    <!-- information sur le point -->
    <ul>
      <li>latitude  : <?php echo number_format($lat,6) ?></li>
      <li>longitude : <?php echo number_format($lng,6) ?></li>
    </ul>
    <?php
        echo $chaine;
      }
    }
    ?>
    </body>
    </html>

  10. #30
    Membre régulier
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 320
    Points : 74
    Points
    74
    Par défaut
    bonjour,

    Merci car j 'avais du mal avec l architecture du script

    j 'ai juste modifier un peu le script j 'ai teste cela fonctionne très bien et je te remercie pour ton aide. Je mesure aussi les progrès que j 'ai a faire ...


    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    <?php
    // recup. des datas
    if( !empty($_GET['lng'])){
      $lng = floatval( $_GET[ "lng"]);
      if( !empty($_GET['lat'])){
        $lat = floatval( $_GET[ 'lat']);
        // mise au format fonction
        $point = implode( "," , array( $lat, $lng));
        // test du point
        $result = pointInPolygon($point, $la_zone);// ? 'INTERIEUR' : 'OUTSIDE';    
        // chaine affichage
        if( $result){
     
     
     
    $fp = fopen("fichier.txt","w");
        fwrite($fp,"$lat, $lng");
       fclose($fp);
     
    $date = date("d-m-Y");
    $heure = date("H:i");
     
    $fp = fopen("heure.txt","w");
        fwrite($fp," : Le $date à $heure");
       fclose($fp);
     
     
          $chaine = '<span class="result valide">Ce point est dans la zone</span>';
        }
        else{
          $chaine = '<span class="result erreur">Votre position est hors zone maritime.</span>';
        }
    ?>
    <!-- information sur le point -->
    <ul>
      <li>latitude  : <?php echo number_format($lat,6) ?></li>
      <li>longitude : <?php echo number_format($lng,6) ?></li>
    </ul>
    <?php
        echo $chaine;
      }
    }
    ?>

  11. #31
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 070
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 070
    Points : 44 677
    Points
    44 677
    Par défaut
    Juste une question, pourquoi mettre les différentes informations liées dans des fichiers différents?

  12. #32
    Membre régulier
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 320
    Points : 74
    Points
    74
    Par défaut
    Pour être totalement honnête c'est parceque je ne sais pas faire plus simple.

  13. #33
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 070
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 070
    Points : 44 677
    Points
    44 677
    Par défaut
    en mettant tout dans le même fichier en ajout, cela te permet éventuellement de traiter les données recueillies.
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    $fp = fopen("localisation.txt","a");
      fwrite($fp, implode( ";" , array( $date, $heure, $lat, $lng)));
      fwrite($fp, "\n");
    fclose($fp);

  14. #34
    Membre régulier
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 320
    Points : 74
    Points
    74
    Par défaut
    NoSmoking bonjour,

    Tu as raison c'est tellement plus simple comme cela .Mais alors il faut que modif tout mon script de récup.

    Maintenant j 'ai des demande pour avoir un tracées de leurs positions bon ben je vais voir dans les ' Polyline ' c'est pas les exemple qui manques

    Merci encore

  15. #35
    Membre régulier
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 320
    Points : 74
    Points
    74
    Par défaut
    Bonjour

    Via mon iPhone je récupère les données gps sous ce format. Mais il arrive alors que le script n 'est exécuté qu'une seule fois par minute que j 'ai plusieurs coordonnées dans la même minutes alors que le même script exécute depuis mon pc donne bien une seule coordonnées par minutes

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    21-05-2013 - 22:10 - 48.358943059523,1.7572659422363
    21-05-2013 - 22:10 - 48.358942944761,1.7572660248515
    21-05-2013 - 22:11 - 48.358942909773,1.7572660500389
    21-05-2013 - 22:11 - 48.358942966061,1.7572660095182
    21-05-2013 - 22:12 - 48.358942756054,1.7572664411833
    21-05-2013 - 22:13 - 48.358942901361,1.7572661262369
    21-05-2013 - 22:14 - 48.358942747865,1.7572664646316
    21-05-2013 - 22:15 - 48.358942688373,1.7572665644484
    21-05-2013 - 22:16 - 48.35894242445,1.7572671380489
    21-05-2013 - 22:16 - 48.358942683426,1.7572665822806
    21-05-2013 - 22:16 - 48.358942808676,1.7572663074671

    Voici comment je récupère les coordonnées. Mais je ne comprend pas d'ou viens ce bug

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
     
    <?php
    // recup. des datas
    if( !empty($_GET['lng'])){
      $lng = floatval( $_GET[ "lng"]);
      if( !empty($_GET['lat'])){
        $lat = floatval( $_GET[ 'lat']);
        // mise au format fonction
        $point = implode( "," , array( $lat, $lng));
        // test du point
        $result = pointInPolygon($point, $la_zone);// ? 'INTERIEUR' : 'OUTSIDE';    
        // chaine affichage
        if( $result){
     
     
     
     
     
    $date = date("d-m-Y");
    $heure = date("H:i");
     
    $virg=(",");
     
     
     
    $fp = fopen("fichier.txt","w");
        fwrite($fp,"\n$date - $heure - $lat$virg$lng");
       fclose($fp);
     
     
     
    $fp = fopen("fichier.txt", "r");
    $don=fread($fp,2000);fclose($fp);
     
    $fp = fopen("archives.txt","a+");
        fwrite($fp,"$don");
       fclose($fp);
     
     
     
     
     
     
     
     
     
          //$chaine = '<span class="result valide">Position GPS mise à jour</span>';
     
     
     
    $fp = fopen("heure.txt", "r");
    $date=fread($fp,2000);fclose($fp);
     
     
     
     
     
    echo("<br>");
    echo("<br>");
    echo("<br>");
    echo("Derniere position");
    echo("$date");
     
     
        }
        else{
          $chaine = '<span class="result erreur">ERREUR ZONE!</span>';
     
     
     
    $fp = fopen("heure.txt", "r");
    $date=fread($fp,2000);fclose($fp);
     
     
     
     
     
    echo("<br>");
    echo("<br>");
    echo("<br>");
    echo("Derniere position");
    echo("$date");
     
     
        }
    ?>
    <!-- information sur le point -->
    <ul>
      <li>latitude  : <?php echo number_format($lat,6) ?></li>
      <li>longitude : <?php echo number_format($lng,6) ?></li>
    </ul>
    <?php
        echo $chaine;
      }
    }
    ?>

  16. #36
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 070
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 070
    Points : 44 677
    Points
    44 677
    Par défaut
    Il me semble qu'il eu mieux valu ouvrir une autre discussion, on s'éloigne du sujet initial.

    Il faudrait regarder du coté des options misent sur la méthode du navigator.geolocation.

  17. #37
    Membre régulier
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 320
    Points : 74
    Points
    74
    Par défaut
    Ok NosMoking

    J 'ai trouvé la solution....

    Je clos le sujet mais j 'en ouvre un autre....

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 2 PremièrePremière 12

Discussions similaires

  1. Aficher les coordonneés sur bouton
    Par pod1978 dans le forum ActionScript 1 & ActionScript 2
    Réponses: 1
    Dernier message: 27/04/2006, 16h35
  2. Comment récupérer les coordonnées sur le bureau d'une form ?
    Par fma2112 dans le forum API, COM et SDKs
    Réponses: 2
    Dernier message: 22/02/2006, 23h43
  3. Une infobulle à partir des coordonnées sur une image
    Par dark_vidor dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 28/01/2006, 21h20
  4. Interdire à X d'écrire sur le disque dur, possible ?
    Par Michaël dans le forum Applications et environnements graphiques
    Réponses: 4
    Dernier message: 29/10/2004, 16h50
  5. Existe-t-il des Dé-compilateurs sur Terre?
    Par Julien_riquelme dans le forum Autres éditeurs
    Réponses: 11
    Dernier message: 15/12/2003, 01h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo