geocoder-php / geocoder-php/Geocoder
Incorrect parsed name from Google Maps api
Nessuno ha ancora preso questa issue.
- Lingua principale
- PHP
- Stelle
- 4k
- Fork
- 525
- Merge medio
- 8m
- PR unite (30g)
- 1
Descrizione
Searching for Pershagen returns the following json
https://maps.googleapis.com/maps/api/geocode/json?address=Pershagen&key=xxx
{
"results" : [
{
"address_components" : [
{
"long_name" : "Pershagen",
"short_name" : "Pershagen",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Södertälje",
"short_name" : "Södertälje",
"types" : [ "postal_town" ]
},
{
"long_name" : "Stockholm County",
"short_name" : "Stockholm County",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Sweden",
"short_name" : "SE",
"types" : [ "country", "political" ]
},
{
"long_name" : "151 39",
"short_name" : "151 39",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "151 39 Pershagen, Sweden",
"geometry" : {
"location" : {
"lat" : 59.14664239999999,
"lng" : 17.6511284
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 59.15236419999999,
"lng" : 17.6671358
},
"southwest" : {
"lat" : 59.1409196,
"lng" : 17.635121
}
}
},
"place_id" : "ChIJV_Hb5dUSX0YRULaMsvX-AAo",
"types" : [ "locality", "political" ]
}
],
"status" : "OK"
}
Using the google maps provider I get the following object. The phrase Pershagen is omitted.

Searching for the similar area Ronna I get a more correct object.

When looping over address components Pershagen is first set but then overridden by Södertälje.
Reversing the array on L235 in GoogleMaps.php returns a more accurate result.
+foreach (array_reverse($result->address_components) as $component) {
-foreach ($result->address_components as $component) {

Not at all sure how this will affect other results!
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in GoogleMaps.php, intorno alla riga 235, e traccia come address_components vengono mappati nell’oggetto restituito. Riproduci le ricerche di Pershagen e Ronna, quindi verifica che il nome analizzato sia corretto in entrambi i casi e che i risultati degli altri componenti dell’indirizzo non subiscano regressioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- api, backend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100