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.

Circle produces ellipsis (oval) geometry

See original GitHub issue
import circle from '@turf/circle';

then i create a circle:

let coords = [
    55.837150763618574,
    37.48126387596131,
];

let radius = 70; // in meters

let options = {
    steps: 32,
    units: 'kilometers',
};

let c = circle(coords, radius / 1000, options);

and if i use circle’s geometry coordinates to build a polygon and put in on some map:

console.log(c.geometry.coordinates)

it in fact looks like an ellipsis, not circle.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19

github_iconTop GitHub Comments

2reactions
stebogitcommented, Nov 21, 2019

OK @artuska I found the issue. The data in Turf is definitely treated differently than in Leaflet (with all LatLgn stuff), the only common ground is GeoJSON.

If you try

var turfCircle = turf.circle([center[1], center[0]], radius / 1000, turfCircleOptions);
L.geoJSON(turfCircle).addTo(map);

that works beautifully.

Screen Shot 2019-11-20 at 11 36 39 PM

The L.Polygon function does not work like @turf/helpers|polygon. You need to use the L.geoJSON method on the GeoJSON output of Turf circle.

1reaction
MaxDragonheartcommented, Nov 22, 2019

But anyway — my geometry appears as a circle in Syria but as an ellipsis in Moscow — this is totally strange.

Have you checked the projection system of your project? MapBox use EPSG 3857, this SR amplify the deformation in data as you move away from equator. Then given that Syria is nearest equator than Moscow you see there a circle and an ellipse in Moscow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview concepts of ellipses and conic sections
An ellipse is a circle that has been stretched in one direction, to give it the shape of an oval. But not every...
Read more >
How is an ellipse different from a circle?
In a circle, all points on the circle are equally far from the center of the circle. An ellipse is also a closed...
Read more >
Circles and Ellipses | CK-12 Foundation
The ellipse has a geometric property relating to these points that is similar to a circle's relationship with its center. Remember a circle...
Read more >
Difference Between Ellipse and Oval
Ellipses are conic sections with eccentricity (e) between 0 and 1 while ovals are not precisely defined geometrical figures in mathematics. • An ......
Read more >
Ellipse - Simple English Wikipedia, the free encyclopedia
In geometry, an ellipse is a plane curve which results from the intersection of a cone by a plane in a way that...
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