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_segment() doesn't return all segments of MultiLineString #86

Closed
kapitan-iglu opened this issue Mar 5, 2021 · 0 comments
Closed

Comments

@kapitan-iglu
Copy link
Contributor

I just discovered weird behavior of line_segment() when used with MultiLineString:

from turfpy.misc import line_segment
from json import dumps

mls = {
  "type": "Feature",
    "properties": {},
    "geometry": {
        "type": "MultiLineString",
        "coordinates": [
            [
                [51,47],
                [51,43]
            ],
            [
                [45,47],
                [45,43]
            ]
        ]
    }
}

print(dumps(line_segment(mls), indent=4))

result contains only first segment:

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "LineString",
                "coordinates": [
                    [51,43],
                    [51,47]
                ]
            },
            "properties": {},
            "bbox": [51,43,51,47],
            "id": 0
        }
    ]
}

If I add return True on line misc.py:157 to let iterate over all features (instead of stopping after first feature), line_segment() returns correct result...

Is it bug or feature?

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

No branches or pull requests

2 participants