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

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

问题描述

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

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



谢谢。


$ b 编辑:无论是开源还是API

解决方案

基于openstreetmap的解决方案取决于美国OSM数据的质量。

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



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

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

23683997 and 26436348 是OSM ID - 如果你点击链接,你会看到他们确实进入/退出坡道。



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

  openmapdb =#从planet_osm_roads中选择astext(st_transform(way,4326)),其中osm_id = '23683997'; 
LINESTRING(24.8757131412186 44.8730730514894,[..]
(1 row)


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)

Thanks.

Edit: Either open source or API

解决方案

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

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 |      | 
 [..]

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天全站免登陆