turf
turf copied to clipboard
interpolate elevation in all computations
According to the geojson spec, positions can include a 3rd number to represent elevation. It looks like turf does not support elevation in any way. It would be awesome if turf could (optionally) interpolate elevation in all computatations. Is this something other people are interested in? I'd be willing to add support assuming someone is willing to accept my pull requests 😃
Hey Paul!
Yep, as it currently stands, Turf doesn't support the elevation parameter in GeoJSON in any meaningful way. This was a combination of two factors:
- It's kind of hard to implement
- The GeoJSON spec didn't specify a unit or meaning for the altitude coordinate of a position
Luckily, #2 is no longer the case! The IETF draft in section 4 specifies the meaning of altitude: https://tools.ietf.org/html/draft-ietf-geojson-03#section-4
An OPTIONAL third position element SHALL be the height in meters above or below the WGS 84 reference ellipsoid. In the absence of elevation values, applications sensitive to height or depth SHOULD interpret positions as being at local ground or sea level.
So that's cleared up. Happy to accept any PRs that interpolate/include elevation when it's present!
👍 Support having elevation in all computations, reference https://github.com/Turfjs/turf/issues/628.
I too am interested in the addition of the altitude element and this becoming significant in the calculation of distance.
To that end, I did find the following useful response along the same lines, which demonstrates how to add the altitude distance calculation:
https://stackoverflow.com/questions/64877775/calculate-distance-between-two-coordinates-with-short-distances-considering-alt