{"id":122,"date":"2017-09-18T09:44:31","date_gmt":"2017-09-18T07:44:31","guid":{"rendered":"https:\/\/numa-bord.com\/miniblog\/?p=122"},"modified":"2018-11-01T13:13:02","modified_gmt":"2018-11-01T12:13:02","slug":"php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain","status":"publish","type":"post","link":"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/","title":{"rendered":"PHP &#038; Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d&rsquo;une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion&#8230;)"},"content":{"rendered":"<p>La semaine derni\u00e8re nous avons vu une fonction permettant de <a href=\"https:\/\/numa-bord.com\/miniblog\/php-calcul-de-distance-entre-2-coordonnees-gps-latitude-longitude\/\">calculer la distance entre deux coordonn\u00e9es GPS<\/a>, mais comment r\u00e9cup\u00e9rer ces coordonn\u00e9es (et d&rsquo;autres informations) \u00e0 partir d&rsquo;une adresse ? Nous allons voir comment faire avec l&rsquo;API google Map, il vous faudra tout d&rsquo;abord r\u00e9cup\u00e9rer une cl\u00e9 pour les appel \u00e0 l&rsquo;API (<a href=\"https:\/\/developers.google.com\/maps\/web\/?hl=fr\">par ici<\/a>).<\/p>\n<p>Ensuite vous pouvez utiliser la classe et la fonction ci-dessous afin de r\u00e9cup\u00e9rer les informations (adresse compl\u00e8te, latitude, longitude, vile, code postal, d\u00e9partement, r\u00e9gion, pays) correspondant \u00e0 l&rsquo;adresse pass\u00e9 au format texte.<\/p>\n<div class=\"codecolorer-container php default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"php codecolorer\"><span class=\"kw2\">class<\/span> GmapApi <span class=\"br0\">&#123;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; <span class=\"kw2\">private<\/span> static <span class=\"re0\">$apikey<\/span> <span class=\"sy0\">=<\/span> <span class=\"st_h\">'VOTRE_API_KEY'<\/span><span class=\"sy0\">;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; <span class=\"kw2\">public<\/span> static <span class=\"kw2\">function<\/span> geocodeAddress<span class=\"br0\">&#40;<\/span><span class=\"re0\">$address<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/valeurs vide par d\u00e9faut<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$data<\/span> <span class=\"sy0\">=<\/span> <a href=\"http:\/\/www.php.net\/array\"><span class=\"kw3\">array<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'address'<\/span> <span class=\"sy0\">=&gt;<\/span> <span class=\"st_h\">''<\/span><span class=\"sy0\">,<\/span> <span class=\"st_h\">'lat'<\/span> <span class=\"sy0\">=&gt;<\/span> <span class=\"st_h\">''<\/span><span class=\"sy0\">,<\/span> <span class=\"st_h\">'lng'<\/span> <span class=\"sy0\">=&gt;<\/span> <span class=\"st_h\">''<\/span><span class=\"sy0\">,<\/span> <span class=\"st_h\">'city'<\/span> <span class=\"sy0\">=&gt;<\/span> <span class=\"st_h\">''<\/span><span class=\"sy0\">,<\/span> <span class=\"st_h\">'department'<\/span> <span class=\"sy0\">=&gt;<\/span> <span class=\"st_h\">''<\/span><span class=\"sy0\">,<\/span> <span class=\"st_h\">'region'<\/span> <span class=\"sy0\">=&gt;<\/span> <span class=\"st_h\">''<\/span><span class=\"sy0\">,<\/span> <span class=\"st_h\">'country'<\/span> <span class=\"sy0\">=&gt;<\/span> <span class=\"st_h\">''<\/span><span class=\"sy0\">,<\/span> <span class=\"st_h\">'postal_code'<\/span> <span class=\"sy0\">=&gt;<\/span> <span class=\"st_h\">''<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/on formate l'adresse<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$address<\/span> <span class=\"sy0\">=<\/span> <a href=\"http:\/\/www.php.net\/str_replace\"><span class=\"kw3\">str_replace<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot; &quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;+&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"re0\">$address<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/on fait l'appel \u00e0 l'API google map pour g\u00e9ocoder cette adresse<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$json<\/span> <span class=\"sy0\">=<\/span> <a href=\"http:\/\/www.php.net\/file_get_contents\"><span class=\"kw3\">file_get_contents<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;https:\/\/maps.google.com\/maps\/api\/geocode\/json?key=&quot;<\/span> <span class=\"sy0\">.<\/span> <span class=\"kw2\">self<\/span><span class=\"sy0\">::<\/span><span class=\"re0\">$apikey<\/span> <span class=\"sy0\">.<\/span> <span class=\"st0\">&quot;&amp;address=<span class=\"es4\">$address<\/span>&amp;sensor=false&amp;region=fr&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$json<\/span> <span class=\"sy0\">=<\/span> <a href=\"http:\/\/www.php.net\/json_decode\"><span class=\"kw3\">json_decode<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$json<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/on enregistre les r\u00e9sultats recherch\u00e9s<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$json<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">status<\/span> <span class=\"sy0\">==<\/span> <span class=\"st_h\">'OK'<\/span> <span class=\"sy0\">&amp;&amp;<\/span> <a href=\"http:\/\/www.php.net\/count\"><span class=\"kw3\">count<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$json<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">results<\/span><span class=\"br0\">&#41;<\/span> <span class=\"sy0\">&gt;<\/span> <span class=\"nu0\">0<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$res<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$json<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">results<\/span><span class=\"br0\">&#91;<\/span><span class=\"nu0\">0<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/adresse compl\u00e8te et latitude\/longitude<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$data<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'address'<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$res<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">formatted_address<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$data<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'lat'<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$res<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">geometry<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">location<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">lat<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$data<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'lng'<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$res<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">geometry<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">location<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">lng<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">foreach<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$res<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">address_components<\/span> <span class=\"kw1\">as<\/span> <span class=\"re0\">$component<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/ville<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$component<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">types<\/span><span class=\"br0\">&#91;<\/span><span class=\"nu0\">0<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">==<\/span> <span class=\"st_h\">'locality'<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$data<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'city'<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$component<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">long_name<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/d\u00e9partment<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$component<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">types<\/span><span class=\"br0\">&#91;<\/span><span class=\"nu0\">0<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">==<\/span> <span class=\"st_h\">'administrative_area_level_2'<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$data<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'department'<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$component<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">long_name<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/r\u00e9gion<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$component<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">types<\/span><span class=\"br0\">&#91;<\/span><span class=\"nu0\">0<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">==<\/span> <span class=\"st_h\">'administrative_area_level_1'<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$data<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'region'<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$component<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">long_name<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/pays<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$component<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">types<\/span><span class=\"br0\">&#91;<\/span><span class=\"nu0\">0<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">==<\/span> <span class=\"st_h\">'country'<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$data<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'country'<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$component<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">long_name<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/code postal<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$component<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">types<\/span><span class=\"br0\">&#91;<\/span><span class=\"nu0\">0<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">==<\/span> <span class=\"st_h\">'postal_code'<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$data<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'postal_code'<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$component<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">long_name<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">return<\/span> <span class=\"re0\">$data<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<br \/>\n<span class=\"br0\">&#125;<\/span><\/div><\/div>\n<p>Par exemple en appelant la fonction de cette mani\u00e8re : <\/p>\n<div class=\"codecolorer-container php default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"php codecolorer\"><span class=\"re0\">$data<\/span> <span class=\"sy0\">=<\/span> GmapApi<span class=\"sy0\">::<\/span><span class=\"me2\">geocodeAddress<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'151 avenue du pont trinquat 34070 Montpellier'<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"co1\">\/\/on affiche les diff\u00e9rente infos<\/span><br \/>\n<span class=\"kw1\">echo<\/span> <span class=\"st_h\">'&lt;ul&gt;'<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"kw1\">foreach<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$data<\/span> <span class=\"kw1\">as<\/span> <span class=\"re0\">$key<\/span><span class=\"sy0\">=&gt;<\/span><span class=\"re0\">$value<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw1\">echo<\/span> <span class=\"st_h\">'&lt;li&gt;'<\/span><span class=\"sy0\">.<\/span><span class=\"re0\">$key<\/span><span class=\"sy0\">.<\/span><span class=\"st_h\">' : '<\/span><span class=\"sy0\">.<\/span><span class=\"re0\">$value<\/span><span class=\"sy0\">.<\/span><span class=\"st_h\">'&lt;\/li&gt;'<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"kw1\">echo<\/span> <span class=\"st_h\">'&lt;\/ul&gt;'<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"coMULTI\">\/* va afficher<br \/>\naddress : 151 Avenue du Pont-Trinquat, 34000 Montpellier, France<br \/>\nlat : 43.6008177<br \/>\nlng : 3.8873392<br \/>\ncity : Montpellier<br \/>\ndepartment : H\u00e9rault<br \/>\nregion : Occitanie<br \/>\ncountry : France<br \/>\npostal_code : 34000<br \/>\n*\/<\/span><\/div><\/div>\n<p>On peux maintenant utiliser cette fonction pour trouver la distance entre 2 adresses, gr\u00e2ce \u00e0 notre fonction <a href=\"https:\/\/numa-bord.com\/miniblog\/php-calcul-de-distance-entre-2-coordonnees-gps-latitude-longitude\/\">de l&rsquo;article pr\u00e9c\u00e9dent<\/a>. Par exemple : <\/p>\n<div class=\"codecolorer-container php default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"php codecolorer\"><span class=\"re0\">$data1<\/span> <span class=\"sy0\">=<\/span> GmapApi<span class=\"sy0\">::<\/span><span class=\"me2\">geocodeAddress<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'151 avenue du pont trinquat 34000 montpellier'<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"re0\">$data2<\/span> <span class=\"sy0\">=<\/span> GmapApi<span class=\"sy0\">::<\/span><span class=\"me2\">geocodeAddress<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'Avenue des c\u00e9vennes 30360 v\u00e9z\u00e9nobre'<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"kw1\">echo<\/span> <a href=\"http:\/\/www.php.net\/round\"><span class=\"kw3\">round<\/span><\/a><span class=\"br0\">&#40;<\/span>Misc<span class=\"sy0\">::<\/span><span class=\"me2\">distance<\/span><span class=\"br0\">&#40;<\/span><span class=\"re0\">$data1<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'lat'<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">,<\/span> <span class=\"re0\">$data1<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'lng'<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">,<\/span> <span class=\"re0\">$data2<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'lat'<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">,<\/span> <span class=\"re0\">$data2<\/span><span class=\"br0\">&#91;<\/span><span class=\"st_h\">'lng'<\/span><span class=\"br0\">&#93;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">.<\/span><span class=\"st_h\">' Km'<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"co1\">\/\/Affiche : 54 Km<\/span><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>La semaine derni\u00e8re nous avons vu une fonction permettant de calculer la distance entre deux coordonn\u00e9es GPS, mais comment r\u00e9cup\u00e9rer ces coordonn\u00e9es (et d&rsquo;autres informations) \u00e0 partir d&rsquo;une adresse ? Nous allons voir comment faire avec l&rsquo;API google Map, il vous faudra tout d&rsquo;abord r\u00e9cup\u00e9rer une cl\u00e9 pour les appel \u00e0 l&rsquo;API (par ici). Ensuite [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2,13,11,7],"tags":[],"class_list":["post-122","post","type-post","status-publish","format-standard","hentry","category-developpement","category-google-map-api","category-javascript","category-php"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PHP &amp; Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d&#039;une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion...) - Pense b\u00eate d&#039;un d\u00e9veloppeur web<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP &amp; Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d&#039;une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion...) - Pense b\u00eate d&#039;un d\u00e9veloppeur web\" \/>\n<meta property=\"og:description\" content=\"La semaine derni\u00e8re nous avons vu une fonction permettant de calculer la distance entre deux coordonn\u00e9es GPS, mais comment r\u00e9cup\u00e9rer ces coordonn\u00e9es (et d&rsquo;autres informations) \u00e0 partir d&rsquo;une adresse ? Nous allons voir comment faire avec l&rsquo;API google Map, il vous faudra tout d&rsquo;abord r\u00e9cup\u00e9rer une cl\u00e9 pour les appel \u00e0 l&rsquo;API (par ici). Ensuite [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/\" \/>\n<meta property=\"og:site_name\" content=\"Pense b\u00eate d&#039;un d\u00e9veloppeur web\" \/>\n<meta property=\"article:published_time\" content=\"2017-09-18T07:44:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-01T12:13:02+00:00\" \/>\n<meta name=\"author\" content=\"Numa\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Numa\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/\"},\"author\":{\"name\":\"Numa\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e\"},\"headline\":\"PHP &#038; Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d&rsquo;une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion&#8230;)\",\"datePublished\":\"2017-09-18T07:44:31+00:00\",\"dateModified\":\"2018-11-01T12:13:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/\"},\"wordCount\":425,\"commentCount\":10,\"articleSection\":[\"D\u00e9veloppement\",\"Google map API\",\"Javascript\",\"PHP\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/\",\"url\":\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/\",\"name\":\"PHP & Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d'une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion...) - Pense b\u00eate d&#039;un d\u00e9veloppeur web\",\"isPartOf\":{\"@id\":\"https:\/\/numa-bord.com\/miniblog\/#website\"},\"datePublished\":\"2017-09-18T07:44:31+00:00\",\"dateModified\":\"2018-11-01T12:13:02+00:00\",\"author\":{\"@id\":\"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e\"},\"breadcrumb\":{\"@id\":\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/numa-bord.com\/miniblog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP &#038; Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d&rsquo;une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion&#8230;)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/#website\",\"url\":\"https:\/\/numa-bord.com\/miniblog\/\",\"name\":\"Pense b\u00eate d&#039;un d\u00e9veloppeur web\",\"description\":\"(php, javascript, Symfony, Wordpress....)\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/numa-bord.com\/miniblog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e\",\"name\":\"Numa\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g\",\"caption\":\"Numa\"},\"url\":\"https:\/\/numa-bord.com\/miniblog\/author\/negonner\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP & Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d'une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion...) - Pense b\u00eate d&#039;un d\u00e9veloppeur web","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/","og_locale":"fr_FR","og_type":"article","og_title":"PHP & Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d'une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion...) - Pense b\u00eate d&#039;un d\u00e9veloppeur web","og_description":"La semaine derni\u00e8re nous avons vu une fonction permettant de calculer la distance entre deux coordonn\u00e9es GPS, mais comment r\u00e9cup\u00e9rer ces coordonn\u00e9es (et d&rsquo;autres informations) \u00e0 partir d&rsquo;une adresse ? Nous allons voir comment faire avec l&rsquo;API google Map, il vous faudra tout d&rsquo;abord r\u00e9cup\u00e9rer une cl\u00e9 pour les appel \u00e0 l&rsquo;API (par ici). Ensuite [&hellip;]","og_url":"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/","og_site_name":"Pense b\u00eate d&#039;un d\u00e9veloppeur web","article_published_time":"2017-09-18T07:44:31+00:00","article_modified_time":"2018-11-01T12:13:02+00:00","author":"Numa","twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"Numa","Dur\u00e9e de lecture estim\u00e9e":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/#article","isPartOf":{"@id":"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/"},"author":{"name":"Numa","@id":"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e"},"headline":"PHP &#038; Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d&rsquo;une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion&#8230;)","datePublished":"2017-09-18T07:44:31+00:00","dateModified":"2018-11-01T12:13:02+00:00","mainEntityOfPage":{"@id":"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/"},"wordCount":425,"commentCount":10,"articleSection":["D\u00e9veloppement","Google map API","Javascript","PHP"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/","url":"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/","name":"PHP & Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d'une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion...) - Pense b\u00eate d&#039;un d\u00e9veloppeur web","isPartOf":{"@id":"https:\/\/numa-bord.com\/miniblog\/#website"},"datePublished":"2017-09-18T07:44:31+00:00","dateModified":"2018-11-01T12:13:02+00:00","author":{"@id":"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e"},"breadcrumb":{"@id":"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/numa-bord.com\/miniblog\/php-google-map-api-recuperer-coordonees-gps-depuis-adresse-format-humain\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/numa-bord.com\/miniblog\/"},{"@type":"ListItem","position":2,"name":"PHP &#038; Google Map API : R\u00e9cup\u00e9rer les d\u00e9tails d&rsquo;une adresse (latitude, longitude, d\u00e9partement, r\u00e9gion&#8230;)"}]},{"@type":"WebSite","@id":"https:\/\/numa-bord.com\/miniblog\/#website","url":"https:\/\/numa-bord.com\/miniblog\/","name":"Pense b\u00eate d&#039;un d\u00e9veloppeur web","description":"(php, javascript, Symfony, Wordpress....)","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/numa-bord.com\/miniblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Person","@id":"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e","name":"Numa","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g","caption":"Numa"},"url":"https:\/\/numa-bord.com\/miniblog\/author\/negonner\/"}]}},"_links":{"self":[{"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/comments?post=122"}],"version-history":[{"count":12,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/posts\/122\/revisions"}],"predecessor-version":[{"id":420,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/posts\/122\/revisions\/420"}],"wp:attachment":[{"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/media?parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/categories?post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/tags?post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}