openlayers / openlayers

OpenLayers
https://openlayers.org
BSD 2-Clause "Simplified" License
11.39k stars 3.03k forks source link

Squashed map tiles / bad aspect ratio #8801

Closed ffxsam closed 6 years ago

ffxsam commented 6 years ago

The Adler Planetarium should definitely be round. This happens regardless of what tileset I use (Here, Mapbox). I'm just pointing the Map class to a regular div (<div id="#map"></div>), there's no special JS-based sizing going on.

image

ahocevar commented 6 years ago

I cannot reproduce this. Looks like the image was reprojected, i.e. your view has a different projection than EPSG:3857, in which case what you see is expected.

You can verify with the official examples (e.g. https://openlayers.org/en/latest/examples/here-maps.html) that the Adler Planetarium is round.

ffxsam commented 6 years ago

@ahocevar You're totally right, it's because I was using the EPSG:4326 projection in order to use lat/lng for all coordinates on the map. I didn't want to use the default of EPSG:3857 because it doesn't allow us to use lat/lng values for focusing on parts of the map. What's my recourse here?

ahocevar commented 6 years ago

You'll want to use fromLonLat() and toLonLat().

ffxsam commented 6 years ago

Thanks! I was looking for a way to avoid having those all over my code, but I'll take that over distorted imagery. 😉

PrinceCharles23 commented 5 years ago

have the same problem, changed all coordinates to fromLonLat() but it just feels wrong to have calls to that all over the place just to give the view "what it wants"

i don't want to sound ungrateful but what is the point of different projections on the view if they only work correctly with exactly one setting?