A sequence of 2 or more points and the lines that connect them.
Ex: LINESTRING(0 0,1 1,1 2)
POLYGON:
A set of one or more rings (closed line strings), with the first representing the shape (external ring) and the rest representing holes in that shape (internal rings).
OmniSci supports SRIDs 4326 and 900913. You can specify the SRID of your geometry field when creating the table:
create table simple_geo (name text encoding dict(32), pt geometry(point,4326));
If you did not set the SRID of your geo field in the table, you need to set it in your SQL code. The following query uses ST _DISTANCE, sets the SRID to 4326, and casts the geospatial point field as a geography to return the distance in meters:
select
a.name,
st_distance(
cast(st_setsrid(a.pt,4326) as geography),
cast(st_setsrid(b.pt.4326) as geography)
) as dist_meters
from starting_point a, destination_points b;
Geospatial Literals
Geospatial functions that expect geospatial object arguments accept geospatial columns, geospatial objects returned by other functions, or string literals containing WKT representations of geospatial objects. Supplying a WKT string is equivalent to calling a geometry constructor. For example, these two queries are identical:
SELECT count() from geo1 where ST_Distance(p1, ‘POINT(1 2)’) < 1.0;
SELECT count() from geo1 where ST_Distance(p1, ST_GeomFromText(‘POINT(1 2)’));
Geospatial functions
Geometry/Geography Constructors
[x] ST_GeomFromText(WKT) - using literals
[x] ST_GeogFromText(WKT) - using literals
Geometry Editors
[ ] ST_Transform (Returns a new geometry with its coordinates transformed to a different spatial reference system.)
[ ] ST_SetSRID (Sets the SRID on a geometry to a particular integer value.)
Geometry Accessors
[x] ST_X (Return the X coordinate of the point, or NULL if not available. Input must be a point.)
[x] ST_Y (Return the Y coordinate of the point, or NULL if not available. Input must be a point.)
[x] ST_XMin (Returns Y minima of a bounding box 2d or 3d or a geometry.)
[x] ST_XMax (Returns X maxima of a bounding box 2d or 3d or a geometry.)
[x] ST_YMin (Returns Y minima of a bounding box 2d or 3d or a geometry.)
[x] ST_YMax (Returns Y maxima of a bounding box 2d or 3d or a geometry.)
[x] ST_StartPoint (Returns the first point of a LINESTRING geometry as a POINT or NULL if the input parameter is not a LINESTRING.)
[x] ST_EndPoint (Returns the last point of a LINESTRING geometry as a POINT or NULL if the input parameter is not a LINESTRING.)
[x] ST_PointN (Return the Nth point in a single linestring in the geometry. Negative values are counted backwards from the end of the LineString, so that -1 is the last point. Returns NULL if there is no linestring in the geometry.)
[x] ST_NPoints (Return the number of points in a geometry. Works for all geometries.)
[x] ST_NRings (If the geometry is a polygon or multi-polygon returns the number of rings. It counts the outer rings as well.)
[x] ST_SRID (Returns the spatial reference identifier for the ST_Geometry)
Geospatial Primitive Types
POINT:
LINESTRING:
POLYGON:
MULTIPOLYGON:
OmniSci supports SRIDs 4326 and 900913. You can specify the SRID of your geometry field when creating the table:
If you did not set the SRID of your geo field in the table, you need to set it in your SQL code. The following query uses ST _DISTANCE, sets the SRID to 4326, and casts the geospatial point field as a geography to return the distance in meters:
Geospatial Literals
Geospatial functions that expect geospatial object arguments accept geospatial columns, geospatial objects returned by other functions, or string literals containing WKT representations of geospatial objects. Supplying a WKT string is equivalent to calling a geometry constructor. For example, these two queries are identical:
SELECT count() from geo1 where ST_Distance(p1, ‘POINT(1 2)’) < 1.0; SELECT count() from geo1 where ST_Distance(p1, ST_GeomFromText(‘POINT(1 2)’));
Geospatial functions
References