banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

#1 Thu 17 November 2011 16:26

icadedt
Participant assidu
Lieu: ici et là
Date d'inscription: 21 Jul 2006
Messages: 478

reverse geocoding googlemaps probleme accents

Bonjour,


j'utilise le web service de geocodage inversé de google maps:  coordonnées ---> nom de rue

google me renvoie un xml dans lequel les lettres à accents sont mal définies:

"Allée des Ormes" devient "Allée des Ormes"



Code:

<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
 <status>OK</status>
 <result>
  <type>street_address</type>
  <formatted_address>1-3 Allée des Ormes, 77200 Torcy, France</formatted_address>
  <address_component>
   <long_name>1-3</long_name>
   <short_name>1-3</short_name>
   <type>street_number</type>
  </address_component>
  <address_component>
   <long_name>Allée des Ormes</long_name>
   <short_name>Allée des Ormes</short_name>
   <type>route</type>
  </address_component>
  <address_component>
   <long_name>Torcy</long_name>
   <short_name>Torcy</short_name>
   <type>locality</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Seine-et-Marne</long_name>
   <short_name>77</short_name>
   <type>administrative_area_level_2</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>ÃŽle-de-France</long_name>
   <short_name>IdF</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>France</long_name>
   <short_name>FR</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>77200</long_name>
   <short_name>77200</short_name>
   <type>postal_code</type>
  </address_component>
  <geometry>
   <location>
    <lat>48.8495680</lat>
    <lng>2.6477136</lng>
   </location>
   <location_type>RANGE_INTERPOLATED</location_type>
   <viewport>
    <southwest>
     <lat>48.8483230</lat>
     <lng>2.6463598</lng>
    </southwest>
    <northeast>
     <lat>48.8510209</lat>
     <lng>2.6490577</lng>
    </northeast>
   </viewport>
   <bounds>
    <southwest>
     <lat>48.8491099</lat>
     <lng>2.6475480</lng>
    </southwest>
    <northeast>
     <lat>48.8502340</lat>
     <lng>2.6478695</lng>
    </northeast>
   </bounds>
  </geometry>
 </result>
 <result>
  <type>postal_code</type>
  <formatted_address>77200 Torcy, France</formatted_address>
  <address_component>
   <long_name>77200</long_name>
   <short_name>77200</short_name>
   <type>postal_code</type>
  </address_component>
  <address_component>
   <long_name>Torcy</long_name>
   <short_name>Torcy</short_name>
   <type>locality</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Seine-et-Marne</long_name>
   <short_name>77</short_name>
   <type>administrative_area_level_2</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>ÃŽle-de-France</long_name>
   <short_name>IdF</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>France</long_name>
   <short_name>FR</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <geometry>
   <location>
    <lat>48.8545563</lat>
    <lng>2.6544406</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>48.8322904</lat>
     <lng>2.6290925</lng>
    </southwest>
    <northeast>
     <lat>48.8744033</lat>
     <lng>2.6658201</lng>
    </northeast>
   </viewport>
   <bounds>
    <southwest>
     <lat>48.8322904</lat>
     <lng>2.6290925</lng>
    </southwest>
    <northeast>
     <lat>48.8744033</lat>
     <lng>2.6658201</lng>
    </northeast>
   </bounds>
  </geometry>
 </result>
 <result>
  <type>locality</type>
  <type>political</type>
  <formatted_address>Torcy, France</formatted_address>
  <address_component>
   <long_name>Torcy</long_name>
   <short_name>Torcy</short_name>
   <type>locality</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Seine-et-Marne</long_name>
   <short_name>77</short_name>
   <type>administrative_area_level_2</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>ÃŽle-de-France</long_name>
   <short_name>IdF</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>France</long_name>
   <short_name>FR</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <geometry>
   <location>
    <lat>48.8505720</lat>
    <lng>2.6544720</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>48.8322930</lat>
     <lng>2.6290990</lng>
    </southwest>
    <northeast>
     <lat>48.8745280</lat>
     <lng>2.6660350</lng>
    </northeast>
   </viewport>
   <bounds>
    <southwest>
     <lat>48.8322930</lat>
     <lng>2.6290990</lng>
    </southwest>
    <northeast>
     <lat>48.8745280</lat>
     <lng>2.6660350</lng>
    </northeast>
   </bounds>
  </geometry>
 </result>
 <result>
  <type>administrative_area_level_2</type>
  <type>political</type>
  <formatted_address>Seine-et-Marne, France</formatted_address>
  <address_component>
   <long_name>Seine-et-Marne</long_name>
   <short_name>77</short_name>
   <type>administrative_area_level_2</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>ÃŽle-de-France</long_name>
   <short_name>IdF</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>France</long_name>
   <short_name>FR</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <geometry>
   <location>
    <lat>48.8410820</lat>
    <lng>2.9993660</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>48.1200810</lat>
     <lng>2.3923260</lng>
    </southwest>
    <northeast>
     <lat>49.1178979</lat>
     <lng>3.5590070</lng>
    </northeast>
   </viewport>
   <bounds>
    <southwest>
     <lat>48.1200810</lat>
     <lng>2.3923260</lng>
    </southwest>
    <northeast>
     <lat>49.1178979</lat>
     <lng>3.5590070</lng>
    </northeast>
   </bounds>
  </geometry>
 </result>
 <result>
  <type>administrative_area_level_1</type>
  <type>political</type>
  <formatted_address>ÃŽle-de-France, France</formatted_address>
  <address_component>
   <long_name>ÃŽle-de-France</long_name>
   <short_name>IdF</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>France</long_name>
   <short_name>FR</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <geometry>
   <location>
    <lat>48.8499198</lat>
    <lng>2.6370411</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>48.1200810</lat>
     <lng>1.4461700</lng>
    </southwest>
    <northeast>
     <lat>49.2415040</lat>
     <lng>3.5590070</lng>
    </northeast>
   </viewport>
   <bounds>
    <southwest>
     <lat>48.1200810</lat>
     <lng>1.4461700</lng>
    </southwest>
    <northeast>
     <lat>49.2415040</lat>
     <lng>3.5590070</lng>
    </northeast>
   </bounds>
  </geometry>
 </result>
 <result>
  <type>country</type>
  <type>political</type>
  <formatted_address>France</formatted_address>
  <address_component>
   <long_name>France</long_name>
   <short_name>FR</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <geometry>
   <location>
    <lat>46.2276380</lat>
    <lng>2.2137490</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>41.3253000</lat>
     <lng>-5.5591000</lng>
    </southwest>
    <northeast>
     <lat>51.1242000</lat>
     <lng>9.6625000</lng>
    </northeast>
   </viewport>
   <bounds>
    <southwest>
     <lat>41.3253000</lat>
     <lng>-5.5591000</lng>
    </southwest>
    <northeast>
     <lat>51.1242000</lat>
     <lng>9.6625000</lng>
    </northeast>
   </bounds>
  </geometry>
 </result>
</GeocodeResponse>

Comment faire pour qu'il restitue les accents?

Hors ligne

 

#2 Thu 17 November 2011 17:42

Delu
Participant actif
Lieu: Briançon
Date d'inscription: 29 Apr 2008
Messages: 76

Re: reverse geocoding googlemaps probleme accents

C'est un pb d'encodage, probablement entre UTF8 et ANSI
je ne sais pas si tu utilises php mais si oui et si ton fichier retourné par google passe par php, tu peux regarder du coté  du header :
pour faire un fichier excel à partir de données reçues d'une base encodée en utf8 , je fais ça :

Code:

header("Content-type: application/vnd.ms-excel; charset=utf-8\n\n");
            header("Content-disposition: attachment; filename=mon_fichier_".date("Y-m-d_His").".xls");
            print utf8_decode($mon_contenu);

Si je ne fais pas le utf8_decode, j'ai un pb similaire dans mon fichier excel.

Hors ligne

 

Pied de page des forums

Powered by FluxBB