2

I am working with 2 shapefiles: points from one datasource and another. Some of the features are duplicates. However, since data quality in the second datasource is not as good as in the first one, duplicate points are slightly offset. The offset depends on the particular point, so it varies from 3 to 20 meters.

1st datasource, let's call it "GOOD" has more points than another. The 2nd datasource, "BAD", contains much less. It means that if I have building with 3 points from "GOOD" dataset and 1 point from "BAD", when the "BAD" point is located between 3 and 20 meters to any of the 3 GOOD points, it is called duplicate. The example is below.

Example

The naive algorithm I suppose:

  1. For each BAD point find the closest GOOD point.
  2. If the associated GOOD point is between 3 and 20 meters and doesn't associated with another BAD point, then remove BAD point and leave only GOOD one in the merged shapefile.
  3. If there are several BAD points associated with the GOOD one, than remove the closest BAD point and find another GOOD point for the left BAD points. Repeat 2).
  4. If GOOD point isn't associated with any left BAD points in distance between 3 and 20 meters after 2) and 3), than leave GOOD point in the merged shapefile.
  5. If BAD point isn't associated with any left GOOD points in distance between 3 and 20 meters after 2) and 3), than leave BAD point in the merged shapefile.

Talking about the example, I want to get merged shapefile with 2 points in the bottom building (1 GOOD point and 1 *GOOD& point associated with BAD one) and 2 points in the top building (2 GOOD points associated with 2 BAD points). Left 2 GOOD points are alone so I leave them in the merged shapefile.

UPD: I don't have any point attributes except geometry.

1 Answer 1

0

I think the tools you can use are: Distance to nearest hub (points), Buffer and Select by Location.

Use distance to hub with BAD points as source and the GOOD points as destination. It will create a new point file with a distance attribute for each point. Delete all points that are not in the 3-20 meters range. Now create buffers based on the new distance field (and add 0.1m to be sure). You can use these buffers to select points that are within the 20 meter treshold. I guess multiple repeats are needed to end up with the final file. It will take some trial and error to find the necessary steps.

2
  • Thanks for your answer! Your solution has important limitations: if there're several points in the buffer, all of them will be cut, not the only one as it should be. Seemingly, it'd be better to perform some kind of Nearest Neighbor Analysis with Distance Matrix or so on, but perform it only for unique pairs. Like this. I need to find the closest feature for each point within 3-20 range. Only 1 by 1 pairs with mutual distance not more than 20 meters
    – sailestim
    May 20, 2020 at 21:03
  • The distance to hub will find the nearest point. So it will not have overlap with multiple points. It is also used in the QGIS tutorial example. Using QGIS might involve a lot of clicking. If you can code you could iterare over each single point. That will make sure only unqiue pairs are found. May 26, 2020 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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