question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Map not respecting that the earth is round

See original GitHub issue

Longitude gets increased infinitely when map is moved to the east (and decreased infinitely moving to the west)

Steps o Reproduce

  1. Go to OL example at https://openlayers.org/en/latest/examples/geographic.html
  2. Remember the lat/lon coordinates written on the screen
  3. Move ‘around the world’ to the east until you come roughly to the same spot (easier to do if you zoom out)
  4. The new coordinates should be roughly the same as the ones in point 2., but that’s not the case for longitude - it was increased by one earth roundtrip (360deg).

This behaviour occurs also when you calculate the lat/lon coordinates from view extent, for example in moveend event:

map.on('moveend', function(evt) {
  var extentLatLonCoords =
    transformExtent(evt.frameState.extent, evt.map.getView().getProjection(), 'EPSG:4326');
})

Expected behavior If you go ‘around the world’ and arrive at the same spot the calculated coordinates/extent should be the same and respect the fact that the earth is round 😄

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mike-000commented, May 7, 2020
0reactions
yohnycommented, May 7, 2020

as toLonLat() solves my issue, I’m fine with closing this just one more question - toLonLat unwraps coordinates for EPSG:4326 projection, but is there a build in way to unwrap other projections?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is the world map you know wrong?
"Every world map is distorted in some respect," Matthew Edney, a professor of ... our home planet is not flat — it is...
Read more >
The Most Accurate Flat Map of Earth Yet
No flat map of the Earth can be perfect. But flat maps are ... Our map is actually more like the globe in...
Read more >
The World is Round, Your Map is Not
Learn why all maps are a compromise between accuracy and usability, ... is no way around it—a flat map can't ever represent the...
Read more >
Why your mental map of the world is wrong
There are lots of possible reasons for geographical misconceptions like this one, says cartographer John Nelson. Mental maps are necessarily ...
Read more >
What are Map Projections? (And Why They Are Deceiving ...
The best way to represent the Earth is with a globe. ... it's hard to measure distances and they're just not as convenient...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found