Subject | Re: [firebird-support] Maths in the queries |
---|---|
Author | Hannes Streicher |
Post date | 2011-06-30T11:45:55Z |
Hello Lester Caine,
like
where (lat_h< origin_lat+0.5) and (lat_h>origin_lat-0.5)
(lon_h< origin_lon+0.5) and (lon_h>origin_lon-0.5)
adjust the 0.5 to a little bit more according to the maximum area you want to cover
from a POI Search i wrote a couple of years ago in php/mysql :
SELECT k.*
( ( ( k.geonord-'.$nN.' ) * ( k.geonord-'.$nN.' ) ) + ( ( k.geoost-'.$nO.' ) * ( k.geoost-'.$nO.' ) ) ) AS distance
FROM clients k WHERE k.country = '.$country.
AND abs( k.geonord-'.$nN.' ) < 0.3 AND abs( k.geoost-'.$nO.' ) < 0.3 order by distance limit 0,60
--
Mit freundlichen GrĂ¼ssen
Hannes Streicher mailto:HStreicher@...
> I am trying to work out a fast way of identifying points of interest within awhy not reduce your search range for testing first
> radius of the selected home location ... and potentially there could be 100+
> entries per postcode eventually although probably not 200,000,000 records to scan.
like
where (lat_h< origin_lat+0.5) and (lat_h>origin_lat-0.5)
(lon_h< origin_lon+0.5) and (lon_h>origin_lon-0.5)
adjust the 0.5 to a little bit more according to the maximum area you want to cover
from a POI Search i wrote a couple of years ago in php/mysql :
SELECT k.*
( ( ( k.geonord-'.$nN.' ) * ( k.geonord-'.$nN.' ) ) + ( ( k.geoost-'.$nO.' ) * ( k.geoost-'.$nO.' ) ) ) AS distance
FROM clients k WHERE k.country = '.$country.
AND abs( k.geonord-'.$nN.' ) < 0.3 AND abs( k.geoost-'.$nO.' ) < 0.3 order by distance limit 0,60
--
Mit freundlichen GrĂ¼ssen
Hannes Streicher mailto:HStreicher@...