从Google Maps API获取JSON中的City多边形边界吗?


51

在Google Maps中搜索城市时,将显示城市的行政边界。

在此处输入图片说明

有没有一种方法可以使用Google Maps API以JSON格式获取City的多边形边界?



@ArMoraer您的相关文章已经
走到

Google地图的格式为GeoJson。有一个用于按邮政编码,城市和州进行查询的API,请访问www.boundaries-io.com
Jery​​l Cook

Answers:


48

您可以使用openstreetmap在json中获取多边形坐标以与googlemaps一起使用。转到http://nominatim.openstreetmap.org/ 搜索“ Partido deItuzaingó”之类的地方

点击“详细信息”

查找OSM ID并将其复制(control + c),例如:2018776

将ID粘贴到 http://polygons.openstreetmap.fr/index.py中, 然后下载多边形



1
global.mapit.mysociety.org不适用于巴格达(但原始帖子适用):首先我在这里得到它:nominatim.openstreetmap.org/details.php? place_id=179724619 ,然后发现关系id为5638803,何时我运行global.mapit.mysociety.org/code/osm_rel/5638803我得到了{"code": 404, "error": "No areas were found that matched code osm_rel = 5638803."}
大约


4

不,没有办法窃取Google的数据。也许您可以看一下供人们下载的OpenStreetMap


例如,如何在OpenStreetMap中提取多边形边界?如果我提取了此内容,可以在Google地图上绘制提取的多边形吗?
Luis Tiago

请搜索该网站,并提出一个新的问题,如果您找不到答案
Ian Turton

谁会考虑这种偷窃行为?该数据取自美国人口普查。
ihodonald

然后从美国人口普查站点获取它,尽管我怀疑它们在英国的城市边界是否很多
伊恩·特顿

4

我找到了解决该问题的方法。

  1. 前往www.gadm.org/country
  2. 选择您的国家/地区,然后选择Google Earth .kmz文件格式
  3. 选择您需要的级别(所有小城镇/城市中,级别3最高)
  4. 下载文件(可能很大)
  5. 解压缩.kmz文件(您将找到一个.kml XML文件)
  6. 用Sublime或notepad ++打开它(该文件对于其他文本编辑器可能太大了)
  7. 按城市名称搜索并在下面复制数据(大文件搜索可能需要1-4秒)

您可以使用经纬度较长的数据并将其解析为一个数组。该解决方案效果很好,但是路径的质量有时很粗糙。



-1

以json格式获取确切的位置边界坐标,例如Google搜索。

地图视图:http : //theopenmap.herokuapp.com/

POST:http : //theopenmap.herokuapp.com/api/v2_coordinates/

{"location": "enter your location"}

回应:[ [ 31.1038963, 77.1028804 ], [ 31.0756716, 77.11867319999999 ], [ 31.0717018, 77.1523188 ], [ 31.0450854, 77.1815013 ], [ 31.0705256, 77.2127436 ], [ 31.1103633, 77.223215 ], [ 31.1265289, 77.2034739 ], [ 31.1222673, 77.1181582 ], [ 31.1038963, 77.1028804 ], [ 31.2883822, 78.2982197 ], [ 31.2977484, 78.2803793 ], [ 31.320049, 78.2866234 ], [ 31.3285232, 78.2768112 ], [ 31.3325373, 78.2446983 ], [ 31.3468097, 78.229534 ], [ 31.3303072, 78.1996512 ], [ 31.3490397, 78.14925189999998 ], [ 31.3646501, 78.13810159999998 ], [ 31.3829366, 78.1510359 ], [ 31.3882887, 78.1479139 ], [ 31.4141574, 78.0952845 ], [ 31.4244156, 78.0881483 ], [ 31.4230776, 78.0395331 ], [ 31.4052371, 78.0092043 ], [ 31.4070212, 77.9485468 ], [ 31.4186175, 77.9454247 ], [ 31.4288758, 77.9128658 ], [ 31.4476082, 77.8874432 ], [ 31.4609886, 77.8829831 ], [ 31.4752609, 77.8646966 ], [ 31.4913174, 77.8673727 ], [ 31.5082658, 77.8544383 ], [ 31.515848, 77.8441801 ], [ 31.5100498, 77.840612 ], [ 31.5113879, 77.8254476 ], [ 31.5314584, 77.8299077 ], [ 31.5671393, 77.8200955 ], [ 31.5836417, 77.8236636 ], [ 31.6153085, 77.7986869 ], [ 31.6420692, 77.8093912 ], [ 31.6674919, 77.7964569 ], [ 31.6777501, 77.7790624 ], [ 31.6911305, 77.7741563 ], [ 31.7076329, 77.7563158 ], [ 31.7178912, 77.7353533 ], [ 31.7187832, 77.7192969 ], [ 31.7067409, 77.6934282 ], [ 31.7076329, 77.6702356 ], [ 31.6643698, 77.6332167 ], [ 31.6385011, 77.6479351 ], [ 31.633149, 77.6381228 ], [ 31.6170926, 77.6332167 ], [ 31.5823037, 77.6407989 ], [ 31.5461768, 77.684062 ], [ 31.5064817, 77.6938742 ], [ 31.4667867, 77.6559633 ], [ 31.4502843, 77.6131462 ], [ 31.4275377, 77.60824 ], [ 31.4016691, 77.6189443 ], [ 31.3949789, 77.6149302 ], [ 31.399439, 77.5765732 ], [ 31.3905188, 77.5565027 ], [ 31.3905188, 77.5391083 ], [ 31.3552839, 77.5110095 ], [ 31.36019, 77.4838028 ], [ 31.3454716, 77.4151171 ], [ 31.3659881, 77.38746439999998 ], [ 31.3650961, 77.371854 ], [ 31.3557299, 77.3433092 ], [ 31.3267391, 77.32680679999999 ], [ 31.3022085, 77.3219007 ], [ 31.2754478, 77.2911259 ], [ 31.2696497, 77.2683793 ], [ 31.2794619, 77.255891 ], [ 31.2580534, 77.2340364 ], [ 31.2638515, 77.2050457 ], [ 31.2482411, 77.1903273 ], [ 31.2482411, 77.1822991 ], [ 31.2589454, 77.1756089 ], [ 31.2344148, 77.1475102 ], [ 31.2326307, 77.1180735 ], [ 31.2509172, 77.1073692 ], [ 31.2518092, 77.0690122 ], [ 31.3013165, 76.9887302 ], [ 31.2754478, 77.00077249999998 ], [ 31.2406589, 76.9905142 ], [ 31.2375369, 76.9985424 ], [ 31.2223725, 77.0056786 ], [ 31.2246025, 77.0297632 ], [ 31.1978418, 77.0551859 ], [ 31.1965038, 77.0632141 ], [ 31.2067621, 77.0779324 ], [ 31.1728652, 77.0948809 ], [ 31.1750952, 77.1332379 ], [ 31.1599309, 77.15821449999999 ], [ 31.1920437, 77.2050457 ], [ 31.1398603, 77.2460788 ], [ 31.1425364, 77.2701634 ], [ 31.12648, 77.2808676 ], [ 31.0912451, 77.2616892 ], [ 31.0939212, 77.2701634 ], [ 31.085447, 77.2875578 ], [ 31.0684985, 77.2772996 ], [ 31.0511041, 77.2790836 ], [ 30.9984747, 77.2996001 ], [ 30.9944606, 77.3076283 ], [ 30.9797422, 77.3031682 ], [ 31.0051649, 77.3232387 ], [ 31.0140851, 77.3491074 ], [ 31.0265734, 77.3598117 ], [ 31.0029348, 77.4021828 ], [ 30.971714, 77.4284974 ], [ 30.9494135, 77.4284974 ], [ 30.930681, 77.3972766 ], [ 30.9177467, 77.410657 ], [ 30.9057043, 77.413333 ], [ 30.891878, 77.4231453 ], [ 30.8767136, 77.4182392 ], [ 30.8669014, 77.4378637 ], [ 30.8695774, 77.4637323 ], [ 30.8454928, 77.4793427 ], [ 30.7986616, 77.4793427 ], [ 30.7875113, 77.51056349999999 ], [ 30.8004456, 77.5159157 ], [ 30.8022297, 77.5346481 ], [ 30.7973236, 77.5391083 ], [ 30.7781451, 77.5310801 ], [ 30.7808211, 77.5734511 ], [ 30.7955395, 77.6028879 ], [ 30.812934, 77.6104701 ], [ 30.8107039, 77.643921 ], [ 30.8035677, 77.646151 ], [ 30.8062438, 77.6506111 ], [ 30.7915254, 77.6715737 ], [ 30.7687788, 77.6880761 ], [ 30.7790371, 77.7045785 ], [ 30.8084739, 77.7192969 ], [ 30.8298824, 77.7442735 ], [ 30.8508449, 77.7313392 ], [ 30.8611703, 77.7426203 ], [ 30.8811737, 77.7447195 ], [ 30.8825118, 77.7545318 ], [ 30.8651173, 77.7652361 ], [ 30.8584271, 77.7893207 ], [ 30.8722535, 77.7835225 ], [ 30.893216, 77.78530659999998 ], [ 30.9128405, 77.800917 ], [ 30.9262209, 77.7911047 ], [ 30.9222068, 77.7456116 ], [ 30.9338031, 77.7465036 ], [ 30.9396012, 77.7366913 ], [ 30.9596717, 77.7344613 ], [ 30.9766202, 77.7540858 ], [ 30.9770662, 77.763898 ], [ 30.9552116, 77.802255 ], [ 30.9534276, 77.8169734 ], [ 30.9601177, 77.81875739999998 ], [ 30.9610098, 77.8044851 ], [ 30.96993, 77.7964569 ], [ 30.9989207, 77.8134053 ], [ 31.0051649, 77.8098372 ], [ 31.008287, 77.8254476 ], [ 31.0158692, 77.81875739999998 ], [ 31.0301415, 77.8214335 ], [ 31.0622544, 77.800471 ], [ 31.0609163, 77.81474329999999 ], [ 31.066828, 77.8190783 ], [ 31.0690927, 77.8207392 ], [ 31.0742967, 77.8245556 ], [ 31.0814328, 77.842842 ], [ 31.1108696, 77.8513163 ], [ 31.124696, 77.878523 ], [ 31.1545787, 77.8874432 ], [ 31.1563628, 77.9146499 ], [ 31.1786633, 77.9547909 ], [ 31.165283, 77.9695093 ], [ 31.167067, 77.9927019 ], [ 31.1550247, 78.0141104 ], [ 31.1715272, 78.0163405 ], [ 31.1853535, 78.0301668 ], [ 31.1929357, 78.0538055 ], [ 31.1907057, 78.0877023 ], [ 31.2138982, 78.1193691 ], [ 31.2161283, 78.1349795 ], [ 31.2317387, 78.1479139 ], [ 31.2317387, 78.1715525 ], [ 31.2223725, 78.1876089 ], [ 31.2259406, 78.2000972 ], [ 31.2370908, 78.2067874 ], [ 31.2348608, 78.232656 ], [ 31.2714337, 78.269229 ], [ 31.2660816, 78.2933136 ], [ 31.2883822, 78.2982197 ] ]


欢迎兄弟:)
Savy Chauhan
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.