Functions on GeoJson Data
The GeoJson specification defines the structure and content of JSON objects that are supposed to represent geographical shapes on earth (called geometries). The following functions interpret the JSON objects as geometries and allow the search for rows containing geometries that satisfy certain conditions.
For more information on the functions and examples, see Managing GeoJSON data in the Developers Guide.
boolean geo_intersect(any*, any*)
- Returns false if any operand returns 0 or more than 1 items.
- Returns NULL if any operand returns NULL.
- Returns false if any operand returns an item that is not a valid geometry object.
boolean geo_inside(any*, any*)
- Returns false if any operand returns 0 or more than 1 items.
- Returns NULL if any operand returns NULL.
- Returns false if any operand returns an item that is not a valid geometry object (however, if it can be detected at compile time that an operand will not return a valid geometry, an error is raised).
- Returns false if the second operand returns a geometry object that is not a polygon.
boolean geo_within_distance(any*, any*, double)
- Returns false if any of the first two operands returns 0 or more than 1 items.
- Returns NULL if any of the first two operands returns NULL.
- Returns false if any of the first two operands returns an item that is not a valid geometry object.
boolean geo_near(any*, any*, double)
geo_near is converted internally to geo_within_distance plus an (implicit) order-by the distance between the two geometries. However, if the query has an (explicit) order-by already, no ordering by distance is performed. The geo_near function can appear in the WHERE clause only, where it must be a top-level predicate, i.e, not nested under an OR or NOT operator.
double geo_distance(any*, any*)
- Returns -1 if any operand returns zero or more than 1 items.
- Returns NULL if any operand returns NULL.
- Returns -1 if any of the operands is not a geometry.
boolean geo_is_geometry(any*)
- Returns false if the operand returns zero or more than 1 items.
- Returns NULL if the operand returns NULL.
- Returns true if the input is a single valid geometry object. Otherwise, false.