1

I'm using OpenLayers and OpenStreetMap tiles on my map. I'm drawing a circle somewhere in Britain. Then I call getRadius() method on this circle. Map is set to projection: epsg3857

I don't understand why it gives me that strange results. Could you please help me to understand why getRadius() function returns value that is not represented by drawn circle? As a result I suppose that point and radius will represent different circle from what I can see on the map (it is used to later on find some objects inside that circle).

enter image description here

  • 3
    It is giving the result in projection units. EPSG3857 is true scale only at the equator, and is infinite at the poles (which is why Greenland looks as big as Africa) you need to call ol.proj.getPointResolution.for the circle center and adjust the radius for the true scale. – Mike Jan 14 at 10:04
  • Ok thanks, Having those points and radius can I convert it to radius in different projection? – Witos Jan 14 at 11:12
  • 1
    All projections have some distortions as it is not possible to accurately show a curved surface on a flat map, even a transverse mercator becomes distorted as you move away from the central meridian. Multiplying the projected radius by ol.proj.getPointResolution(projection, 1, projectedCenter)) will work for any projection as long as the circle is relatively small (so the resolution does not change significantly within the circle). – Mike Jan 14 at 11:49
4

Don't use EPSG:3857 for measurements

The answer is probably correct as you need to allow for the distortion of distances as you move away from the equator in a mercator map - in this case 25000/cos(51) is approximately 40000. The further north you go the worse it gets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.