Along doesn't work with MultiLineString
See original GitHub issuePlease provide the following when reporting an issue:
- GeoJSON data as a gist file or geojson.io (filename extension must be
.geojson
). - Snippet of source code or for complex examples use jsfiddle.
Hi guys, thx for your awesome work!
I’d like to ask if you are planning to add MultiLineString
support to turf.along()
?
Currently, it doesn’t work, I’m getting error messages like:
angular.js:14961 TypeError: Cannot read property '1' of undefined
Uncaught Error: Coordinate is not a valid Point
This would be important to implement, since currently turf.along()
fails with antimeridian cases. GeoJSON standard says antimeridian geometries should be MultiLineString
type:
https://tools.ietf.org/html/rfc7946#section-3.1.9
Reproduced:
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
QGIS Difference Algorithm: multilinestring won't work with ...
I already used the 'Fix geometries' on both layers, and the buffer trick. Both don't work. Could I perhaps somehow convert multilinestrings ......
Read more >python - Multi line string with arguments. How to declare?
Using textwrap.dedent() around a multi-line string solves all of the problems of my previous answer! Here's the official documentation on it ( ...
Read more >MULTILINESTRING | CockroachDB Docs
A MultiLineString can be created from SQL by calling an aggregate function such as ST_Collect or ST_Union on a column that contains LineString...
Read more >MultiLineString - SQL Server - Microsoft Learn
The following example shows three valid MultiLineString instances and one MultiLineString instance that is not valid. SQL Copy. DECLARE @g1 ...
Read more >RFC 7946: The GeoJSON Format
GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, ... In other words, every point on a line that does not cross...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@csimpi morganherlocker said it well. The multi-parts are in an array so, yes, they have an order but not necessarily a meaningful order across users and data sets.
However, even if this feature request doesn’t make it in Turf, think of this as an opportunity. There may be a user appetite for a new library with advanced geospatial processing built on top of Turf that allows for more complex algorithms. A
turf-toolbox
if you will. There are a few packages currently in Turf that would probably qualify but they are already in.I stand corrected! I had mixed up the fact that JSON does not guarantee Object key order, but it does, in fact maintain array order as you say.
I am still skeptical of this design though, since there is nothing about MultiLineString that suggests the data has a logical order or connection between parts. We would need to carefully define how the coordinates would be traversed, and we generally avoid algorithms that are non-obvious given the inputs and operation with very few exceptions. Should this algorithm ignore gaps between lines? Should it add the distance between linestrings to the running total? I can see reasonable reasons for both, which suggests to me that it may be a thing for users to decide in a helper function. I’m a little on the fence here to be honest, but I am always hesitant to introduce more complexity.