d3-geo-projection icon indicating copy to clipboard operation
d3-geo-projection copied to clipboard

interrupted projections sometimes have partially undefined inverse

Open cambecc opened this issue 4 years ago • 2 comments

Using d3-geo-projection 3.0.0, an interrupted projection's inverse is sometimes partially undefined, depending on the shape of the interruption.

For an example, see https://bl.ocks.org/cambecc/eb1380f8cb0da3d4142e870a3a6b623b.

Screen Shot 2021-01-17 at 13 04 19

The first projection is "Interrupted Mollweide Oceans" from https://observablehq.com/@d3/interrupted-mollweide-oceans. The blue pixels represent the screen coordinates where the projection's inverse is defined. Note that only part of the globe is colored blue.

The second projection is a slightly modified "Interrupted Mollweide Oceans", where the lobes are adjusted to land on the equator rather than ±5° lat. In this case, the globe is fully blue because the projection's inverse is now defined for all screen coordinates inside the bounds of the globe.

I do not know if this is expected behavior or not, but it seems close enough to raise as an issue.

cambecc avatar Jan 17 '21 04:01 cambecc

Confirmed. And it reminds me that the forward projection is wrong too (#178).

Fil avatar Jan 17 '21 20:01 Fil

Related issue: when the connection between lobes is not made on the Equator, the map is wrong. The following video demonstrates an (exaggerated) view of the problem: the connections between the two lobes on the left should be a vertex in projected space, not a segment (like they are on the right).

https://user-images.githubusercontent.com/7001/104856498-4a41a980-5913-11eb-89ee-8f4c8af970f3.mov

Remarks:

  • it seems to me that in this case, the "lobes" are not enough to define the projection; if we want to define this properly, we would also need to define an origin.
  • None of the examples in README have this problem, they are all joining lobes on the Equator.
  • The projection in https://observablehq.com/@d3/interrupted-mollweide-oceans uses 5° and the problem is there technically, but doesn't show for such a small angle.

Fil avatar Jan 17 '21 21:01 Fil