itowns
itowns copied to clipboard
Change Coordinates constructor to match epsg coordinates order
The order of lat / long coordinates is reversed in the Coordinate.js constructor: the constructor expects long / lat / altitude while the order or axes is generally lat / long, especially for EPSG:4326 according to the specs. It can be a little bit confusing and lead to errors and I think it should be changed to lat / long / altitude.
Yes, I noticed that it isn't clear.
I will read this article to find solution on the order of the EPSG:4326
axes.
A non breaking change solution is needed, surely with a system parameter (axesOrder
).
It is also necessary to manage the other possible projections of Coordinates
.
Interesting article! I agree that a non breaking change would be better.
I agree with you for other possible projections. In addition, a small shortcut is taken in the current implementation: EPSG:4326 is assumed to be 3D (with an altitude value) while it is actually 2D (only lat / long); its 3D counterpart is EPSG:4979 (lat / long / alt). Moreover, instantiating a Coordinates
object with EPSG:4979
with long/lat/altitude throws an error (probably because EPSG:4979
is not defined with proj4.defs()
). Even if the confusion between EPSG:4326
and EPSG:4979
is common, I think we should clarify this in the code by at least defining EPSG:4979
by default and make sure that it works when defining coordinates with this code.