3

i have buildings data from osm and ward boundaries. i need to find which building lies in which ward and add that information in the building data. I prefer use osm output format.

INPUT:

  <way id='242474181' action='modify' timestamp='2013-10-17T11:42:37Z' uid='1700096' user='GautamPratik' visible='true' version='1' changeset='18401787'>
    <nd ref='2499343546' />
    <nd ref='2499343543' />
    <nd ref='2499343539' />
    <nd ref='2499343541' />
    <tag k='building' v='yes' />
  </way>

OUTPUT:

  <way id='242474181' action='modify' timestamp='2013-10-17T11:42:37Z' uid='1700096' user='GautamPratik' visible='true' version='1' changeset='18401787'>
    <nd ref='2499343546' />
    <nd ref='2499343543' />
    <nd ref='2499343539' />
    <nd ref='2499343541' />
    <tag k='building' v='yes' />
    <tag k='district' v='kathmandu' />
    <tag k='vdc' v='kathmandu metropolitan city' />
    <tag k='ward' v='4' />
  </way>
1
  • 1
    What GIS Software - recommend QGIS to do this locally on your pc. You need to download the osm first.
    – Mapperz
    Oct 21, 2013 at 13:31

2 Answers 2

2

So what you actually need is a GIS tool that supports a is_in operator to perform the geospatial testing for a polygone.

This can be done using QGIS, but if the data amount is big and as you prefer OSM output, I like to suggest to perform your task with osmosis:

  1. Create osmosis poly files from your ward boundaries
  2. Prefilter your OSM file just for buildings using osmosis
  3. Split your OSM file according to the boundary poly files:
    http://wiki.openstreetmap.org/wiki/Osmosis/Examples#Breaking_OSM_file_into_several_bounding_boxes

Please have a look at your resulting files and how osmosis deals with building that touches multiple boundaries (afaik creates duplicates). Also keep in mind that some buildings might consist of multipolygones or are enriched with 3D elements that need to be checked to be accurate.

0

The best tool is to use JOSM.

  1. Load the buildings and Ward boundary in JOSM
  2. Select a ward and note its ward no.
  3. Select all building inside the ward (there is tool to select features within selected region).
  4. Add the tag for ward no in all the selected buildings.
  5. Save the new file
  6. Repeat for all wards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.