开发者

Open Street Map - streets by city

开发者 https://www.devze.com 2023-03-12 04:16 出处:网络
I am working on a system based on data colle开发者_StackOverflow社区cting from OSM (Open Street Map).

I am working on a system based on data colle开发者_StackOverflow社区cting from OSM (Open Street Map).

When I fetch (from OSM database) an area that covers MANY cities, then have I got any way to figure out which street (from the vast xml list) belong to which city? Was trying to use OSM Server Side Script but didn't find my point of interest in that's manual.

Looks like I could take any (address) node that belongs to the way and parse it to get the street name and city name from it.

But the real problem is that there are some streets with no address nodes with. So it looks like I have a vast set of streets, cities, but no way how to decide which streets belongs to which cities?

I would be happy to read any answer that would be helpfull.


You can use overpass api to download the whole city. You should first find id of the relation which defines the city (you can query for it via overpass api if you do not have it in your system already). For example Vuppertal has 62478. Then add 3600000000 to the id and send and send the following POST request to http://www.overpass-api.de:

<union>
  <area-query ref="3600062478"/>
  <recurse type="node-relation" into="rels"/>
  <recurse type="node-way"/>
  <recurse type="way-relation"/>
</union>
<print mode="body"/>

You can also check where the individual points belongs of download only streets from the city using theis api, for more information see

Update: To find the city relation send the following POST request to http://overpass-api.de/api/interpreter:

   <query type="relation">
     <has-kv k="name" v="Wuppertal"/>
     <has-kv k="type" v="boundary"/>
   </query>
   <print mode="body"/>

if you want to be more restrictive you may add more filters like de:place=city if you are only looking at Germanz or admin_level= something etc. If you want to get more results, you can only use the name:

   <query type="relation">
     <has-kv k="name" v="Wuppertal"/>
   </query>
   <print mode="body"/>

it is up to you, what do you consider "a city".

0

精彩评论

暂无评论...
验证码 换一张
取 消