Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line merging that respects line direction #773

Open
dr-jts opened this issue Sep 7, 2021 · 0 comments
Open

Line merging that respects line direction #773

dr-jts opened this issue Sep 7, 2021 · 0 comments

Comments

@dr-jts
Copy link
Contributor

dr-jts commented Sep 7, 2021

JTS provides the LineMerger class to merge contiguous LineStrings together. It treats the lines as an undirected graph, and flips the direction of lines if needed to merge them.

PostGIS-4939 requests an "directional" form of line merging which respects line direction (i.e. treats the input lines as a directed graph). Only lines which can be joined with no change in direction are merged.

This will likely use a simpler algorithm than the existing LineMerger. So it may make sense to implement as a separate class, rather than as an option to the existing class. Perhaps LineMergerDirected?

Example

  • Input: MULTILINESTRING((-29 -27,1 2),(-29 -27,-45 -33),(-45 -33,-46 -32))
  • Output
    • LineMerger: LINESTRING(1 2,-29 -27,-45 -33,-46 -32)
    • directional line merging: MULTILINESTRING((-29 -27,1 2),(-29 -27,-45 -33,-46 -32))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant