Giter Site home page Giter Site logo

Comments (7)

eilamg avatar eilamg commented on July 24, 2024 1

That was significantly shorter than a few weeks 😃

image

from pygeodesy.

mrJean1 avatar mrJean1 commented on July 24, 2024

Correct, there was an issue and that has been fixed. Also, there were no tests for that method and there are now, including your example. Thank you for reporting the issue.

from pygeodesy.

eilamg avatar eilamg commented on July 24, 2024

👍

from pygeodesy.

eilamg avatar eilamg commented on July 24, 2024

Hi Jean,

Further testing with new version shows the issue is only partially resolved.
I've written this simple function to calculate the distance of a point from a segment.

def dist_p_ab(p, a, b):
    """Calculate distance (in radians) from point p to segment (a, b)"""

    n = p.nearestPointOnSegment(a, b)
    d = p.distanceTo(n, radius=1)

    return d

I've then tested this with a segment (a = LatLon(20, -40); b = LatLon(40, 60)) and a grid of latitudes and longitudes spanning the entire globe (lat = np.arange(-90, 90, 1); lon = np.arange(-180, 180, 1)), and rendered the results as an image using matplotlib.

figure_1

The following (unrelated) code also illustrates the issue:

>>> from PyGeodesy.geodesy.sphericalNvector import LatLon
>>> LatLon(10, -140).nearestPointOnSegment(LatLon(0, 20), LatLon(0, 40))
LatLon(00°0000.0N, 140°0000.0W)

It seems like current implementation is failing for a subset of points.

Cheers,
Eilam

from pygeodesy.

mrJean1 avatar mrJean1 commented on July 24, 2024

This is suspicious and I'll need to look into this further. It may take a few weeks, though.

from pygeodesy.

mrJean1 avatar mrJean1 commented on July 24, 2024

Courtesy of the original author, antipodal points (on the same hemisphere) are now handled in the sphericalNvector.LatLon method isWithinExtent.

from pygeodesy.

chrisveness avatar chrisveness commented on July 24, 2024

Nice visualisation!

from pygeodesy.

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.