来自纬度/经度的谷歌地图API中的错误管理区域(来自邻国)

时间:2022-08-22 10:23:57

We have received wrong results for the 'administrative_area_level_1' part of near-country-limits points, but strangely 'administrative_area_level_2' and 'administrative_area_level_3' are correct.

我们收到了针对近国限制点的'administrative_area_level_1'部分的错误结果,但奇怪的是'administrative_area_level_2'和'administrative_area_level_3'是正确的。

For example for some selected points located in country A, it shows correctly that belongs to country A, with administrative_area_level_2 and administrative_area_level_3 from country A, but shows administrative_area_level_1 from a neighboring country B.

例如,对于位于国家/地区A中的某些选定点,它正确显示属于国家/地区A,来自国家/地区的administrative_area_level_2和administrative_area_level_3,但显示来自邻国B的administrative_area_level_1。

From a more in depth analysis, this seems to be happening only on the inner side of concave country limits, probably due to a box approximation made by the API.

从更深入的分析来看,这似乎只发生在凹国界限的内侧,可能是由于API的盒子近似。

Morevover, it seems that there's no tree-like data nesting for country/administrative areas.

此外,似乎国家/行政区域没有树状数据嵌套。

Sample points in CSV format:

CSV格式的示例点:

lat;long;country;level1;level2;level3
-20.125;-68.75;"Chile";"Departamento Autónomo de Potosí";"Tamarugal";"Pica"
-22.75;-67.875;"Chile";"Departamento Autónomo de Potosí";"El Loa";"San Pedro de Atacama"

In those 2 cases "Departamento Autónomo de Potosí" belongs to Bolivia, not Chile, but the smaller areas are from Chile (Tamarugal, Pica, El Loa, San Pedro de Atacama)

在这2起案件中,“DepartamentoAutónomodePotosí”属于玻利维亚,而不是智利,但较小的地区来自智利(Tamarugal,Pica,El Loa,San Pedro de Atacama)

We are using URLs like the following:

我们使用以下网址:

http://maps.googleapis.com/maps/api/geocode/json?latlng={0},{1}&sensor=false&language=es

replacing {0} and {1} with lat/long where appropriate.

在适当的地方用lat / long替换{0}和{1}。

1 个解决方案

#1


The results array of your coordinates does not give the same results to me (See snippet).

坐标的结果数组不会给我相同的结果(参见片段)。

This is the query I ran:

这是我跑的查询:

https://maps.googleapis.com/maps/api/geocode/json?latlng=-20.125,-68.75

Then I checked the coordinates for "Departamento Autónomo de Potosí" (you can get them here).
These are the coordinates you get:
Potosi Dept, Bolivia Latitude: -20.624713 | Longitude: -66.998801

然后我检查了“DepartamentoAutónomodePotosí”的坐标(你可以在这里找到它们)。这些是你得到的坐标:Potosi Dept,Bolivia纬度:-20.624713 |经度:-66.998801

Please recheck your query formats and coordinates. They do seem fine but just actually when you run it in your code, they might have been mismatched or something.

请重新检查您的查询格式和坐标。它们似乎很好但实际上当你在代码中运行它们时,它们可能是不匹配的东西。

results: [8]
0: {
    address_components: [5]
    0: {
      long_name: "A-685"
      short_name: "A-685"
      types: [1]
      0: "route" -
    } -
    1: {
      long_name: "Pica"
      short_name: "Pica"
      types: [2]
      0: "administrative_area_level_3"
      1: "political" -
    } -
    2: {
      long_name: "Tamarugal"
      short_name: "Tamarugal"
      types: [2]
      0: "administrative_area_level_2"
      1: "political" -
    } -
    3: {
      long_name: "Región de Tarapacá"
      short_name: "Región de Tarapacá"
      types: [2]
      0: "administrative_area_level_1"
      1: "political" -
    } -
    4: {
      long_name: "Chile"
      short_name: "CL"
      types: [2]
      0: "country"
      1: "political" -
    } -
    -
    formatted_address: "A-685, Pica, Región de Tarapacá, Chile"

#1


The results array of your coordinates does not give the same results to me (See snippet).

坐标的结果数组不会给我相同的结果(参见片段)。

This is the query I ran:

这是我跑的查询:

https://maps.googleapis.com/maps/api/geocode/json?latlng=-20.125,-68.75

Then I checked the coordinates for "Departamento Autónomo de Potosí" (you can get them here).
These are the coordinates you get:
Potosi Dept, Bolivia Latitude: -20.624713 | Longitude: -66.998801

然后我检查了“DepartamentoAutónomodePotosí”的坐标(你可以在这里找到它们)。这些是你得到的坐标:Potosi Dept,Bolivia纬度:-20.624713 |经度:-66.998801

Please recheck your query formats and coordinates. They do seem fine but just actually when you run it in your code, they might have been mismatched or something.

请重新检查您的查询格式和坐标。它们似乎很好但实际上当你在代码中运行它们时,它们可能是不匹配的东西。

results: [8]
0: {
    address_components: [5]
    0: {
      long_name: "A-685"
      short_name: "A-685"
      types: [1]
      0: "route" -
    } -
    1: {
      long_name: "Pica"
      short_name: "Pica"
      types: [2]
      0: "administrative_area_level_3"
      1: "political" -
    } -
    2: {
      long_name: "Tamarugal"
      short_name: "Tamarugal"
      types: [2]
      0: "administrative_area_level_2"
      1: "political" -
    } -
    3: {
      long_name: "Región de Tarapacá"
      short_name: "Región de Tarapacá"
      types: [2]
      0: "administrative_area_level_1"
      1: "political" -
    } -
    4: {
      long_name: "Chile"
      short_name: "CL"
      types: [2]
      0: "country"
      1: "political" -
    } -
    -
    formatted_address: "A-685, Pica, Región de Tarapacá, Chile"