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

Complex shared paths with backward and forward parts with non-existing junctions #64

Merged
merged 4 commits into from
Dec 1, 2019

Conversation

mattijn
Copy link
Owner

@mattijn mattijn commented Dec 1, 2019

This PR fix #63.
The issue was twofold:

  • Firstly, shared paths containing both forward and backward elements, where the forward or backward elements are non-contiguous could not be directly loaded as MultiLineString (this: MultiLineString([LineString, MultiLineString]) doesn't work in shapely)
  • Secondly, in the case a LineString has partially shared paths with non-existing junctions. Then these are inserted before splitting. These non-existing junctions are rightly detected, but were not sorted in the right order before insertion. Leading to problems in the Dedup phase. Fixed in Cut phase.

Last, the .to_svg() function was improved so one can use .to_svg(separate=True, include_junctions=True) during debugging.

Like:

from topojson.core.cut import Cut
data = [
    {"type": "LineString", "coordinates": [(0, 0), (10, 0), (10, 5), (20, 5)]},
    {
        "type": "LineString",
        "coordinates": [
            (5, 0),
            (25, 0),
            (25, 5),
            (16, 5),
            (16, 10),
            (14, 10),
            (14, 5),
            (0, 5),
        ],
    },
]
c = Cut(data)
c.to_svg(separate=True, include_junctions=True)

image

@mattijn mattijn merged commit cdc059b into master Dec 1, 2019
@mattijn mattijn deleted the multilinestring-fix branch December 1, 2019 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MultiLineString cannot be created from a LineString + MultiLineString
1 participant