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

MultilineString support #44

Open
gabrielmsdiniz opened this issue Mar 7, 2019 · 2 comments
Open

MultilineString support #44

gabrielmsdiniz opened this issue Mar 7, 2019 · 2 comments

Comments

@gabrielmsdiniz
Copy link

I've realized that the library only has support to encode geojson feature LineString, but neither always a region is converted to a single LineString (sometimes it is a MultilineString).
It would be great if there is also a solution for these cases

@andrewharvey
Copy link
Collaborator

polyline encoding doesn't support MultiLineStrings, and the documentation for the library says it only supports encoding LineStrings from GeoJSON.

So the only thing this library could do is support MultiLineStrings in polyline.fromGeoJSON by returning an array of string encoded polylines. To ensure backwards compatibility for regular LineStrings it would just return the single string not an array of length 1.

That said if you're using fromGeoJSON you could just inspect your GeoJSON before hand and if it's a MultiLineString then pull out each LineString and iterate them through to polyline.encode.

@joshuagoran
Copy link

joshuagoran commented Mar 28, 2022

in case anyone else comes across this looking for MultiLineString or other GeoJSON type support: geojson-polyline worked as a drop-in replacement in my situation (though it also adds some streaming-related dependencies that I do not prefer).

In any case, its handling of different GeoJSON types may be useful for custom implementations.

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

3 participants