Use polygon as search area overpass api / overpass turbo

老子叫甜甜 提交于 2021-01-28 17:47:34

问题


I'm fairly new at using overpass API, I finally managed to generate a query to retrieve all nodes within an area by using overpass-turbo wizard.

Using highway=* in "Paulino Navarro" in the wizard generates me the following query.

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“highway=* in "Paulino Navarro"”
*/
[out:json][timeout:25];
// fetch area “Paulino Navarro” to search in
{{geocodeArea:Paulino Navarro}}->.searchArea;
// gather results
(
  // query part for: “highway=*”
  node["highway"](area.searchArea);
  way["highway"](area.searchArea);
  relation["highway"](area.searchArea);
);
// print results
out body;
>;
out skel qt;

However, how could I use a polygon as a search area? maybe something like highway=* in poly([lat,lon],[lat,lon],...,[lat,lon]) or how can I do that on the query itself.

I don't quite understand the documentation in overpass wiki nor overpass-turbo wizard.


回答1:


The polygon filter is explained in the Overpass QL documentation.

Example:

[out:xml][timeout:30];
way[highway=primary](poly:"50.7 7.1 50.7 7.2 50.75 7.15");
(._;>;);
out;


来源:https://stackoverflow.com/questions/60749066/use-polygon-as-search-area-overpass-api-overpass-turbo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!