geojson-path-finder icon indicating copy to clipboard operation
geojson-path-finder copied to clipboard

MultiLineString features

Open Lessad opened this issue 5 years ago • 3 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"

Lessad avatar Jul 22 '20 06:07 Lessad

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.

Lessad avatar Jul 24 '20 09:07 Lessad

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.

perliedman avatar Aug 16 '20 21:08 perliedman

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!

Lessad avatar Aug 16 '20 22:08 Lessad

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.

perliedman avatar Dec 27 '22 19:12 perliedman