Getting city boundaries from openstreetmap

I am developing a website, and I need to get all the boundaries of the area defined depending on user input. For example, a user wants to know the boundaries of a city named x. How do I get it from openstreetmap? I heard about xapi and osmosis, but could not find anywhere else examples. Thank!

+5
source share
1 answer

I hit using JavaScript here: https://github.com/pgkelley4/city-boundaries-google-maps

It basically boils down to finding a relation that OpenStreetMap preserves the city boundaries like.

To get the scope, I used the following query:

area[name="Seattle"]["is_in:state_code"="WA"];foreach(out;);

Or if it doesn't find anything, go through node to find any related areas:

node[name="New York"][is_in~"NY"];foreach(out;is_in;out;);

, 3600000000 , . :

(relation(" + relationID + ");>;);out;

, , : http://overpass-api.de/query_form.html

, , - , . . GitHub : http://wiki.openstreetmap.org/wiki/Relation:multipolygon/Algorithm

, OpenStreetMap . - , , , -.

+2

All Articles