d3 / d3-geo-projection

Extended geographic projections for d3-geo.
https://observablehq.com/collection/@d3/d3-geo-projection
Other
1.1k stars 201 forks source link

Add Cupola projection #209

Open TomBor opened 3 years ago

TomBor commented 3 years ago

A beautiful new world map equal-area projection created by Weia Reinboud : https://www.tandfonline.com/doi/full/10.1080/23729333.2020.1862962

All the info rmationI found :

Fil commented 3 years ago

Projection invented and developed by @WeiaR.

A comment by the author in the PROJ issue gives the following formula:

x=1.6188566*sqrt(2/(1+0.530815*sin(asin(0.7264*sin(u)+0.2587011))+0.8474875* cos(asin(0.7264*sin(u)+0.2587011))*cos(0.5253*v-0.1010612291)))* cos(asin(0.7264*sin(u)+0.2587011))*sin(0.5253*v-0.1010612291)*0.9701 y=1.6188566*sqrt(2/(1+0.530815*sin(asin(0.7264*sin(u)+0.2587011))+0.8474875* cos(asin(0.7264*sin(u)+0.2587011))*cos(0.5253*v-0.1010612291)))*(0.8474875* sin(asin(0.7264*sin(u)+0.2587011))-0.530815* cos(asin(0.7264*sin(u)+0.2587011))*cos(0.5253*v-0.1010612291))/0.9701

where (u,v) = (lat, lon) in radians.

https://observablehq.com/@fil/cupola-projection

The inverse projection is obtained by the Newton-Raphson 2D method (already developed in d3-geo-projection).

cupola-projection

WeiaR commented 3 years ago

Nearly OK. The only problem is the borders of the map. The central meridian is 11.023 degrees (east), this is built in in the equations. This leads to left boundary -180+11.023 degrees and right boundary 180+11.023 degrees In the adapted version above boundaries are rounded to the nearest 10 degree, I think, which gives an asymmetric map, left and right corners are not at the same height.

Fil commented 3 years ago

Thank you @WeiaR for the close look (and for the magnificent projection!). I've just fixed my code, as well as the image above.

I'll probably tweak the implementation a bit to make it more "d3-friendly" (we prefer antimeridian clipping at -180, 180, and rotating the aspect). But it won't change the map.

WeiaR commented 3 years ago

The previous picture had more problems. I'll look at the new one.

WeiaR commented 3 years ago

It's perfect! I understand preferences for round numbers, but one purpose of my project was to see what happens when common preferences were left out. I started with the most compact ordening of all continents, which is a big circle having its center in Gabon. Accidentally the borders of the map then are so close to the international date line that I took that as boundary, more precise where the date line is between Siberian and Alaskan isles (Diomede and Big Diomede). When cartographers very much prefer round numbers I could look at it, how much worse it will become. But all parameters than change and so the equations!

jrus commented 3 years ago

@WeiaR Nice work!

One question I have when reading the paper: was it your original expectation/intention to have a shape pulled together at the north pole and stretched out at the south pole? In retrospect it is what someone might expect to happen if minimax optimizing to preserve the shapes of Greenland, New Zealand, Chukotka, etc. while entirely ignoring Antarctica, but I can also imagine the resulting optimized shape being a surprise at first.

WeiaR commented 3 years ago

Thanks. My only aim was to make an asymmetric projection because land masses aren't equally spread on the globe.. I had no idea what could be the outcome. As you can see on my website figure 9, very different forms are also possible. It in fact isn't optimizing, the criterion of making the worst points on land as good as possible is finding a solution to a set of equations. Rather nasty equations, I only could do it numerically. The solution has 4 equally good worst points. All other points on the continents have less distortion.

jrus commented 3 years ago

This kind of optimization of the Chebyshev distance (a.k.a. L∞ distance) is commonly seen with conformal projections (optimizing for minimal worst-case scale variation), e.g. the Eisenlohr projection is the "optimal" conformal projection in this sense of the globe with a cut along one meridian. Hammond contracted physicist Mitchell Feigenbaum to make a whole set of L∞-optimized conformal projections of various countries and continents for their 1992 world atlas.

For a conformal projection it can be proven that the L∞-optimal projection of a particular contiguous region of the sphere will have constant maximal scale along the boundary. For equal-area projections I don't think an L∞ optimized map in general has constant shear all along the boundary, but it should still tend toward having similar worst-case shear at various points along the chosen boundary because distortion can be reduced in one place by increasing it somewhere else, so an L∞ optimization method will tend to reduce the worst-case distortion on the map by spreading it around, and only stop when there’s no way to perturb the parameters in a way that simultaneously reduces distortion at all of the most-currently-distorted points.


I’d be curious to see what happened if the same projection family were optimized using a least squares (L2 distance) criterion instead, perhaps with continental points weighted by population.

WeiaR commented 3 years ago

I'm not a mathematician, so maybe am not using the proper words. But I immediately looked up how to pronounce Chebyshev in Russian (chebishóf). Why I tend to call it a solution is because I have a finite set of candidate worst points on the continents (89, see picture) and a finite set of parameters (5) and therefore a finite set of what I call solutions. With zero active parameters there is 1 worst (=most distorted) point on the map, with 1 parameter 2 points can be made equally worst, etcetera. Due to the irregularity of the polygon with 89 points it stops at 4 worst points. So take 4 out of the 89 points and find out when they have the same distortion. When there are more solutions, more maps, less distortion is the best solution. In the end there is just one set of 4 candidate points having exactly the same distortion and being the best of all solutions. That's the Cupola.

Screenshot 2021-05-07 at 09 32 25
WeiaR commented 3 years ago

I started with least squares, wanted to summate them over the continents, but then thought: power 2 is arbitrary, why not power 3 or 4? This leaded to 'power infinite', so only look at the worst points. Your idea of least squares and weighted points is interesting. The dots on my maps have the same area (4 square degrees), you only have to find out how many people are living there, nearly 3000 points...

jrus commented 3 years ago

The biggest reason to use least squares (L2 distance) is that it is the most mathematically/computationally inexpensive and convenient. L∞ distance (worst-case error) and L1 distance (sum of the absolute values of all errors, sometimes called "taxicab distance") are also commonly used. L1 distance is very sensitive to small errors over a large number of points but barely penalizes high-error outliers; L∞ distance very harshly penalizes high-error outliers but is completely insensitive to marginal changes to errors everywhere else. L2 distance is in between.

waldyrious commented 3 years ago

Just adding a visual reference for those following along:

(source)

WeiaR commented 2 years ago

O I did ;-) Least squares were my first idea, of course, but I moved towards a more radical approach. With least squares all locations count and the central parts will have influence. There are enough projection with a good centre, I was curious which would be the results when no region in before has an advantage.

Greetz, Weia

On 7 May 2021, at 20:24, Jacob Rus @.***> wrote:

The biggest reason to use least squares (L2 distance) is that it is the most mathematically/computationally inexpensive and convenient. L∞ distance (worst-case error) and L1 distance (sum of the absolute values of all errors, sometimes called "taxicab distance") are also commonly used. L1 distance is very sensitive to small errors over a large number of points but barely penalizes high-error outliers; L∞ distance very harshly penalizes high-error outliers but is completely insensitive to marginal changes to errors everywhere else. L2 distance is in between.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/d3/d3-geo-projection/issues/209#issuecomment-834673708, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT55H75GNFWVN5FYTCPCQATTMQV7JANCNFSM44ELK46A.

WeiaR commented 1 year ago

Did I answer this mail?

Greetz!

Weia

On 6 May 2021, at 20:29, Jacob Rus @.***> wrote:

@WeiaR https://github.com/WeiaR Nice work!

One question I have when reading the paper: was it your original expectation/intention to have a shape pulled together at the north pole and stretched out at the south pole? In retrospect it is what someone might expect to happen if minimax optimizing to preserve the shapes of Greenland, New Zealand, Chukotka, etc. while entirely ignoring Antarctica, but I can also imagine the resulting optimized shape being a surprise at first.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/d3/d3-geo-projection/issues/209#issuecomment-833759515, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT55H7552BJFUHO6YWCSZRDTMLNXFANCNFSM44ELK46A.