当前位置: 动力学知识库 > 问答 > 编程问答 >

api - GIS,OSM,ROUTING: How to get from point A to point B through a 'road' node?

问题描述:

So my question is in a routing application,probably using osm as base layer, how do I get a line-string that goes through the road and not directly from one point to another? Is there any software,like an API? I have seen pgRouting will it do the road? Do I need to downlaod any data?

So for example I have this situation where point A is a starting geometry point and B is the ending geometry point and the black line is the road:

If I want to use a layer with a linesting feature from Point A to B it will look like this:

(the red line is the linestring and the black one is the road.)

But what I want is the linestring to follow the road like this:

Suppose that the red like goes exactly like the black line and completely follows the road without us adding any other geometry points other than A and B!

网友答案:

To summarize the existing answers (so credits go to this guys):

What you are asking for is clasical routing trough a road network (in contrast to linear air distances between start/finish points). There is a huge amount of online APIs and also offline routers, each with different features in performance, customization, scalability, ... .

Just for playing around you might try the TrafficMining framework. For production, it's definitly worth to look for OSRM, OpenRouteService, ... that usually exist online and for self hosting.

分享给朋友:
您可能感兴趣的文章:
随机阅读: