Draw a geodesic disc on a mercator map

268 Views Asked by At

I want to draw the day/night terminators, and the simpliest approach is to compute the circle shadow (useless to detail the math) and project it on the wgs4 sphere.

It is working fine. Just add this feature to a vector layer.

var feature = new ol.Feature(
    ol.geom.Polygon.circular(
        new ol.Sphere(6378137),
        [123.0, 12.5],
        9000000.0,
        32).transform('EPSG:4326', 'EPSG:3857'));

But ... the projected polygon doesn't take into account the cycling coordinates and, close to poles, the last vertices draws a straightline to the first one. I don't get a clean sinusoidal.

I read about the ol.geom.flat.geodesic.greatCircle but what I would need is a greatDisc, to fill the night zone for example.

How can I do that ?

0

There are 0 best solutions below