[TYPO3-mvc] How would you realize a radius search

Oliver Klee typo3-german-02 at oliverklee.de
Tue Feb 19 11:03:19 CET 2013


Hi,

Am 19.02.2013 10:33, schrieb Claus Due:
> Ideally I agree 100% with this, assuming you require speed as well as precision.
> However, there are ways to do this in MySQL only. It's called the haversine()
> formula - the Vincenty formula is the best but also most complicated. Haversine
> is less complex (and can actually be performed directly in raw SQL, but is slow)
> but has an error margin of upwards of 20 km (on huge lattitudal distances) due
> to seeing the earth as a perfect sphere.

Doing the haversine in MySQL is quite slow IIRC. I'd also recommend a
two-pass solution: First filter using a bounding rectangle (via MySQL),
then filter by the radius in memory.

At least for the second part, you can use the geocoding calculator in my
oelib extension (trunk version):

<https://svn.typo3.org/TYPO3v4/Extensions/oelib/trunk/Geocoding/Calculator.php>


Oli


More information about the TYPO3-project-typo3v4mvc mailing list