Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
How do I get the lat long values from an X, Y pixel position, in a Robinson projected map, using JavaScript?

I would like to resolve pixel X,Y positions, on a Robinson projected map, to lat longs.

I have a found a JavaScript function that can resolve lat longs to pixels - https://github.com/afar/robinson_projection - but I cannot work out (or find an implementation of) pixels to lat longs.

I have found various articles about how Robinson projection works, such as https://simplemaps.com/flash/robinson-projection-in-as3-gpl/

I'm basically stuck at this point - the maths required to work out lat long from pixel X,Y is well beyond my terrible maths ability - and despite reading these things quite a few times, the logic isn't clear to me either.

I assumed the logic is in the d3-geo or d3-geo-projection source code somewhere, but couldn't find anything when searching through it.

Looking at Wikipedia, there is this:

Coordinates of points on a map are computed as follows: robinson equation

..but I don't really understand how to put it into Javascript, or work out "the central meridian chosen for the map", and even then are these "coordinates" the same as pixel values?

Background info:

I'm trying to make a very lightweight, simple javascript function, that can do lat long to pixel X,Y and vice versa, for both Mercator and Robinson projections - without using d3 etc.. I want it to be less then 2kb minified and gzipped, no deps.

I've got Mercator working OK - there's lot of examples. But still struggling with Robinson projection.

The full code, if it helps, is here: https://github.com/sc0ttj/component/pull/53

(Side note, which may affect the solution I need:

For some reason I had to change latSign = getSign(lat) to latSign = 0-getSign(lat) to get the map to show the right way up, vertically - see https://github.com/sc0ttj/component/pull/53/files#diff-dc34d0b1b3b6f92f7c3e71af717cf56a5f98923980b859c128d793991690ebdcR64.)

I'm shamelessly standing on the shoulders of these two projects:

  • https://github.com/nunobaldaia/mercatormap
  • https://github.com/afar/robinson_projection
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!