Let's say I have a basic setup like the following:

 const meters = 5000;
 const coordinates = [somePoint, someOtherPoint];
 const circle = new Circle(coordinates, meters);
 const feature = new Feature(circle);
 const source = new VectorSource({
   projection: whateverProjectionImUsing,
 const layer = new VectorLayer({source});
 const view = new View ({
   projection: whateverProjectionImUsing,
 const map = new Map(view);

When I plot this on a map with an ESPG:3857 projection the circle looks correct. However, if I plot this on a map with an EPSG:4326 projection the circle takes up the entire map.

How do I adjust the code so that the radius shows correctly regardless of projection?


1 Answer 1


If you use ol/geom/Circle the radius must be in the same units as the coordinates. Also what looks like a circle on the screen may not be a circle on the ground, for example at northern or southern latitudes in EPSG:4326 a circle on the ground should be appear as an ellipse on the map, and in EPSG:3857 at the same latitudes the radius in projection units would be too small for the true circle on the ground. For best results in any projection use ol/geom/Polygon.circular https://openlayers.org/en/latest/apidoc/module-ol_geom_Polygon.html#.circular The result must be transformed from EPSG:4326 to the view projection.

  • Hi, thanks! Unfortunately changing 'new circle' to 'circular' does not work in my case as I'm also creating pizza-slice shaped sections from the circle using the 'fromCircle' method and it internally barfs because there is no myCircle.getCenter method. I think I got it working by using transform([meters], 'EPSG:3857', myCurrentProjection) Commented Aug 18, 2021 at 15:36
  • If you must use ol/geom/Circle you can use getPointResolution to convert between projection units and meters. It can also be used to scale according to the map scale at the location of the feature, which is also useful for EPSG:3857 where a circle in Greenland should look bigger than a circle of the same radius in Africa as despite appearances on an EPSG:3857 map Africa and Greenland are not the same size codesandbox.io/s/vector-layer-forked-1by4r?file=/main.js
    – Mike
    Commented Aug 18, 2021 at 16:07
  • Thanks for the code sample. Perhaps I'm not understanding it correctly, but I see 4 circles in your code sample. When I change the projection to 3857 I only see 1 circle in your code sample. Commented Aug 18, 2021 at 17:23
  • 4 circles codesandbox.io/s/vector-layer-forked-mtgwl?file=/main.js If you did not convert the centers to EPSH:3857 they would have overlapped and looked like one
    – Mike
    Commented Aug 18, 2021 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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