I use drupal6 with wounderfull views2 and location. I created a view which displays a location and the distance to a specific point. When i enable the table-display and set the sorting to "Distance" the sorting will nor work correctly.

Sql-Query goes like this:

SELECT ... ORDER BY location_latitude ASC

but "location_latitude" is not the right way to sort by distance. MySql-Qeury must be:

$lat = latitude;
$lon = longitude;
SELECT SQRT( POW( 69.1 * ( l.latitude - ".$lat.") , 2 ) + POW( 69.1 * ( ".$lon." - l.longitude ) * COS( l.latitude / 57.3 ) , 2 ) ) AS distance .... ODER BY distance ASC

is this a known problem? How to fix that?

Thank you for your help!

Comments

webnotwar’s picture

No one else have this problem?

I'll pay for a fix!