Kontinuation commented on PR #845:
URL: https://github.com/apache/sedona/pull/845#issuecomment-1569368208
We can derive a more accurate formula of lat-lon envelope for haversine
distance $D$:
$$
\begin{align*}
\Delta \textrm{lat} &= \frac{D}{R} \\
\Delta \textrm{lon} &= \max (\frac{D}{R \cos(\textrm{lat} + \Delta
\textrm{lat})}, \frac{D}{R \cos(\textrm{lat} - \Delta \textrm{lat})})
\end{align*}
$$
where $\textrm{lat}$, $\textrm{lon}$ is the center of the envelope; $R$ is
the radius of the earth. The center point is expanded by $\Delta \textrm{lat}$,
$\Delta \textrm{lon}$ to obtain the envelope for coarse-grained filtering. The
envelope can also be expanded by a constant factor slightly greater than 1 to
get rid of false negatives.
For spheroid distance, we can use the same formula for sphere distance, but
with a different $R$ value. We can take the equatorial radius of the spheroid
as $R$ (approximately 6378 km) and the resulting envelope should be inclusive.
I'm not sure if I'm doing the math correctly, I can find some other
references on this topic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]