geocoder-php / geocoder-php/Geocoder
Incorrect parsed name from Google Maps api
まだ誰も着手していません。
- 主要言語
- PHP
- スター
- 4k
- フォーク
- 525
- 平均マージ
- 8分
- マージ済み PR(30日)
- 1
説明
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!
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
GoogleMaps.php の235行目付近から始め、address_components が返されるオブジェクトにどのようにマッピングされているかを追跡します。Pershagen と Ronna の検索を再現し、解析された名前がどちらの場合も正しいこと、また他の住所コンポーネントの結果にリグレッションがないことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- api, backend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100