Previous Next JavaScript must be enabled to correctly display this content

## Managing GeoJSON data

The GeoJson specification defines the structure and content of json objects that are supposed to represent geographical shapes on earth (called geometries).

According to the GeoJson specification, for a JSON object to be a geometry object it must have two fields called type and coordinates, where the value of the type field specifies the kind of geometry and the value of coordinates must be an array whose elements define the geometrical shape. See About GeoJSON Data for more details on the various types of geometry objects. All kinds of geometries are specified in terms of a set of positions. However, for line strings and polygons, the actual geometrical shape is formed by the lines connecting their positions. The GeoJson specification defines a line between two points as the straight line that connects the points in the (flat) cartesian coordinate system whose horizontal and vertical axes are the longitude and latitude, respectively. See Lines and Coordinate System for more details.

If you want to follow along with the examples, download the script geojsonschema_loaddata.sql and run it as shown below. This script creates the table used in the example and loads data into the table.

Start your KVSTORE or KVLite and open the SQL.shell.

    java -jar lib/kvstore.jar kvlite -secure-config disable
    java -jar lib/sql.jar -helper-hosts localhost:5000 -store kvstore

The `geojsonschema_loaddata.sql` contains the following:

    ### Begin Script ###
    load -file geoschema.ddl
    import -table PointsOfInterest  -file geoschema.json
    ### End Script ###

Using the `load` command, run the script.

    load -file geojsonschema_loaddata.sql

Oracle NoSQL Database implements a number of functions that interpret JSON objects as geometries and allow for the search for rows containing geometries that satisfy certain conditions.

- geo_inside
- geo_intersect
- geo_distance
- geo_within_distance
- geo_near
- geo_is_geometry