[OSM-dev] Overpass API: Getting nodes together with centroids of areas ("POI query")?
Martin Raifer
tyr.asd at gmail.com
Sat Oct 18 15:21:14 UTC 2014
Yes. Just replace the first print statement (`<print mode="body"/>`)
with `<print mode="body" geometry="center"/>` and drop the following
two lines (recurse and second print). This will give you the
coordinates for all nodes and an approximate* centroid for all ways
and relations in the result set. Example:
http://overpass-turbo.eu/s/5w2
* Because of performance reasons, this "center" coordinate is not an
exact centroid, but simply the middle of the bounding box around the
object.
Martin
On Sat, Oct 18, 2014 at 3:54 PM, Stefan Keller <sfkeller at gmail.com> wrote:
> Hi,
>
> A typical query gives all 1. nodes, 2. ways and 3. areas with
> "tourism=zoo” (see below).
>
> But I'd like to get back only point geometries which consist of 1.
> nodes together with (union) 2. centroids calculated on the fly from
> areas. I coined this a "POI query".
>
> Possible?
>
> Yours, S.
>
>
> <!--
> This has been generated by the overpass-turbo wizard.
> Get all nodes, ways and areas with "tourism=zoo”
> -->
> <osm-script output="json" timeout="25">
> <!-- gather results -->
> <union>
> <!-- query part for: “tourism=zoo” -->
> <query type="node">
> <has-kv k="tourism" v="zoo"/>
> <bbox-query {{bbox}}/>
> </query>
> <query type="way">
> <has-kv k="tourism" v="zoo"/>
> <bbox-query {{bbox}}/>
> </query>
> <query type="relation">
> <has-kv k="tourism" v="zoo"/>
> <bbox-query {{bbox}}/>
> </query>
> </union>
> <!-- print results -->
> <print mode="body"/>
> <recurse type="down"/>
> <print mode="skeleton" order="quadtile"/>
> </osm-script>
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev
More information about the dev
mailing list