Search code examples
overpass-api

Finding geometry of an area with overpass API


I am trying to find the geometry of a building from a particular latitude longitude. So my idea was to use a coord-query to get all areas in which the lat,lng. Using http://overpass.osm.rambler.ru/cgi/interpreter, I get all the areas and I can filter to get only the nodes that are buildings.

Now I have an area, for example:

{ id: '2542062474',
    'addr:city': 'Nice',
    amenity: 'place_of_worship',
    building: 'yes',
    denomination: 'protestant',
    name: 'Église Protestante Unie de Nice Saint-Esprit',
    religion: 'christian',
    source: 'cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre. Mise à jour : 2011' }

I thought it would be easy to get the geometry of this area but I can't find any way of doing that ? I must be missing something.

In http://overpass-turbo.eu, I enter the script:

[out:json][timeout:25];
// gather results
(
  // query part for: “area”
  area(2542062474);
);
// print results
out body;
>;
out skel qt;

but the result does not include the geometry. How do I get the geometry of an area ?

Thanks !

Here is my script, for the moment: https://gist.github.com/ptbrowne/60d7338502de1d16ac46


Solution

  • Areas are an internal data type of Overpass. You can use pivot to get the geometry:

    [out:json][timeout:25];
    area(2542062474);
    way(pivot);
    out body;
    >;
    out skel qt;