[OSM-talk] Overpass area query gives results outside area...

Jean-Marc Liotier jm at liotier.org
Wed Nov 6 11:39:34 UTC 2013


I need to extract objects that fall within the bounds of Senegal - so I 
turned to the Overpass API... But it seems that my level of 
understanding does not yet match its power. I need your help !

As an exercise, let's find Dakar in Senegal - 
http://overpass-turbo.eu/s/1qa :

     area[name="Senegal"];
     (area
         [name="Dakar"]
         (area);
          <;
     );
     out;

I do get the city of Dakar, but also a restaurant in Spain and an 
apartment building in Seattle... So the area criteria seems inoperative 
- this query is equivalent to querying with no area criteria, like 
http://overpass-turbo.eu/s/1qb :

     area [name="Dakar"];
     out;

Maybe selecting the area by name is too sloppy... Let's try selecting it 
by id - the relation for Senegal's boundaries is 
http://www.openstreetmap.org/browse/relation/192775 and the query should 
therefore be http://overpass-turbo.eu/s/1qd :

     area[name=Dakar](area:192775);
     out;

Same result, but I am not certain that the area criteria can take a 
relation id as its argument.

Well... Maybe area selection is inoperative. Let's try with a good old 
bounding box - http://overpass-turbo.eu/s/1qe :

     (
       area
             ["name"="Dakar"]
             (12.167,-17.7862419,16.6919959,-11.3458996)
     );
     out;

Same result.

What am I doing wrong ? Is the syntax incorrect in every one of my queries ?

As a fallback I could get the country extract and dig into it with xpath 
queries - but there is currently no regularly produced Senegal extract 
and I'm not yet ready to do that myself...




More information about the talk mailing list