Administration: Omnidex Features

Geographic Searches

Optimizing Geographic Searches

Geographic searches are specified using a $DISTANCE function. As long as there is a multi-column Omnidex index containing the latitude and longitude, the $distance function will be automatically optimized.

Examples

The following are examples of several types of geographic searches that can be optimized using the $distance function.

Example 1: Distance between two sets of coordinates

select      $distance(40.0, -105.0, 41.0, -106.0) distance
  from      $omnidex;

Example 2: Distance between two sets of coordinates using columns

select      zip,
            $distance(40.0, -105.0, latitude, longitude) distance, 
            latitude, longitude,
  from      zipcodes
 where      $distance(40.0, -105.0, latitude, longitude) < 10;

Example 3: Distance between an origin and multiple sets of destination coordinates

select      state, zip, latitude, longitude
   from      zipcodes
  where      $distance(latitude, longitude,
                       (select      latitude, longitude
                          from      zipcodes
                         where      state = 'CO')) < 5;

Additional Resources

 
Back to top
admin/features/geo/optimization.txt ยท Last modified: 2016/06/28 22:38 (external edit)
 
 
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0