I have a polygon shapefile and a line shapefile. I would like to merge two polygons which shares the same border along with line shape. Finally the line should be removed in polygon shapefile.

In below sample, A&B polygons should be merged and C&D, E&F, G&H so on...

Polygon and Line shapefiles

If any easy solution available other than PostGIS, then please provide your views.

  • Are there no attributes in common between C/D or A/B? Aug 22 '14 at 16:47

Rather than thinking about merging A/B and trying to avoid merging A/E, merge them all together into a single lake polygon (I'm hoping here your data model does at least include a unique code for the lakes) with ST_Union. Then, use ST_DumpRings() to get just the rings. Then add the skeleton lines for just that lake to the collection. Then use ST_Polygonize() to build up the polygons formed by the lake boundaries and skeleton lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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