Last active
August 29, 2015 14:00
-
-
Save AdrienVH/11287958 to your computer and use it in GitHub Desktop.
Appeler Nominatim (OSM) pour géocoder une ou plusieurs adresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'http://nominatim.openstreetmap.org/search?'; | |
// Adresses | |
$adresses[] = '191 rue Saint-Jacques, Paris'; | |
$adresses[] = 'Parc des Buttes Chaumont, Paris'; | |
$adresses[] = '37 bd Romain Rolland, Montrouge'; | |
// Géocodage | |
foreach($adresses as $adresse) | |
{ | |
$params = http_build_query(array('q' => $adresse, 'format' => 'json')); | |
$appel_api = file_get_contents($url.$params); | |
$resultats = json_decode($appel_api); | |
echo var_export($resultats, true); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment