Menu

#229 Implement an Erase tool

closed-implemented
None
5
2015-12-29
2015-11-18
No

The erase tool should remove those parts of geometries from the first layer which are overlapped by the features of the second layer. Similar tool exists in ArcGIS with the same name.

The OpenJUMP tool Overlay is doing the opposite thing: it creates a new layer from the intersections of the two input layer. The Erase tool should discard the intersections.

A manual workfrow for erasing with existing OpenJUMP tools is as follows:
1) Take input layers 1 (to be edited) and 2 (the eraser layer)
2) Combine layer so it is possible to do
3) Use noder with options Split lines + Split polygons, call new layer as 3 (splitted)
4) Make a small buffer for layer 2 (eraser) and call it 4 (buffer-eraser)
5) Select features from layer 3 (splitted) which are covered by layer 4 (buffer-eraser)
6) Delete selected features. What remains is the result

Notice step 4 which has proofed to be necessary. Otherwise all the splitted parts which should get selected by "is covered by" do not get selected probably because of computational accuracy of the vertices which are created by the noder.

2 Attachments

Discussion

  • michael michaud

    michael michaud - 2015-11-23

    Why not use "difference" ?

    1) Union eraser layer (so that you have only one feature in this layer)
    2) Tools > Analyze > Geometry functions > Difference A-B (or the opposite)

    Main constraint is that the mask must contain a single feature which is not a GeometryCollection,
    but you probably don't want to substract lines or points.

     
  • Jukka Rahkonen

    Jukka Rahkonen - 2015-11-24

    I thought first that Difference A-B is the right tool and I just had not found it. I made a simple test with small layer and it is indeed doing the right thing

    Fortunately I found also my original data and test revealed that the Difference tool is unusable for that use case.

    Source data:
    1) Line layer with 38883 features (water flow indicators)
    2) Polygon layer with 56667 polygons (lakes)

    The goal is to remove those parts of water flow lines which go through the lakes. The problem with using the Difference tool is that the lake layer is a monster when unioned into one single feature:

    56667 parts
    72809 holes
    22.155.539 vertices

    I started computing the difference and followed the process for a while. There were 38883 features to process on the line layer and processing one feature seemed to take about 2 minutes. The estimated time for processing the whole layer is then 54 days. I cancelled the process.

    From my notes I found that I had to split the line layer to smaller layers with about 10000 features for the "Node-Split-Select covered by-Delete" workflow but at least I could do the whole job within one day.

     

    Last edit: Jukka Rahkonen 2015-11-24
  • michael michaud

    michael michaud - 2015-12-05

    Can you check r4567, I added an eraser plugin.

     
  • Jukka Rahkonen

    Jukka Rahkonen - 2015-12-07

    I made a test with those 38883 linestrings and 56667 polygons. It took some time to run the process, perhaps couple of hours, but it went through withour errors and the result looks good. If you consider that the plugin is complete I am ready to accept feature request as very well implemented.

     
  • michael michaud

    michael michaud - 2015-12-29
    • status: open --> closed-implemented
    • assigned_to: michael michaud
     

Log in to post a comment.