com.ulocate.api.geo
Class GeoSearch

java.lang.Object
  extended by com.ulocate.api.geo.GeoSearch

public class GeoSearch
extends java.lang.Object

GeoSearch provides functions for local search. This class is intended to be used by developers unfamiliar with spatial data and spatial queries who want to write local search applications/widgets.
The tables to be queried must contain columns for latitude and longitude in decimal degrees and a minimum of one more column. We recommend to create indexes for the latitude and longitude columns.
The search functions of this class are written for quick development and are not high performance. If you have very large tables these search functions might take a bit of time.
Use GeoCalc for unit of measurements and distance calculations.

Version:
0.2
Author:
uLocate Communications, © 2007

Constructor Summary
GeoSearch()
           
 
Method Summary
 java.lang.String getWithinDistanceSQL_Accurate(double longitude, double latitude, double searchDistance, double uom, java.lang.String colReturn, java.lang.String table, java.lang.String colLongitude, java.lang.String colLatitude, java.lang.String customSQL, int offset, int rows)
          This function creates a string of a SQL statement.
 java.lang.String getWithinDistanceSQL_Approximate(double longitude, double latitude, double searchDistance, double uom, java.lang.String colReturn, java.lang.String table, java.lang.String colLongitude, java.lang.String colLatitude, java.lang.String customSQL, int offset, int rows)
          This function creates a string of a SQL statement.
 java.lang.String getWithinDistanceSQL_Mix(double longitude, double latitude, double searchDistance, double uom, java.lang.String colReturn, java.lang.String table, java.lang.String colLongitude, java.lang.String colLatitude, java.lang.String customSQL, int offset, int rows)
          This function creates a string of a SQL statement.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeoSearch

public GeoSearch()
Method Detail

getWithinDistanceSQL_Accurate

public java.lang.String getWithinDistanceSQL_Accurate(double longitude,
                                                      double latitude,
                                                      double searchDistance,
                                                      double uom,
                                                      java.lang.String colReturn,
                                                      java.lang.String table,
                                                      java.lang.String colLongitude,
                                                      java.lang.String colLatitude,
                                                      java.lang.String customSQL,
                                                      int offset,
                                                      int rows)
This function creates a string of a SQL statement.
The returned distances as well as the distances used in the proximity search
(i.e., to check if a point is within the specified distance) are calculated
accurately. This is function will execute slower than the other 'approximate'
and 'mix' function.

Parameters:
longitude - Longitude of the search center.
latitude - Latitude of the search center.
searchDistance - Search distance.
uom - Unit of measurement for the search distance and the calculated distances.
colReturn - The columns to select. Must have at least one column!
table - The table containing the points.
colLongitude - The column containing the longitude values.
colLatitude - The column containing the latitude values.
customSQL - Additinal SQL statement for the where clause. For example: "name LIKE '%Starbucks%' OR category = 'Coffee Shops'".
offset - Offset for pageing. Set to -1 for no limit.
rows - Number of rows to be returned.
Returns:
Returns a string of the SQL statement.

getWithinDistanceSQL_Approximate

public java.lang.String getWithinDistanceSQL_Approximate(double longitude,
                                                         double latitude,
                                                         double searchDistance,
                                                         double uom,
                                                         java.lang.String colReturn,
                                                         java.lang.String table,
                                                         java.lang.String colLongitude,
                                                         java.lang.String colLatitude,
                                                         java.lang.String customSQL,
                                                         int offset,
                                                         int rows)
This function creates a string of a SQL statement.
Distances are approximate for faster execution.

Parameters:
longitude - Longitude of the search center.
latitude - Latitude of the search center.
searchDistance - Search distance.
uom - Unit of measurement for the search distance and the calculated distances.
colReturn - The columns to select. Must have at least one column!
table - The table containing the points.
colLongitude - The column containing the longitude values.
colLatitude - The column containing the latitude values.
customSQL - Additinal SQL statement for the where clause. For example: "name LIKE '%Starbucks%' OR category = 'Coffee Shops'".
offset - Offset for pageing. Set to -1 for no limit.
rows - Number of rows to be returned.
Returns:
Returns a string of the SQL statement.

getWithinDistanceSQL_Mix

public java.lang.String getWithinDistanceSQL_Mix(double longitude,
                                                 double latitude,
                                                 double searchDistance,
                                                 double uom,
                                                 java.lang.String colReturn,
                                                 java.lang.String table,
                                                 java.lang.String colLongitude,
                                                 java.lang.String colLatitude,
                                                 java.lang.String customSQL,
                                                 int offset,
                                                 int rows)
This function creates a string of a SQL statement.
The returned distances are calcualted accurately but the distance used in the
proximity search (i.e., to check if a point is within the specified distance)
are approximations for faster execution.

Parameters:
longitude - Longitude of the search center.
latitude - Latitude of the search center.
searchDistance - Search distance.
uom - Unit of measurement for the search distance and the calculated distances.
colReturn - The columns to select. Must have at least one column!
table - The table containing the points.
colLongitude - The column containing the longitude values.
colLatitude - The column containing the latitude values.
customSQL - Additinal SQL statement for the where clause. For example: "name LIKE '%Starbucks%' OR category = 'Coffee Shops'".
offset - Offset for pageing. Set to -1 for no limit.
rows - Number of rows to be returned.
Returns:
Returns a string of the SQL statement.