如何以编程方式获取美国州际出口的纬度和经度? [英] How to Get Lattitude and Longitude of US Interstate Exits programmatically?

查看:28
本文介绍了如何以编程方式获取美国州际出口的纬度和经度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用开源地图/API(Google Map API、Microsoft Live Map API)来做到这一点?

Is there a way to do that using open source map / API (Google Map API, Microsoft Live Map API)?

或者有没有办法从地图文件中穿越道路和路口?(如果我购买商业地图数据)

Or is there a way to traverse roads and junction from map files? (if I purchase commericial map data)

谢谢.

开源或 API

推荐答案

根据美国OSM数据质量,基于openstreetmap的可能解决方案.

A possible solution based on openstreetmap depending on the quality of OSM data in the US.

如此处所述出口匝道/滑道应标记为highway=motorway_link 或highway=primary_link" 如果您导入美国的地图数据(使用 osm2pgsql),则可以选择所有高速公路链接.

As described here "Exit ramps/slip roads should be tagged as highway=motorway_link or highway=primary_link" if you import the map data for the US (using osm2pgsql) you can then select all motorway links.

例如(根据我自己的数据选择,即在美国以外的地方)

E.g. (selects based on my own data, i.e. very much outside US)

openmapdb=# select osm_id, name, ref from planet_osm_roads where highway='motorway_link';
  osm_id  | name | ref 
----------+------+-----
 23683997 |      | 
 26436348 |      | 
 [..]

2368399726436348 是 OSM id - 如果您单击链接,您会看到它们确实是进入/退出坡道.

23683997 and 26436348 are the OSM ids - if you click on the links you'll see they are indeed entry/exit ramps.

一旦你确定了一种方式,你就可以访问纬度和对数:

Once you've identified a way, you can access the latitude and logitude:

openmapdb=# select astext(st_transform(way, 4326)) from planet_osm_roads where osm_id = '23683997';                                                                                                                                             
    LINESTRING(24.8757131412186 44.8730730514894,[..]
(1 row)

这篇关于如何以编程方式获取美国州际出口的纬度和经度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆