Currently, the great circle transform resolution has been set to an arbitrary value. Tweak the value to some heuristic, and make it possible for users to define the value themselves.
@rhattersley : the threshold property on a CRS is presumably designed to do this? What are your intentions for that?
A good example of the problems that are currently being seen:
import matplotlib.pyplot as plt
import numpy
import cartopy.crs as ccrs
prj = ccrs.RotatedPole(180, 37)
ax = plt.axes(projection=prj)
ax.coastlines()
ax.gridlines()
v = 10
ax.set_extent([-v-5, v+5, 45, 60])
plt.plot([-v, v], [50, 50], transform=ccrs.PlateCarree(), color='blue', lw=2, zorder=10)
plt.plot([-v, v], [50, 50], transform=ccrs.Geodetic(), color='red', lw=5)
plt.show()
Tweaking the value of v shows that the threshold, as it stands, does not interpolate suitably for limited area maps. (the geodetic line is supposed to be _fairly_ straight due to the pole rotation).
The original tolerance values were set back when the interpolation was a lot slower, so were heavily weighted to bias performance over accuracy. So they could probably be set tighter now. (For the display of great circles that might well be enough.)
But that said, I'd always hoped we could make the tolerance values "context aware", so they would adjust to suit the current plot. Simplifying somewhat, we want to put in enough points on the interpolation to ensure the interpolated curve is accurate to the order of a pixel - no more, no less.
FWIW an ugly workaround is to threshold hack the map projection:
class RP(ccrs.RotatedPole):
@property
def threshold(self):
return 0.01
prj = RP(180, 37)
In general, we have a few read-only thresholds that we should really make easy to override until we come up with a better architecture to adaptively set the threshold.
I would love for the transform resolution to become a user-accessible value too. I completely understand, and support, @rhattersley 's comments about the reasons for it being hard-coded ages ago. However, I too am finding that large great circles (when viewed on a limited area map) are very jagged.
Most helpful comment
FWIW an ugly workaround is to threshold hack the map projection:
In general, we have a few read-only thresholds that we should really make easy to override until we come up with a better architecture to adaptively set the threshold.