Steps to convert boundaries shapefiles into usable common ways for adding to Openstreetmap
Posted by Answerquest on 15 September 2023 in English (English). Last updated on 20 September 2023.Assumptions: - You’re working with a district shapefile having village polygons, and you want to add the village boundaries to OSM. (Find+replace the terms as appropriate for your use case) - Instead of separate polygons, you want each shared boundary between say 2 villages to be loaded on JOSM as a LINE shape, so that you can add it as a Way and then include it in the respective Relations of each village - So this process will help you convert those polygons into these common boundary lines
- Load shapefile zip (having .shp etc) on mapshaper.org
- console -> type “innerlines”, press enter. Shape changes to just the inner common boundaries
-
export, choose shapefile format (not geojson, its useless). rename it to “innerlines”
-
open QGIS, load both the original shapefile and this innerlines shapefile there
- original shapefile : Dissolve (vector -> geoprocessing tools -> dissolve)
- On the dissolved layer: Processing Toolbox -> Polygons to Lines
-
now you have the external boundary of the district.
- Processing Toolbox -> Split with lines :: input layer: external boundary, split layer: innerlines
-
Now we have a new layer “split” having the external boundary also cut up wherever internal boundary line hits
- Processing Toolbox -> Merge vector layer :: choose the split-up external boundary, and the innerlines layer in input field
- Change Destination CRS to EPSG:4326
- Set the merged output to save as file, save as a geojson
- Now you have a .geojson file having all boundaries in neat segments that you can add directly as Way in JOSM