Simplify shapefile by joining LineString segments with Python3

412 Views Asked by At

I have a project that compares shapefiles with JSON files containing geographical data retrieved from OpenStreetMap via Overpass API.

The problem is that comparing data takes a long time when I get a lot of objects, and for some of the cities I have 7000 OSM objects to compare with 16000 shapefile objects. I have noticed that the LineString objects in the shapefile are very segmented, and would like to join LineString segments with the same field-attributes into LineStrings, without having them transformed into MultiLineStrings. That way I can speed up the execution of the script.

The script currently imports GDAL ogr and Shapely modules, but can import other modules, like Fiona if that is better.

0

There are 0 best solutions below