d3 / d3-geo

Geographic projections, spherical shapes and spherical trigonometry.
https://d3js.org/d3-geo
Other
1.03k stars 161 forks source link

geoAzimuthalEqualArea not rendering straight lines #268

Closed fromdusttilldawn closed 1 year ago

fromdusttilldawn commented 1 year ago

Hi

I made a map of Europe, where Russia and Turkey are still visible, but only to a certain degree. Using mapshaper I clipped the rest of those countries. The map looks like this when applying the command -proj laea (yes, I'm aware that Norway and Finland are clipped too much):

mapshaper

Now I'd like to render that map using the geoAzimuthalEqualArea projection from d3-geo. I use the projection like this (no extra settings):

geoAzimuthalEqualArea()
geoAzimuthalEqualArea

Why are the features on top and the right curved like that? Am I missing something?

Thanks already for any inputs or tips.

Fil commented 1 year ago

This works as expected. Mapshaper has clipped the shapes in planar coordinates, and connects consecutive points on the edge with no intermediate points. d3-geo then does great circle interpolation between those points (so parallels become “curves”), and furthermore along a projection that doesn't convert meridians to straight lines (so meridians also become “curves”).

Instead of mapshaper, you could try to use d3.geoProject to do the projection + rectangular clipping. See https://observablehq.com/@recifs/project-and-clip for an example.

See also https://observablehq.com/@d3/spherical-clipping

fromdusttilldawn commented 1 year ago

I'll gladly have a look at those Observables. Thank you so much!