Incorrect parsed name from Google Maps api

Đang mở
#1,077 8 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
php
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu trong GoogleMaps.php, khoảng dòng 235, và theo dõi cách address_components được ánh xạ vào object được trả về. Tái hiện các lượt tìm kiếm Pershagen và Ronna, sau đó xác minh rằng tên được phân tích là chính xác trong cả hai trường hợp và kết quả của các thành phần địa chỉ khác không bị regression.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

provider

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.
image

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

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) {

image

Not at all sure how this will affect other results!

Ngôn ngữ chính
PHP
Star
4k
Fork
525
Merge trung bình
8 phút
Pull request đã merge (30 ngày)
1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của geocoder-php/Geocoder

Tất cả issue của geocoder-php/Geocoder

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.