Monday 21 October 2019

line - Selecting features with same geometry in one shapefile



@TeddyTedTed's answer is nice, however, I am looking for something more efficient.




I am working on a public transport network in one shapefile (polyline type) in QGIS 2.18.


Certain bus routes share the same paths, means that one line-part can repeat more than once. It always has the same identical geometry.


For instance, if I select a feature with 'Identify Features' I will have three outcomes in the Identify results table, see an image below.


Tranport_network_Example


I want to select all the features that share the same geometry and further process it with no deletion. I intend to sign an attribute that says if the layer overlaps.


Can you suggest the most beneficial way? Maybe a Virtual Layer?


So far I have in mind:




Answer




Duplicate the layer.


In the processing toolbox use 'Join attributes by location (summary)'.


Use the original and the duplicate layers for the input and join layers.


Select 'equals' as the geometry predicate.


Run.


The attribute table of the resulting layer will have a field in it called "YourIDField_count". Where this is greater than 1 is where you have duplicate geometries.


Now select everything in the joined layer where the count is over 1.


Use these to select by location (geom predicate = equals) from the original layer.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...