MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / geojsonCoords2UGDoubleArray

Function geojsonCoords2UGDoubleArray

src/common/wasm/util.js:21–37  ·  view source on GitHub ↗
(coords)

Source from the content-addressed store, hash-verified

19}
20
21export function geojsonCoords2UGDoubleArray(coords) {
22 if (!coords) {
23 throw new Error('No GeoJSON coords provided')
24 }
25
26 if (!coords || coords.length === 0) {
27 return null
28 }
29 const length = coords.length
30 const coordArr = new Float64Array(coords)
31 const coordPtr = window.ugcModule._malloc(length * 8)
32 window.ugcModule.HEAPF64.set(coordArr, coordPtr / 8)
33 const pDoubleArray = window.ugcModule._UGCWasm_Helper_CreateDoubleArray(coordPtr, length)
34 window.ugcModule._free(coordPtr)
35
36 return pDoubleArray
37}
38
39export function getJSArrayFromUGDoubleArray(pDoubleArray) {
40 // get length of doublearray

Callers 3

Calls 1

setMethod · 0.45

Tested by

no test coverage detected