Coder Social home page Coder Social logo

Comments (5)

micahcochran avatar micahcochran commented on May 22, 2024

I tried to replicate this on the command line with cs2cs:

$ cs2cs -f "%.14f" +proj=latlong +datum=WGS84 +to +proj=latlong +datum=NAD27
-127.9 50.98
-127.89840687790534 50.98018566035922 0.00000000000000
$ cs2cs -f "%.14f" +proj=latlong +datum=NAD27 +to +proj=latlong +datum=WGS84
-127.89840687790534 50.98018566035922
-127.90000000000006 50.98000000000003 0.00000000000000

The round trip result was -127.90000000000006 50.98000000000003. Those right-most digits are simply the limits of 64-bit double math.

I used pyproj.Geod for the distance calculation and got: 6.0880917533296244e-09 meters. Close enough to your last result.

This bug could be problematic.

from pyproj.

joaoportela avatar joaoportela commented on May 22, 2024

That is (kind of) good news.

What else can I do to figure out what is causing this?

from pyproj.

micahcochran avatar micahcochran commented on May 22, 2024

Sorry, I didn't replicated your example fully. Here is the version with the error. Using -128.0 longitude.

C:\...>cs2cs -f "%.14f" +proj=latlong +datum=WGS84 +to +proj=latlong +datum=NAD27
-128.0  50.98
-127.99845565740137     50.98025249402806 0.00000000000000
C:\...>cs2cs -I -f "%.14f" +proj=latlong +datum=WGS84 +to +proj=latlong +datum=NAD27
# Inverse of last
-127.99845565740137     50.98025249402806
-128.00005191895048     50.98006355013496 0.00000000000000

And the distance calculation:

>>> from pyproj import Geod
>>> wgs84_geod = Geod(ellps='WGS84')
>>> angle1, angle2, distance = wgs84_geod.inv(-128.0, 50.98, -128.00005191895048, 50.98006355013496)
>>> distance
7.954670001528683

That is similar to your results, about 8 meters off.

Base on that I don't think pyproj is at fault, it is just using what the underlying PROJ.4 C library is giving it. Please report this issue to proj.4.

from pyproj.

joaoportela avatar joaoportela commented on May 22, 2024

Sorry.
I didn't notice that you were using -127.9 in your tests.

From my local tests I already noticed that some values around -128.0 don't trigger the issue.
Examples:

  • -127.9 doesn't trigger the issue.
  • -127.99 doesn't trigger the issue.
  • -127.999 doesn't trigger the issue.
  • -127.999999 doesn't trigger the issue.
  • -127.99999999999 doesn't trigger the issue.
  • -127.999999999999 triggers the issue.
  • -128.0 triggers the issue.
  • -128.001 triggers the issue.
  • -128.01 doesn't trigger the issue.
  • -128.1 doesn't trigger the issue.

from pyproj.

joaoportela avatar joaoportela commented on May 22, 2024

This seems to be an issue of OSGeo/proj.4. Reported here.

Closing.

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.