Coder Social home page Coder Social logo

Comments (6)

Fil avatar Fil commented on May 2, 2024 1

d3-geo-projection now has newton.js which can help in some cases

from d3-geo-projection.

Fil avatar Fil commented on May 2, 2024

https://marcinciura.wordpress.com/2016/11/20/authagraph/ has this note:

As inverting the equations of the projection algebraically is a hopeless task, I resorted to the numerical Broyden’s method. The initial guess of (\phi, \lambda) = f^{-1}(x, y) comes from inverting the gnomonic projection. When the accuracy is set to 10-7 R, i.e. about one metre, the method usually finds \phi and \lambda after 5 iterations.

So it looks like a nice generic method for this would be to use a known inverse proj as a first step, then optimize on the real stuff: unknown.invert = approximation_method (known.invert);

from d3-geo-projection.

Fil avatar Fil commented on May 2, 2024

@mciura I cited you here also

from d3-geo-projection.

MarcinCiura avatar MarcinCiura commented on May 2, 2024

In my experience, Broyden's method had the median number of iterations equal to 5, and the long tail ended at 18 or 19 iterations. I had to come up with nontrivial tricks to make it work near the poles — I suppose Newton–Raphson and any other method would need them too.

from d3-geo-projection.

Fil avatar Fil commented on May 2, 2024

Here's a function that apparently works correctly for the inverse of:

  • ChamberlinAfrica
  • ModifiedStereographicAlaska
  • ModifiedStereographicGs48
  • ModifiedStereographicMiller
  • ModifiedStereographicLee
  • TwoPointAzimuthalUsa
  • ModifiedStereographicGs50 (the part over Europe is broken but it's not supposed to be shown)
  • InterruptedSinuMollweide (needs a bit more syntactic sugar to go around interrupt.invert, see block)
  • Bertin 1953 (work in progress)

https://bl.ocks.org/Fil/07930ee04d7fbd9e5e3e84e803d35dcf

chamberlinafrica invert

from d3-geo-projection.

Fil avatar Fil commented on May 2, 2024

This inverse function now works on all remaining d3 projections.

The code would need to be cleaned up before merging, and before I try and do that, I'd like to know if you think the 2D (and spherical) Newton-Raphson method should be promoted into its own plugin (exporting d3.solve & d3.geoSolve), rather than be constrained to d3-geo.

There's also a problem of convergence, evidenced by the red dots on https://bl.ocks.org/Fil/07930ee04d7fbd9e5e3e84e803d35dcf

This might be fixed by restricting the search domain to the initial clipAngle.

from d3-geo-projection.

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.