城市地理JSON多边形数据库/库或API

5

我有一个包含经纬度的标记的MongoDB数据库,我需要另一个数据库(或其他解决方案)来包含城市或区域级别边界。如果使用Geojson多边形会更好。

我有一个名为city的字段(例如 'city' : 'New York'),但我想缩小到城市区域/社区层面,例如“Soho”。解决这个问题的想法基于谷歌新地图。如果我们输入区域或邮政编码,我们会看到该区域的红色点状多边形。

enter image description here

我看过Maxmind的数据库,但它没有每个城市的边界。

到目前为止,我最好的解决方案是使用Google Geocoding API,它返回框的边界:

例如: http://maps.googleapis.com/maps/api/geocode/json?address=soho&sensor=false

结果如下:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "SoHo",
               "short_name" : "SoHo",
               "types" : [ "neighborhood", "political" ]
            },
            {
               "long_name" : "Manhattan",
               "short_name" : "Manhattan",
               "types" : [ "sublocality", "political" ]
            },
            {
               "long_name" : "New York",
               "short_name" : "New York",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "New York",
               "short_name" : "New York",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "New York",
               "short_name" : "NY",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "SoHo, New York, NY, USA",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 40.7283442,
                  "lng" : -73.9953929
               },
               "southwest" : {
                  "lat" : 40.7184446,
                  "lng" : -74.0054619
               }
            },
            "location" : {
               "lat" : 40.723384,
               "lng" : -74.001704
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 40.7283442,
                  "lng" : -73.9953929
               },
               "southwest" : {
                  "lat" : 40.7184446,
                  "lng" : -74.0054619
               }
            }
         },
         "types" : [ "neighborhood", "political" ]
      }
   ],
   "status" : "OK"
}

有没有比使用Google的地理编码API边界框更好的方法?

你找到解决方案了吗?我正在寻找这些信息的来源。如果谷歌API有的话,那将非常有帮助。 - Huw Davies
2个回答

6
这篇回答提供了一个关于多边形城市边界的链接,数据来自TIGER(仅限美国):https://dev59.com/pUXRa4cB1Zd3GeqPv_b9#10821465。格式为shapefile,但你可以使用ogr2ogr轻松将其转换为GeoJSON格式。

2
已点赞,但我需要一个全球解决方案,而不仅仅是美国。 - Diolor
2
GADM 是一个全球行政边界数据集(提供 shapefile 格式等),应该 包括城市边界。否则,我还发现了这个(相当复杂的)尝试通过他们的 Overpass API 从 OSM 中提取城市边界的项目:https://github.com/pgkelley4/city-boundaries-google-maps - user3146587

6

Mapzen将于2018年2月1日关闭其服务,并且此文件托管在他们的S3帐户上,这意味着将来也可能停止提供此下载。最好尽早抓取:) - snrlx
3
此服务已关闭。有人有此巨型文件的镜像吗? - SJ Bey
2
有人在某个地方有这个文件的副本吗? - Brian Voelker

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接