Coder Social home page Coder Social logo

Comments (3)

micahcochran avatar micahcochran commented on August 27, 2024

This is not compliant to ISO 6709 (https://en.wikipedia.org/wiki/ISO_6709), which says that the order must always be "lat, lon"

That is an oversimplification. As you correctly quote the Wikipedia article:

Order, positive direction, and units of coordinates are supposed to be defined by the CRS.

Continuing:

When CRS identification is missing, the data must be interpreted by the following conventions: Latitude comes before longitude...`

I added emphasis to make my point. It is really a set of rules for how coordinate pairs are ordered. I would tend to think that the ordering of pairs would be for the storage and transmittal of coordinate pairs. I could see the point that this could also govern coordinate pairs for functions. I don't really know. This will make the code a bit more complicated. The underlying PROJ4 API's pj_transform() uses x, y, z.

PROJ4 as of version 4.8.0 supports a way to change axis order with the +axis parameter.

GDAL seems to have some support (and history) for switching Axis Order. I don't know of any other Python libraries that supports reordering parameters based on the CRS or use lat/long ordering for Geographic Coordinate System. There are Python libraries that don't know/care what CRS is being inputted.

Here is a way to get lat/long ordering for input. Output will always be lon/lat.

>>> from pyproj import Proj
>>> p = Proj(proj='utm',zone=10,ellps='WGS84')
#  p(y=latitude, x=longitude)
>>> x,y = p(y=34.36116666, x=-120.108)
'x=765975.641 y=3805993.134'

All that being said, it would be great to have access to ISO 6709 to read what it actually says, but alas it is behind a paywall.

I think it could designed to switch coordinate ordering, but I think it should be designed to allows for backward compatibility of current coordinate ordering (x, y, z).

from pyproj.

snowman2 avatar snowman2 commented on August 27, 2024

I think the workaround @micahcochran provided is sufficient for this case. For backward compatibility sake, I think keeping it as is is probably better. If you have a backwards compatible solution and would like to continue the conversation, feel free to reopen.

from pyproj.

snowman2 avatar snowman2 commented on August 27, 2024

Apparently it was already swapped in the new version of PROJ for most projections. See #225.

from pyproj.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.