-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
importEPSG and importEPSGA both swap axis order to lat/lon #119
Comments
I see, that docstring must be updated. From what I understand, PROJ now follows the ordering as defined by the authority. For EPSG that is typically lat/lon, see https://proj.org/faq.html#why-is-the-axis-ordering-in-proj-not-consistent. PROJ also offers |
proj_normalize_for_visualization could help. If it's accessible through GDAL we could dispatch to using it by defining a geometry type that guaranteed an axis order. That would be useful and let us do generic things without worrying about the differences. If it's not accessible we could define axis order traits for the formats in GeoFormatTypes. Then we can at least automate swapping them back and forth. Although maybe the CRS string actually needs to be parsed to know the return order for some formats? However it happens, I think we need a way to buffer users from this when that is useful. Relevent discussion. |
Ok so WKT does this as well - but unlike EPSG it needs to be parsed to check the authority to know if it will happen. If you convert |
We can also set |
I see, this is explained in https://gdal.org/tutorials/osr_api_tut.html#crs-and-axis-order. For the C API, in the ogr_srs_api there are also functions and enums available, search From your sf link I also found this on the R-spatial blog: https://www.r-spatial.org/r/2020/03/17/wkt.html:
It's a bit of a tough call to make, but right now I'm thinking that in a GDAL Julia package we should follow GDAL default behavior. Like
Yeah I think this is one of the reasons PROJ discourages using proj strings for CRS. Note though that knowing something is an EPSG code is not enough. The rule is just that EPSG decides per projection, hence (from the same R-spatial blog post):
|
I agree. Some wrapping packages can change that like sf does. ArchGDAL can have a kwarg for it, the question is if it defaults to traditional or mixed order. When I get around to handing point data in GeoData.jl it will probably use the custom order option - the order will be arbitrary but fixed for any one object depending on the order of the dimensions. |
ArchGDAL.jl/src/spatialref.jl
Line 145 in f57c2dc
I think this no longer happens as of GDAL 3.0, and both methods are identical:
https://gdal.org/doxygen/classOGRSpatialReference.html#aaa6965a1df98cdc673dfb20697eab613
For my use cases it breaks the generality or
reproject
when the axis order switchesfor EPSG, which worked when I first wrote it! I'm not sure how to handle that now. Probably
all upstream uses should convert EPSG to PROJ before using
reproject
.The text was updated successfully, but these errors were encountered: