[英]How to download buildings data from OSM with a polygon (shapefile) as the bounding box?
[英]OSM - Find all optional routes in specific bounding-box
我的目标是获取特定区域中所有可选路线的列表。 我想使用OSM来实现此数据。路线意味着可以从第一个交叉点到第二个交叉点进行驾驶的一对或交叉点。
到目前为止,我已经在overpass-turbo网站中尝试了以下代码:
[bbox:{{bbox}}];
way[highway~"^(residential)$"]->.minor;
node(w.minor)(w.minor);
out;
输出是相交,但是:
如果您习惯使用Java,请考虑看看Atlas。 Atlas是OSM数据的内存表示形式,它使您可以创建表示街道网络的图形。 有一个用于连接,路由和空间搜索的Atlas API层。 对于您的特定需求- 路由的概念-维护OSM路径和节点,指定两个节点或路径之间的路径。 有一些方法可以获取最佳路线或获取所有可能的路线。
首先,我建议您执行以下操作:
加载OSM文件的示例代码:
public class TestAtlasTestRule extends CoreTestRule
{
@TestAtlas(loadFromJosmOsmResource = "yourOsmFile.osm")
private Atlas yourAtlasFile;
public Atlas getAtlasFile()
{
return this.yourAtlasFile;
}
}
获取路线的示例代码:
// To get the shortest route
final Route shortestRoute = AStarRouter.dijkstra(yourAtlasFile, distanceThreshold).route(startNode, endNode);
// To get all the routes
final Set<Route> allRoutes = AllPathsRouter.allRoutes(startEdge, endEdge, comparatorThatEnforcesRouteOrdering);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.