Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:sql:functions:distance [2010/07/28 19:51]
els
dev:sql:functions:distance [2016/06/28 22:38] (current)
Line 4: Line 4:
 ===== Description ===== ===== Description =====
  
-The $DISTANCE function calculates the distance between one set of geographic coordinates and one or more other geographic coordinates. ​ This is used for performing geographic radius searches, such as finding all rows within five miles of a given location. ​ This can also be used to simply calculate the distance between two points. ​ The following [[admin:optimization:​geo:​home|article]] provides more detail on performing geographic searches in Omnidex.+The $DISTANCE function calculates the distance between one set of geographic coordinates and one or more other geographic coordinates. ​ This is used for performing geographic radius searches, such as finding all rows within five miles of a given location. ​ This can also be used to simply calculate the distance between two points. ​ The following [[admin:features:​geo:​home|article]] provides more detail on performing geographic searches in Omnidex.
  
 This function returns a DOUBLE datatype. This function returns a DOUBLE datatype.
Line 23: Line 23:
 == origin_latitude == == origin_latitude ==
  
-Required. An expression containing the latitude used as the origin of this geographic search. ​ If //​origin_latitude//​ produces a literal string, then that origin will be used for all rows.  If //​origin_latitude//​ is a column, then the origin latitude will be treated as that value for each row processed. ​ //​Origin_latitude//​ can also be a select statement, enclosed in parentheses,​ that retrieves a latitude in a single column and a single row.  Latitudes can be expressed using a FLOAT, DOUBLE, CHARACTER or STRING datatype. ​+Required. An expression containing the latitude used as the origin of this geographic search. ​ If //​origin_latitude//​ produces a literal string, then that origin will be used for all rows.  If //​origin_latitude//​ is a column, then the origin latitude will be treated as that value for each row processed. ​ //​Origin_latitude//​ can also be a select statement, enclosed in parentheses,​ that retrieves a latitude in a single column and a single row.  Latitudes can be expressed using a FLOAT, DOUBLE, CHARACTER or STRING datatype. ​
  
 == origin_longitude == == origin_longitude ==
  
-Required. An expression containing the longitude used as the origin of this geographic search. ​ If //​origin_longitude//​ produces a literal string, then that origin will be used for all rows.  If //​origin_longitude//​ is a column, then the origin longitude will be treated as that value for each row processed. ​ //​Origin_longitude//​ can also be a select statement, enclosed in parentheses,​ that retrieves a longitude in a single column and a single row.  Longitudes can be expressed using a FLOAT, DOUBLE, CHARACTER or STRING datatype. ​+Required. An expression containing the longitude used as the origin of this geographic search. ​ If //​origin_longitude//​ produces a literal string, then that origin will be used for all rows.  If //​origin_longitude//​ is a column, then the origin longitude will be treated as that value for each row processed. ​ //​Origin_longitude//​ can also be a select statement, enclosed in parentheses,​ that retrieves a longitude in a single column and a single row.  Longitudes can be expressed using a FLOAT, DOUBLE, CHARACTER or STRING datatype. ​
  
  
 == destination_latitude == == destination_latitude ==
  
-Required. An expression containing the latitude used as the destination of this geographic search. ​ If //​destination_latitude//​ produces a literal string, then that destination will be used for all rows.  If //​destination_latitude//​ is a column, then the destination latitude will be treated as that value for each row processed. ​ //​Origin_latitude//​ can also be a select statement, enclosed in parentheses,​ that retrieves a latitude in a single column and a single row.  Latitudes can be expressed using a FLOAT, DOUBLE, CHARACTER or STRING datatype. ​+Required. An expression containing the latitude used as the destination of this geographic search. ​ If //​destination_latitude//​ produces a literal string, then that destination will be used for all rows.  If //​destination_latitude//​ is a column, then the destination latitude will be treated as that value for each row processed. ​ //​Origin_latitude//​ can also be a select statement, enclosed in parentheses,​ that retrieves a latitude in a single column and a single row.  Latitudes can be expressed using a FLOAT, DOUBLE, CHARACTER or STRING datatype. ​
  
 == destination_longitude == == destination_longitude ==
  
-Required. An expression containing the longitude used as the destination of this geographic search. ​ If //​destination_longitude//​ produces a literal string, then that destination will be used for all rows.  If //​destination_longitude//​ is a column, then the destination longitude will be treated as that value for each row processed. ​ //​Origin_longitude//​ can also be a select statement, enclosed in parentheses,​ that retrieves a longitude in a single column and a single row.  Longitudes can be expressed using a FLOAT, DOUBLE, CHARACTER or STRING datatype. ​+Required. An expression containing the longitude used as the destination of this geographic search. ​ If //​destination_longitude//​ produces a literal string, then that destination will be used for all rows.  If //​destination_longitude//​ is a column, then the destination longitude will be treated as that value for each row processed. ​ //​Origin_longitude//​ can also be a select statement, enclosed in parentheses,​ that retrieves a longitude in a single column and a single row.  Longitudes can be expressed using a FLOAT, DOUBLE, CHARACTER or STRING datatype. ​
  
 == options == == options ==
Line 54: Line 54:
 == destination_select_statement == == destination_select_statement ==
  
-Optional. ​ A select statement that returns one or more rows containing first the latitude and then the longitude in two consecutive select-items. ​ These pairs of coordinates represent the destination(s) of the search. ​ Since //​destination_select_statement//​ can return multiple rows, this allows geographic radius searches requesting rows within a certain distance from a number of locations, such as stores or branch offices.+Optional. ​ A select statement that returns one or more rows containing first the latitude and then the longitude in two consecutive select-items. ​ These pairs of coordinates represent the destination(s) of the search. ​ Since //​destination_select_statement//​ can return multiple rows, this allows geographic radius searches requesting rows within a certain distance from a number of locations, such as stores or branch offices.  Note that for performance reasons, this select statement may not return more than 1,000 rows.
  
 ===== Example ===== ===== Example =====
 
Back to top
dev/sql/functions/distance.1280346706.txt.gz ยท Last modified: 2016/06/28 22:38 (external edit)