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

Get polygon shapefile/KML for a node/location in openstreetmap

1

I have about 1000 nodes/locations of interest from openstreetmap. I queried overpassturbo API to get coordinates of those 1000 locations/nodes. What I am interested in is, getting a polygon based KML/shapefile for each of those 1000 locations. So basically, let's say I go to 1 of those 1000 locations on the map, currently I just have one location pointer for that location. But I need a whole polygon drawn for the location. For example, if it's a supermarket, I need a KML file for it such that it can show me a polygon drawn over the entire supermarket and not just a location pointer.

Is it possible to get that from overpassturbo API or anywhere else? Thanks in advance.

asked 14 Sep '20, 15:51

Aashay's gravatar image

Aashay
36114
accept rate: 0%

edited 14 Sep '20, 20:34

post your current turbo routine.

(14 Sep '20, 19:47) DaveF

@DaveF

I am just simply querying for a few nodes of my interest from overpassturbo-api. And I get all the location pointers for my places of interest. But what I need is, a polygon of the entire place drawn for each of those location pointers. Here's a sample query im using:

[out:json][timeout:25]; ( node["building"="<xyz>"]; ); out body;

(14 Sep '20, 20:32) Aashay

If you want ways, why are you querying nodes?

(14 Sep '20, 21:46) InsertUser

Actually, I need nodes only. Basically all I need is, let's say I have a location pointer pointing to a supermarket - I need a kml or a shape file where in there is a polygon drawn over the edges of the supermarket. Or else even an array of coordinates that run along the boundaries of the supermarket is fine. I am not sure if that is even possible with overpassturbo-api. Is there any way in which I can get this? or any alternative way to get this?

(14 Sep '20, 21:53) Aashay

2 Answers:

0

Objects in OSM can be mapped as dots, as areas or as multipolygons. It's a matter of mapping preference, object complexity, available time and other factors how a mapper does it.

With your query you are only retrieving those buildings that have only been mapped as a single node without outline. To get all buildings you need to also query for ways and relations. As a start you can change node["building"="xyz"] to nwr["building"="xyz"].

Modify your query and if you need more help please post the new query with specific questions.

answered 15 Sep '20, 10:12

TZorn's gravatar image

TZorn
12.3k764225
accept rate: 15%

0
[bbox:{{bbox}}];
wr[building=school];
out geom;

Save as KML under Export option in Turbo

[bbox:{{bbox}}]; is required to limit returned data to the size of your window otherwise you'll download worldwide.

answered 15 Sep '20, 23:53

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

edited 16 Sep '20, 01:17

Source code available on GitHub .