4

Google Maps Api 有一个奇怪的问题。我像这样向 Google Api Places 发出自动完成请求。

https://maps.googleapis.com/maps/api/place/autocomplete/json?sensor=true&language=en&types=geocode&components=country:ua&input=Kiev,%20Dn&radius=30000&location=50.431698,30.503237&key= {key}

结果给了我5个地址。这是 JSON 响应:

{
    "predictions": [{
    "description": "Dniprovs'kyi district, Kiev, Kyiv city, Ukraine",
    "id": "023b6f6008f0b58208c7c1360c15966d591ebbf5",
    "matched_substrings": [{
    "length": 2,
    "offset": 0
},
    {
        "length": 4,
        "offset": 23
    }
],
"place_id": "ChIJ-2Pud7La1EARRomoyKV9Nvg",
"reference": "CoQBcQAAAM61hA62d_nNjn2xs7ooCbeAFvnHn9tlTWYxqxotYheKHD6-XVLEcTvnkRss16cMRVXF-9Wk3EmvrRm_R4_Tnvwyd1XVno0TWSk30OBb8b7n_f9rZjOgir0LIFDVDgVJY0cWmx5WHG2rxxtW_qz1r37-tw39WA6g6Qfv0yGf8-H2EhB1B8ZaolsxZ6IKgSp49aJHGhTSd8BUIKFeJ4Rbvh5cjqytLN8mBQ",
"terms":
[
{

    "offset": 0,
    "value": "Dniprovs'kyi district"
},
{
    "offset": 23,
    "value": "Kiev"
},
{
    "offset": 29,
    "value": "Kyiv city"
},
    {
        "offset": 40,
        "value": "Ukraine"
    }
],
"types":
    [
        "sublocality_level_1",
        "sublocality",
        "political",
        "geocode"
    ]
},
{
    "description": "Dniprovs'ka embankment, Kiev, Kyiv city, Ukraine",
    "id": "584f6c97be66f9dfd62c318ce83f6534004a6c8a",
    "matched_substrings": 
[{
    "length": 2,
    "offset": 0
},
    {
        "length": 4,
        "offset": 24
    }
],
"place_id": "EjBEbmlwcm92cydrYSBlbWJhbmttZW50LCBLaWV2LCBLeWl2IGNpdHksIFVrcmFpbmU",
"reference": "CmReAAAAtDXrk0vEFiKYHNPPhPXYBoQOJ38NGGjbUf7mTRH8-_cqtiIkTDDsZXzuUSATgr_uiflldtH4nUrhW0rsFmUtrkQIUz6CZCGRQTUdAJh83zagGLcuVEs1xchGY1A2izTOEhCaI_oBksWVRhO_CRaYvgSzGhQr0eOrWKZV1GJoHpGbvrtO6QZ_Ug",
"terms":
[{
    "offset": 0,
    "value": "Dniprovs'ka embankment"
},
{
    "offset": 24,
    "value": "Kiev"
},
{
    "offset": 30,
    "value": "Kyiv city"
},
    {
        "offset": 41,
        "value": "Ukraine"
    }
],
"types":
    [
        "route",
        "geocode"
    ]
},
{
    "description": "Dnepr, Kiev, Kyiv city, Ukraine",
    "id": "a3c4a39941ac4c54c2b176849696118af448a090",
    "matched_substrings": [{
    "length": 2,
    "offset": 0
},
    {
        "length": 4,
        "offset": 7
    }
],
"place_id": "ChIJjcChbKPP1EARTXya5VgHmOk",
"reference": "CmRYAAAAZuPj8SP1flByvXUVAcO3eeYb-das4IJeBPxo_usffK_Oq2mZFPZdPwhyCmyCfrCECX5ZwssyGQdaEWCCkSkyKbDCq3ZPxbEqYlyGXDFGNJ4DqGn7mXVoEHwMKKb5DG3sEhBaeZXXm9Fh-zh_Ajl0paRKGhSy1Z9s4Uv1AU609L0sztasqQU6rg",
"terms":
[
{
    "offset": 0,
    "value": "Dnepr"
},
{
    "offset": 7,
    "value": "Kiev"
},
{

    "offset": 13,
    "value": "Kyiv city"
},

    {
        "offset": 24,
        "value": "Ukraine"
    }
],
"types":
    [
        "subway_station",
        "train_station",
        "transit_station",
        "establishment",
        "geocode"
    ]
},
{
    "description": "Dnepr, Parkova Road, Kiev, Kyiv city, Ukraine",
    "id": "973dc14397b70d5be6d2ddd3c5bc2a6e2de04b59",
    "matched_substrings": 
[{
    "length": 2,
    "offset": 0
},
    {
        "length": 4,
        "offset": 21
    }
],
"place_id": "ChIJQ_49j7LP1EARLXp2vRI8pws",
"reference": "CnRlAAAAiR50_V3AfqkhvGnoHhc4n6QjXkm-aWerLtLHEhxD6cJmGuirRktoafooAdbbGOzh97TSk1MklDfBs0fyrQgRnVjkDzzjioCspJ1La6gh8I8BUC0LTpABJOlkjrvz5wpC0HhXgYm4EbHqwZZY2aBYdBIQVqbAYC42ALmzxEqWXL5H9RoU4g-MKNF34R3Y9c_-5Z7lxf9n1vY",
"terms":
[{
    "offset": 0,
    "value": "Dnepr"
},
{
    "offset": 7,
    "value": "Parkova Road"

},
{
    "offset": 21,
    "value": "Kiev"
},
{
    "offset": 27,
    "value": "Kyiv city"

},
    {
        "offset": 38,
        "value": "Ukraine"
    }
],
"types":
    [
        "establishment",
        "geocode"
    ]
},
{
    "description": "Dnipro, Kiev, Kyiv city, Ukraine",
    "id": "9e94078fbf056913f1bf0e3de90b04fc261d21b0",
    "matched_substrings": 
[{
    "length": 2,
    "offset": 0
},
    {
        "length": 4,
        "offset": 8
    }
],
"place_id": "ChIJMe5dbqPP1EARSnZi_bKNY0A",
"reference": "CmRYAAAAbkjesqoz4jiN86mZU5KG_hNatcXIc5GJMHvSzmIKgedGz5hmlVl_QKqyO1vupXGBLOi-wx64i0e_15mgNQbwjzGBabLTDuAC0H73PD9Dz3w0C4hMqHhsNjJmRsKLYTFMEhCvwWcBT_EWiCU5Fmr32bn2GhRKADBuv9Qq52rH2Ru5-0EdDPWlGw",
"terms":
[{
    "offset": 0,
    "value": "Dnipro"
},
{
    "offset": 8,
    "value": "Kiev"
},
{
    "offset": 14,
    "value": "Kyiv city"
},
    {
        "offset": 25,
        "value": "Ukraine"
    }
],
"types":
            [
                "bus_station",
                "transit_station",
                "establishment",
                "geocode"
            ]
        }
    ],
    "status": "OK"
}

在此之后,我尝试获取每个地址的地点详细信息。其中 4 个地址一切正常,但地址为“Dniprovs'ka embankment, Kiev, Kyiv city, Ukraine” 的地址为 placeid

EjBEbmlwcm92cydrYSBlbWJhbmttZW50LCBLaWV2LCBLeWl2IGNpdHksIFVrcmFpbmU

Google Places API 响应

404:请求: https ://maps.googleapis.com/maps/api/place/details/json?placeid=EjBEbmlwcm92cydrYSBlbWJhbmttZW50LCBLaWV2LCBLeWl2IGNpdHksIFVrcmFpbmU&key= {key},响应:{“html_attributions”:[],“status”:“NOT_FOUND”}

我究竟做错了什么?感谢帮助。

4

0 回答 0