Previous Next JavaScript must be enabled to correctly display this content

## Searching GeoJSON Data

The Oracle NoSQL Database has the following functions to use for searching GeoJSON data that has some relationship with a search geometry.

- `boolean geo_intersect(any*, any*)`

- `boolean geo_inside(any*, any*)`

- `boolean geo_within_distance(any*, any*, double)`

- `boolean geo_near(any*, any*, double)`

In addition to the search functions, two other functions are available, and listed as the last two rows of the table:

Function | Type | Details
--- | --- | ---
`geo_intersect(any*, any*)` | boolean | Raises an error at compile time if the function can detect that any operand will not return a single valid GeoJson object. Otherwise, the runtime behavior is as follows: 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 GeoJson object. Finally, if both operands return a single GeoJson object, returns true if the two geometries have any points in common. Otherwise, returns false.
`geo_inside(any*, any*)` | boolean | Raises an error at compile time if the function can detect that any operand will not return a single valid GeoJson object. Otherwise, the runtime behavior is as follows: Returns false if any operand returns 0 or more than 1 item. Returns NULL if any operand returns NULL. Returns false if any operand returns an item that is not a valid GeoJson object. Finally, if both operands return a single GeoJson object and the second GeoJson is a polygon, the function returns true if the first geometry is completely contained inside the second polygon, with all of its points belonging to the interior of the polygon. The interior of a polygon is all the points in the polygon, except the points of the linear rings that define the polygon’s boundary. Otherwise, returns false.
`geo_within_distance(any*, any*, double)` | boolean | Raises an error at compile time if the function detects that the first two operands will not return a single valid GeoJson object. Otherwise, the runtime behavior is as follows: Returns false if any of the first two operands returns 0 or more than 1 item. 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 GeoJson object. Finally, if both of the first two operands return a single GeoJson object, the function returns true if the first geometry is within a distance of N meters from the second geometry, where N is the number returned by the third operand. The distance between 2 geometries is defined as the minimum among the distances of any pair of points where the first point belongs to the first geometry, and the second point to the second geometry. Otherwise, returns false.
`geo_near(any*, any*, double)` | boolean | The `geo_near` funcion is converted internally to a `geo_within_distance` function, with an an (implicit) order by the distance between the two geometries. However, if the query has an (explicit) order-by already, the function performs no ordering by distance. The `geo_near` function can appear only in the WHERE clause, and must be a top-level predicate. The `geo_near` function cannot be nested under an OR or NOT operator.
`geo_distance(any*, any*)` | double | Raises an error at compile time if the function detects that an operand will not return a single valid GeoJson object. Otherwise, the runtime behavior is as follows: Returns -1 if any of the operands returns zero or more than 1 item. Returns -1 if any of the operands is not a geometry. Returns NULL if any operand returns NULL. Otherwise the function returns the geodetic distance between the 2 input geometries. The returned distance is the minimum among the distances of any pair of points, where the first point belongs to the first geometry and the second point to the second geometry. Between two such points, their distance is the length of the geodetic line that connects the points.
`geo_is_geometry(any*)` | boolean | Returns false if an operand returns zero or more than 1 item. Returns NULL if an operand returns NULL. Returns true if the input is a single valid GeoJson object. Otherwise, false.