开发者

How to Get Lattitude and Longitude of US Interstate Exits programmatically?

Is there a way to do that using open source map / API (Google Map API, Micros开发者_如何学运维oft 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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜