This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to request a limited no of features in Overpass api?

4
1

I am using Overpass api to query Building data from OpenStreetMap. the query string is like this

(way[building](bbox);node(w););out body;

This works really fine (the bounding box is specified by Openlayers).

Now i want to improve it, such that only 10 buildings are returned by the query, to speed up the process. For this i used the query

(way[building](bbox);node(w););out 10;

but doing this returns only 10 nodes like here

What i want is 10 buildings.

asked 04 Mar '13, 05:13

amritkarma's gravatar image

amritkarma
684212941
accept rate: 11%

Updated Sep 2014 due to new available features

(11 Sep '14, 13:21) mmd

2 Answers:

6

I'm sorry, this is not feasible yet. I'll add it to the list of suggested features.

answered 04 Mar '13, 07:07

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

3

In the meantime this is now possible by using the new geometry feature:

way({{bbox}})[building];
out geom meta 10;

It will display exactly 10 buildings.

Note that there's a small rendering issue in overpass turbo at this time, as only the boundary box is shown. However, as the geometry feature is rather new, I'm sure the rendering will be ok pretty soon. This has no impact on the query itself, though.

Try on Overpass Turbo: http://overpass-turbo.eu/s/50g

answered 11 Sep '14, 13:20

mmd's gravatar image

mmd
5.7k15388
accept rate: 37%

edited 11 Sep '14, 13:30

Source code available on GitHub .