maptalks.js icon indicating copy to clipboard operation
maptalks.js copied to clipboard

how to calculate the length of lineString?(ps: the result is in meters or kilometers)

Open Jackyclearliu opened this issue 2 years ago • 1 comments

maptalks's version and what browser you use?

Issue description

Please provide a reproduction URL (on any jsfiddle like site)

Jackyclearliu avatar Mar 06 '23 07:03 Jackyclearliu

@Jackyclearliu You can use some third-party libraries to solve your needs

such as turfjs,jsts etc

const geojson=line.toGeoJSON();

const distance=turf.length(turf.linestring(geojson))

deyihu avatar Mar 13 '23 13:03 deyihu