2

Well this could be an interesting one. I've got two shapefiles of polylines (contours). I need them to be one nice and clean shapefile covering the same area.

Only issue is, the shapefiles overlap and cover different areas. As below:

Shape 1

Shape 2

Both together become the shape we're after, but of course there's the bit in the middle which gets very pesky.

The tools at my disposal are QGIS, Manifold 8, and SQL Server (and PostgreSQL). I've combined the layers using QGIS and then used MMQGIS to remove duplicate geometry, but this doesn't quite work either as one line which is present in both shapes, for instance, will continue northwards of shape 1, and southwards of shape 2, meaning it is not the same in either. I would need a way to recognise which lines touch (as no line should touch each other in the finished article) and combine their geometry.

I did also start dissolving the merged shapefile QGIS, but that was taking a very long time. Don't know if that's the way forward - maybe I should try it on a smaller sample. I don't know whether that exists in Manifold, which seems a lot faster at things but restrictive.

  • I have discovered a way. If I create a rough scratch layer that divides the areas up, I can run a difference (intersection and clip don't want to work due to invalid geometry). This will give me a piece that doesn't overlap, and I can combine them. It will still result in two lines of the same value next to each other, but that doesn't matter as they won't overlap. – user25730 Aug 23 '18 at 4:42
  • Just tried using a difference on the two layers to create a "piece" which could be tacked onto one of them (took over 2 hours to do) and that's unusable - there are a handful of areas where the contours are seemingly minutely different, resulting in a few stray pieces. Looks like the most trustworthy and quickest answer is to produce a scratch layer and difference to that. Unless anyone knows how to produce an "outline" polygon from a whole load of polylines so I can diff from that. – user25730 Aug 23 '18 at 6:47
1

Another alternative would be to convert your lines into points and then rebuild your contours based on your points. You could remove overlapping points if necessary but I don't think that's essential.

To do this use Points Along Geometry in the Processing Toolbox in QGIS. And then you can use the Countour plugin to rebuild your contours based on your points.

To remove overlapping points you can use the MMQGIS plugin. In the plugin go to Modify / Delete Duplicate Geometries.

0

I would use QGIS to rasterize your contours (raster>conversion>rasterize) and extract the contours from the raster (raster>extraction>contour). Hope that helps.

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.