Open jbednar opened 7 years ago
This little function computes a great-circle path at any required density:
import pyproj
def get_circle_path(start, end, sampling=1000):
sx, sy = start
ex, ey = end
g = pyproj.Geod(ellps='WGS84')
(az12, az21, dist) = g.inv(sx, sy, ex, ey)
lonlats = g.npts(sx, sy, ex, ey,
1 + int(dist / sampling))
return lonlats
We should add this as an option on the existing gv.operation.project_shape
function.
Sounds good. Can we use it to have meaningful lon, lat coordinates shown on the axes by drawing a grid with lines starting at each axis?
get_circle_path should add start and end to lonlats
HLine and VLine will always be straight in screen coordinates, but it's important to be able to draw paths between two points that follow the great-circle path that one would need to travel in the real world. Such paths can already be plotted using the latest geoviews master (thanks @philippjfr!):
though it would be nice to increase the number of points to make smoother curves. Philipp also had a suggestion for exposing the coordinate transformations for when you want to work with them explicitly:
This all sounds good, but there are some other things that would help when working with great-circle paths. First, if there is a function in cartopy or proj4 for computing a great-circle distance between two points, it would be great to show that in an example in a GeoViews tutorial, along with the above example of plotting paths. Second, if there is not currently such a function, Philipp has some code of his own for computing it, and it would be good to add that to GeoViews so that people can work naturally with great-circle paths.