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, that’s 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: Menu -> Vector -> Geometry Tools -> Polygons to Lines
Now we have the external boundary of the district.
-
Processing Toolbox -> Split with lines ::
input layer: external boundary, split layer: innerlines
-
We can verify that the single outer boundary line of the district has been split up into chunks along where inner boundaries meet it, by selecting features along it. Instead of the entire line, only a few chunks get selected.
-
Now let’s merge the inner boundaries and the split-up outer boundary layers.
Menu -> Vector -> Data Management Tools -> Merge vector layers
-
choose the split-up external boundary, and the innerlines layer in input field
-
Set the merged output to save as file, save as a geojson. Make sure you change Destination CRS to EPSG:4326
-
Now you have a .geojson file having all boundaries in neat segments that you can add directly as Way in JOSM