perliedman/geojson-path-finder

MultiLineString features

Closed this issue · 4 comments

Hello,

I just wanted to know if this library works with MultiLineString features ? It should be the same as LineString but with extra brackets like so:

MultiLineString
[ [ [5.783246085057053,43.12920992982103],[5.78323152868196,43.129224336755215] ] ]

LineString
[ [5.783246085057053,43.12920992982103],[5.78323152868196,43.129224336755215] ]

If not maybe there is a way to alter the code and make it compatible ?

Thank you in advance :)
Lessad

Edit: Corrected "MultipleLineString" to "MultiLineString"

Update:

Changed topology.js

Line 30
function isLineString(f) { return true; }
You can also replace "LineString" with "MultiLineString"

Line 56
f.geometry.coordinates[0].forEach(function buildLineStringEdges(c, i, cs) {

It made it work for me.

Hi!

The problem with these changes are that if I understand correctly, it will only work with MultiLineStrings.

It would be reasonable to make the library support MultLineString, but without breaking current support. Happy to merge a PR.

Hey,

It’s exactly as you say haha I did that because I really needed it to work with that type of feature. But because of my lack of skill and understanding of this library I couldn’t do much.. so I shared it only as a comment.

I hope someone will find a proper and clean way!

Closing this for now. Adding MultiLineString support is probably not too hard, but not something a lot of people seem to ask for. If anyone is interested in adding this, feel free to open a PR.