I was trying to draw a circle (Ellipse) on top of an ESRI map to highlight antenna area coverage and ran into an issue where the radius of the circle does not cover the expected distance between points on the map.
To highlight my problem I have created the following example using this [Haversine Example](sklearn.metrics.pairwise.haversine_distances — scikit-learn 1.4.0 documentation as inputs.
import datashader as ds
import holoviews as hv
from holoviews.operation.datashader import datashade
from holoviews import opts
hv.extension("bokeh")
esri = (hv.element.tiles.EsriImagery().opts(width=600, height=550, backend="bokeh"))
from sklearn.metrics.pairwise import haversine_distances
from math import radians
bsas = [-34.83333, -58.5166646]
paris = [49.0083899664, 2.53844117956]
bsas_in_radians = [radians(_) for _ in bsas]
paris_in_radians = [radians(_) for _ in paris]
result = haversine_distances([bsas_in_radians, paris_in_radians])
print(result * 6371000/1000) # multiply by Earth radius to get kilometers
#array([[ 0. , 11099.54035582],
# [11099.54035582, 0. ]])
x1, y1 = ds.utils.lnglat_to_meters(bsas[1], bsas[0])
ellipse = hv.Ellipse(x1, y1, 2 * result[0][1] * 6371000)
path = hv.Path([ellipse])
path.opts(color="yellow", line_width=4, alpha=0.5)
esri * path
From the resulting image it is clear to see that the cirlce does not even reach France let alone Paris. The esri map is correct, the datashader lat/long conversion is correct i.e. centre of circle is in Buenos Aires and I didn’t think a simple example like this needed to worry about projections or crs (geoviews). So what am I missing?