geo-identify-position-format
Identifies a few common geometry position formats.
Install
npm install geo-identify-position-format
Use
var geoid = require('geo-identify-position-format');
geoid.identify(positions)
returns one of:
geoid.FLAT_ARRAYgeoid.ARRAY_OF_ARRAYSgeoid.TYPED_ARRAYgeoid.ARRAY_OF_TYPED_ARRAYSgeoid.NDARRAY
when positions has one of the following formats:
- Flat arrays
[1,2,3,4,5,6] - Array of arrays
[[1,2,3], [4,5,6]] - Array of TypedArrays
[new Float32Array([1,2,3]), new Float32Array([4,5,6])] - TypedArray
new Float32Array([1,2,3,4,5,6]) - ndarray
ndarray(new Float32Array([1,2,3,4,5,6]))
If positions does not have one of the previously listed formats, geoid.identify
will throw an error.
Credits
Extracted from @hughsk's gl-geometry.