我正在尝试构建一个android应用程序,可以通过纬度和经度坐标确定用户所在的高速公路类型。有没有办法查询天桥turbo来检索高速公路的类型或分类?(无论是高速公路、主干道、一级公路、二级公路、三级公路还是住宅公路)我找不到任何相关的教程或文档来这样做。我是否可以在Java类方法中实现查询,如下所述:
LocationManager lm(LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
@Override public void onLocationChanged(Location location)
{
double longitude = location.getLongitude();
double latitude = location.getLatitude();
/*query overpass turbo to classify highway*/
/*store retrieved classification type as a string*/
}
而不是在给定坐标周围获取标记为高速公路的所有道路,是否可以识别当前位置以确定道路是否为哪种类型的高速公路?
发布于 2019-09-20 17:06:57
您需要查找具有highway tag的ways。您可以使用以下天桥API查询来定位51.033,13.749 (经度,经度) 100米范围内标记为高速公路的所有道路:
[out:xml][timeout:25];
way(around:100,51.033,13.749)[highway];
out body;
>;
out skel qt;
您可以看到result on overpass turbo或download the results directly via Overpass API。
您可以使用最后一个链接从应用程序中构建一个简单的HTTP请求。请注意,Overpass API支持不同的输出格式,如XML和JSON,具体取决于您的查询。
https://stackoverflow.com/questions/58022864
复制相似问题