spacesyntax / CatchmentAnalyser

Calculate catchments from multiple origins using multiple costs.
GNU General Public License v3.0
0 stars 1 forks source link

duplicate geometries #6

Closed gregmaya closed 7 years ago

gregmaya commented 7 years ago

When running a catchment analysis from multiple points the network outcome brings up duplicate features. For visualization purposes this is not a big issue but I thought you might be interested to know.

All the best ! G.

laurensversluis commented 7 years ago

Do you mean the segment output or the polygon output? Are you using the latest version?

gregmaya commented 7 years ago

Hi Laurens !

I meant that there are duplicate lines in the segment output when you generate catchments from multiple origins (obviously when they overlap)

For that I’ve been using the following script that run super quick and does a pretty good job:

WITH unique_geom (dup_id, id, geom) as

(SELECT row_number() OVER (PARTITION BY geom) as dup_id , id, geom FROM "####".xxxxxx)

DELETE FROM "####".xxxxxx

WHERE id IN (SELECT id FROM unique_geom WHERE dup_id > 1);

And yes I’m using the latest version!

Hope it helps,

G

From: Laurens Versluis [mailto:notifications@github.com] Sent: 10 January 2017 15:38 To: OpenDigitalWorks/CatchmentAnalyser Cc: gregmaya; Author Subject: Re: [OpenDigitalWorks/CatchmentAnalyser] duplicate geometries (#6)

Do you mean the segment output or the polygon output? Are you using the latest version?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OpenDigitalWorks/CatchmentAnalyser/issues/6#issuecomment-271607957 , or mute the thread https://github.com/notifications/unsubscribe-auth/AXyTftlI6GaUfIZz6KblI7T2he7EHBFEks5rQ6W6gaJpZM4Lb5GO . https://github.com/notifications/beacon/AXyTflRN2yLR4xTeGGwu7f0uPAOzOByBks5rQ6W6gaJpZM4Lb5GO.gif

jorgegil commented 7 years ago

This happens with all origins, also with non overlapping catchments. It creates 2 duplicates, and not more than that as would be expected if the problem was related to overlaps.

jorgegil commented 7 years ago

The current algorithm to create the catchment network constructs it from end points (nodes in the graph). I suspect every line gets duplicated because this is an undirected network and every arc can be approached from either end and appears twice in the search tree.

We have to revise carefully the whole network analysis algorithm to be able to fix this.

jorgegil commented 7 years ago

Done a simple fix. When constructing the network the algorithm stores the start and end point id, BUT always stores the lowest id number first. This way, because it is undirected, duplicate arcs will have an identical pair of start and end ids, even if the geometry is reversed. Then we can check for these duplicates, instead of trying to match geometries and lengths (can be error prone).