Full geometry ahead!

Posted by tyr_asd on 24 October 2014 in English (English)

This summer brought us some nice new features to the Overpass API universe, that are now finally available in overpass-turbo (and osmtogeojson). Here are some of the highlights:

geometry options

The Overpass API now has three new geometry types, which give you even more flexibility in your queries:

  • out center; – this additionally prints the center coordinate for every OSM object
  • out bb; – this additionally prints the bounding box coordinates for every OSM object
  • out geom; – this additionally prints the full coordinates of every OSM object

The first two options are particularly usefull if one is only interested in the approximate location of some features, rather than their exact outline. For example, one finds that POIs are often mapped on building outlines. By requesting only the center coordinates (out center;), one saves transfer bandwidth and gets an overall quicker query.

Here is an example how this looks like (note that out of the 7 displayed POIs, 6 are mapped on ways in OSM): (try it on overpass turbo)

The full geometry (out geom;) option replaces the need to use object recursions to get the geometry for a certain OSM way or relation. This also saves bandwith and generally comes with faster query execution times. (In this example it saves almost 50% of the data.)

With osmtogeojson version 2.2.0, all this is also available on your command line or to be used as a javascript-library in your projects!

regular expressions for keys

I know that lots of people requested this feature, and now you can finally use regular expression on keys, for example to get all nodes with some kind of name-tag:

node[~"(^|_)name($|_|:)"~".*"]({{bbox}}); out;

Here, the additional tilde in front of the key indicates that the regex-search should be extended to the key as well.

This is also accessible via overpass turbo’s query wizard. Try this for example: building=* and ~"addr:.*"~".*"

Overpass QL is now the default

Queries generated by the wizard, a template and the query examples are now printed in Overpass QL. Overpass QL has a more concise syntax, is faster to write and more and more documentation and help is available for it. (Of course anyone can still continue to write, use and execute queries in the older XML syntax.)

Comment from gileri on 24 October 2014 at 21:39

Thank you for this new iteration of Overpass API, looking forward to experiment with out geom

Login to leave a comment