B Hive and Spark Spatial SQL Functions
To use these functions, you must understand the concepts and techniques described in whichever of the following apply to your needs:
-
Oracle Big Data Spatial Vector Hive Analysis, especially Using the Hive Spatial API,
-
Oracle Big Data Spatial Vector Analysis for Spark, especially Spatial Analysis Spark SQL UDFs
The functions are presented alphabetically. However, they can be grouped into the following logical categories: geometry constructors, single-geometry functions, and two-geometry functions.
Geometry constructors:
Single-geometry functions:
Two-geometry functions:
B.1 ST_AnyInteract
Format
ST_AnyInteract( geometry1 ST_Geometry, geometry1 ST_Geometry, tolerance NUMBER DEFAULT 0 (nongeodetic geometries) or 0.05 (geodetic geometries));
Description
Determines if geometry1
has any spatial interaction with geometry2
, returning true
or false
.
Parameters
Usage Notes
Both geometries must have the same number of dimensions (2 or 3) and the same spatial reference system (SRID, or coordinate system).
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_AnyInteract( ST_Point('{ "type": "Point", "coordinates": [2, 3]}', 8307), ST_Polygon('{"type": "Polygon","coordinates": [[[1, 2], [5, 2], [5, 6], [1, 6], [1, 2]]]}', 8307)) from hivetable LIMIT 1; -- return true
Parent topic: Hive and Spark Spatial SQL Functions
B.2 ST_Area
Format
ST_Area( geometry ST_Geometry tolerance NUMBER DEFAULT 0 (nongeodetic geometries) or 0.05 (geodetic geometries));
Description
Returns the area of a polygon or multipolygon geometry.
Parameters
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_Area(ST_Polygon('{"type": "Polygon","coordinates": [[[1, 2], [5, 2], [5, 7], [1, 7], [1, 2]]]}', 0)) from hivetable LIMIT 1; -- return 20
Parent topic: Hive and Spark Spatial SQL Functions
B.3 ST_AsWKB
Format
ST_AsWKB( geometry ST_Geometry);
Description
Returns the well-known binary (WKB) representation of the geometry.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_AsWKB( ST_Point('{ "type": "Point", "coordinates": [0, 5]}', 8307)) from hivetable LIMIT 1;
Parent topic: Hive and Spark Spatial SQL Functions
B.4 ST_AsWKT
Format
ST_AsWKT( geometry ST_Geometry);
Description
Returns the well-known text (WKT) representation of the geometry.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_AsWKT(ST_Point('{ "type": "Point", "coordinates": [0, 5]}', 8307)) from hivetable LIMIT 1;
Parent topic: Hive and Spark Spatial SQL Functions
B.5 ST_Buffer
Format
ST_Buffer( geometry ST_Geometry, bufferWidth NUMBER, arcTol NUMBER DEFAULT 0 (nongeodetic geometries) or 0.05 (geodetic geometries));
Description
Generates a new ST_Geometry object that is the buffered version of the input geometry.
Parameters
- geometry
-
Any 2D geometry object. If the geometry is geodetic, it is interpreted as longitude/latitude values in the WGS84 spatial reference system, and
bufferWidth
andtolerance
are interpreted as meters. - bufferWidth
-
The distance value used for the buffer.
- arcTol
-
Tolerance used for geodetic arc densification. (Ignored for nongeodetic geometries.)
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_Buffer(ST_Point('{ "type": "Point", "coordinates": [0, 5]}', 0), 3) from hivetable LIMIT 1; -- return {"type":"Polygon", "coordinates": [[[-3,5],[-2.8977774789,4.2235428647],[-2.5980762114,3.5],[-2.1213203436,2.8786796564],[-1.5,2.4019237886],[-0.7764571353,2.1022225211],[0,2],[0.7764571353,2.1022225211],[1.5,2.4019237886],[2.1213203436,2.8786796564],[2.5980762114,3.5],[2.8977774789,4.2235428647],[3,5],[2.8977774789,5.7764571353],[2.5980762114,6.5],[2.1213203436,7.1213203436],[1.5,7.5980762114],[0.7764571353,7.8977774789],[0,8],[-0.7764571353,7.8977774789],[-1.5,7.5980762114],[-2.1213203436,7.1213203436],[-2.5980762114,6.5],[-2.8977774789,5.7764571353],[-3,5]]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}
Parent topic: Hive and Spark Spatial SQL Functions
B.6 ST_Contains
Format
ST_Contains( geometry1 ST_Geometry, geometry1 ST_Geometry, tolerance NUMBER DEFAULT 0 (nongeodetic geometries) or 0.05 (geodetic geometries));
Description
Determines if geometry1
contains geometry2
, returning true
or false
.
Parameters
Usage Notes
Both geometries must have the same number of dimensions (2 or 3) and the same spatial reference system (SRID, or coordinate system).
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_Contains( ST_Polygon('{"type": "Polygon","coordinates": [[[1, 2], [5, 2], [5, 6], [1, 6], [1, 2]]]}', 8307), ST_Point('{ "type": "Point", "coordinates": [2, 3]}', 8307)) from hivetable LIMIT 1; -- return true
Parent topic: Hive and Spark Spatial SQL Functions
B.7 ST_ConvexHull
Format
ST_ConvexHull( geometry ST_Geometry);
Description
Returns the convex hull of the input geometry as an ST_Geometry object.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_ConvexHull( ST_MultiPoint(' { "type": "MultiPoint","coordinates": [ [1, 2], [-1, -2], [5, 6] ] }', 0)) from hivetable LIMIT 1; -- return {"type":"Polygon", "coordinates":[[[5,6],[1,2],[-1,-2],[5,6]]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}
Parent topic: Hive and Spark Spatial SQL Functions
B.8 ST_Distance
Format
ST_Distance( geometry1 ST_Geometry, geometry1 ST_Geometry, tolerance NUMBER DEFAULT 0 (nongeodetic geometries) or 0.05 (geodetic geometries));
Description
Determines the distance between two 2D geometries.
Parameters
Usage Notes
This function returns thedistance between the two given geometries. For projected data, the distance is in the same unit as the unit of projection. For geodetic data, the distance is in meters.
If an error occurs, the function returns -1.
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_Distance( ST_Point('{ "type": "Point", "coordinates": [0, 0]}', 0), ST_Point('{ "type": "Point", "coordinates": [6, 8]}', 0)) from hivetable LIMIT 1; -- return 10.0
Parent topic: Hive and Spark Spatial SQL Functions
B.9 ST_Envelope
Format
ST_Envelope( geometry ST_Geometry);
Description
Returns the envelope (bounding polygon) of the input geometry as an ST_Geometry object.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_Envelope( ST_MultiPoint(' { "type": "MultiPoint","coordinates": [ [1, 2], [-1, -2], [5, 6] ] }', 0)) from hivetable LIMIT 1; -- return {"type":"Polygon", "coordinates":[[[-1,-2],[5,-2],[5,6],[-1,6],[-1,-2]]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}
Parent topic: Hive and Spark Spatial SQL Functions
B.10 ST_Geometry
Format
ST_GEOMETRY( geometry STRING srid INT);
or
ST_GEOMETRY( geometry BINARY srid INT);
or
ST_GEOMETRY( geometry Object hiveRecordInfoProvider STRING);
Description
Creates a GeoJSON string representation of the geometry, and returns a GeoJSON string representation of the geometry.
Parameters
- geometry
-
To create a geometry from a GeoJSON or WKT string (first format): Geometry definition in GeoJSON or WKT format.
To create a geometry from a WKB object (second format): Geometry definition in WKB format.
To create a geometry using a Hive object (third format): Geometry definition in any Hive supported type.
- srid
- Spatial reference system (coordinate system) identifier.
- hiveRecordInfoProvider
- The fully qualified name of an implementation of the interface
oracle.spatial.hadoop.vector.hive.HiveRecordInfoProvider
to extract the geometry in GeoJSON format.The function format with the
hiveRecordInfoProvider
parameter does not apply to Spark spatial SQL functions.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
-- creates a point using GeoJSON select ST_Geometry (' { "type": "Point", "coordinates": [100.0, 0.0]}', 8307) from hivetable LIMIT 1; -- creates a point using WKT select ST_Geometry ('point(100.0 0.0)', 8307) from hivetable LIMIT 1; -- creates the geometries using a HiveRecordInfoProvider select ST_Geometry (geoColumn, ‘hive.samples.SampleHiveRecordInfoProviderImpl’) from hivetable;
Parent topic: Hive and Spark Spatial SQL Functions
B.11 ST_Inside
Format
ST_Inside( geometry1 ST_Geometry, geometry1 ST_Geometry, tolerance NUMBER DEFAULT 0 (nongeodetic geometries) or 0.05 (geodetic geometries));
Description
Determines if geometry1
is inside geometry2
, returning true
or false
.
Parameters
Usage Notes
Both geometries must have the same number of dimensions (2 or 3) and the same spatial reference system (SRID, or coordinate system).
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_Inside( ST_Point('{ "type": "Point", "coordinates": [2, 3]}', 8307), ST_Polygon('{"type": "Polygon","coordinates": [[[1, 2], [5, 2], [5, 6], [1, 6], [1, 2]]]}', 8307)) from hivetable LIMIT 1; -- return true
Parent topic: Hive and Spark Spatial SQL Functions
B.12 ST_Length
Format
ST_Length( geometry ST_Geometry tolerance NUMBER DEFAULT 0 (nongeodetic geometries) or 0.05 (geodetic geometries));
Description
Returns the length of a line or polygon geometry.
Parameters
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_Length(ST_Polygon('{"type": "Polygon","coordinates": [[[1, 2], [5, 2], [5, 6], [1, 6], [1, 2]]]}', 0)) from hivetable LIMIT 1; -- return 16
Parent topic: Hive and Spark Spatial SQL Functions
B.13 ST_LineString
Format
ST_LineString( geometry STRING srid INT);
or
ST_LineString( geometry BINARY srid INT);
or
ST_LineString( geometry Object hiveRecordInfoProvider STRING);
Description
Creates a line string geometry in GeoJSON format, and returns a GeoJSON string representation of the geometry.
Parameters
- geometry
-
To create a geometry from a GeoJSON or WKT string (first format): Geometry definition in GeoJSON or WKT format.
To create a geometry from a WKB object (second format): Geometry definition in WKB format.
To create a geometry using a Hive object (third format): Geometry definition in any Hive supported type.
- srid
- Spatial reference system (coordinate system) identifier.
- hiveRecordInfoProvider
- The fully qualified name of an implementation of the interface
oracle.spatial.hadoop.vector.hive.HiveRecordInfoProvider
to extract the geometry in GeoJSON format.The function format with the
hiveRecordInfoProvider
parameter does not apply to Spark spatial SQL functions.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
-- creates a line using GeoJSON select ST_LineString (' { "type": "LineString","coordinates": [ [100.0, 0.0], [101.0, 1.0] ]} ', 8307) from hivetable LIMIT 1; -- creates a line using WKT select ST_LineString (' linestring(1 1, 5 5, 10 10, 20 20)', 8307) from hivetable LIMIT 1; -- creates the lines using a HiveRecordInfoProvider select ST_LineString (geoColumn, ‘mypackage.hiveRecordInfoProviderImpl’) from hivetable;
Parent topic: Hive and Spark Spatial SQL Functions
B.14 ST_MultiLineString
Format
ST_MultiLineString( geometry STRING srid INT);
or
ST_MultiLineString( geometry BINARY srid INT);
or
ST_MultiLineString( geometry Object hiveRecordInfoProvider STRING);
Description
Creates a multiline string geometry in GeoJSON format, and returns a GeoJSON string representation of the geometry.
Parameters
- geometry
-
To create a geometry from a GeoJSON or WKT string (first format): Geometry definition in GeoJSON or WKT format.
To create a geometry from a WKB object (second format): Geometry definition in WKB format.
To create a geometry using a Hive object (third format): Geometry definition in any Hive supported type.
- srid
- Spatial reference system (coordinate system) identifier.
- hiveRecordInfoProvider
- The fully qualified name of an implementation of the interface
oracle.spatial.hadoop.vector.hive.HiveRecordInfoProvider
to extract the geometry in GeoJSON format.The function format with the
hiveRecordInfoProvider
parameter does not apply to Spark spatial SQL functions.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
-- creates a MultiLineString using GeoJSON select ST_ MultiLineString (' { "type": "MultiLineString","coordinates": [ [ [100.0, 0.0], [101.0, 1.0] ], [ [102.0, 2.0], [103.0, 3.0] ]] }', 8307) from hivetable LIMIT 1; -- creates a MultiLineString using WKT select ST_ MultiLineString ('multilinestring ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))', 8307) from hivetable LIMIT 1; -- creates MultiLineStrings using a HiveRecordInfoProvider select ST_ MultiLineString (geoColumn, ‘mypackage.hiveRecordInfoProviderImpl’) from hivetable;
Parent topic: Hive and Spark Spatial SQL Functions
B.15 ST_MultiPoint
Format
ST_MultiPoint( geometry STRING srid INT);
or
ST_MultiPoint( geometry BINARY srid INT);
or
ST_MultiPoint( geometry Object hiveRecordInfoProvider STRING);
Description
Creates a multipoint geometry in GeoJSON format, and returns a GeoJSON string representation of the geometry.
Parameters
- geometry
-
To create a geometry from a GeoJSON or WKT string (first format): Geometry definition in GeoJSON or WKT format.
To create a geometry from a WKB object (second format): Geometry definition in WKB format.
To create a geometry using a Hive object (third format): Geometry definition in any Hive supported type.
- srid
- Spatial reference system (coordinate system) identifier.
- hiveRecordInfoProvider
- The fully qualified name of an implementation of the interface
oracle.spatial.hadoop.vector.hive.HiveRecordInfoProvider
to extract the geometry in GeoJSON format.The function format with the
hiveRecordInfoProvider
parameter does not apply to Spark spatial SQL functions.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
-- creates a MultiPoint using GeoJSON select ST_MultiPoint (' { "type": "MultiPoint","coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }', 8307) from hivetable LIMIT 1; -- creates a MultiPoint using WKT select ST_ MultiPoint ('multipoint ((10 40), (40 30), (20 20), (30 10))', 8307) from hivetable LIMIT 1; -- creates MultiPoints using a HiveRecordInfoProvider select ST_ MultiPoint (geoColumn, ‘mypackage.hiveRecordInfoProviderImpl’) from hivetable;
Parent topic: Hive and Spark Spatial SQL Functions
B.16 ST_MultiPolygon
Format
ST_MultiPolygon( geometry STRING srid INT);
or
ST_MultiPolygon( geometry BINARY srid INT);
or
ST_MultiPolygon( geometry Object hiveRecordInfoProvider STRING);
Description
Creates a multipolygon geometry in GeoJSON format, and returns a GeoJSON string representation of the geometry.
Parameters
- geometry
-
To create a geometry from a GeoJSON or WKT string (first format): Geometry definition in GeoJSON or WKT format.
To create a geometry from a WKB object (second format): Geometry definition in WKB format.
To create a geometry using a Hive object (third format): Geometry definition in any Hive supported type.
- srid
- Spatial reference system (coordinate system) identifier.
- hiveRecordInfoProvider
- The fully qualified name of an implementation of the interface
oracle.spatial.hadoop.vector.hive.HiveRecordInfoProvider
to extract the geometry in GeoJSON format.The function format with the
hiveRecordInfoProvider
parameter does not apply to Spark spatial SQL functions.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
-- creates a MultiPolygon using GeoJSON select ST_ MultiPolygon (' { "type": "MultiPolygon","coordinates": [[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] ] }', 8307) from hivetable LIMIT 1; -- creates a MultiPolygon using WKT select ST_ MultiPolygon ('multipolygon(((30 20, 45 40, 10 40, 30 20)), ((15 5, 40 10, 10 20, 5 10, 15 5)))', 8307) from hivetable LIMIT 1; -- creates MultiPolygons using a HiveRecordInfoProvider select ST_ MultiPolygon (geoColumn, ‘mypackage.hiveRecordInfoProviderImpl’) from hivetable;
Parent topic: Hive and Spark Spatial SQL Functions
B.17 ST_Point
Format
ST_Point( geometry STRING srid INT);
or
ST_Point( geometry BINARY srid INT);
or
ST_Point( geometry Object hiveRecordInfoProvider STRING);
Description
Creates a point geometry in GeoJSON format, and returns a GeoJSON string representation of the geometry.
Parameters
- geometry
-
To create a geometry from a GeoJSON or WKT string (first format): Geometry definition in GeoJSON or WKT format.
To create a geometry from a WKB object (second format): Geometry definition in WKB format.
To create a geometry using a Hive object (third format): Geometry definition in any Hive supported type.
- srid
- Spatial reference system (coordinate system) identifier.
- hiveRecordInfoProvider
- The fully qualified name of an implementation of the interface
oracle.spatial.hadoop.vector.hive.HiveRecordInfoProvider
to extract the geometry in GeoJSON format.The format with the
hiveRecordInfoProvider
parameter does not apply to Spark spatial SQL functions.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
-- creates a point using GeoJSON select ST_Point (' { "type": "Point", "coordinates": [100.0, 0.0]}', 8307) from hivetable LIMIT 1; -- creates a point using WKT select ST_Point ('point(100.0 0.0)', 8307) from hivetable LIMIT 1; -- creates the points using a HiveRecordInfoProvider select ST_Point (geoColumn, ‘hive.samples.SampleHiveRecordInfoProviderImpl’) from hivetable;
Parent topic: Hive and Spark Spatial SQL Functions
B.18 ST_Polygon
Format
ST_Polygon( geometry STRING srid INT);
or
ST_Polygon( geometry BINARY srid INT);
or
ST_Polygon( geometry Object hiveRecordInfoProvider STRING);
Description
Creates a polygon geometry in GeoJSON format, and returns a GeoJSON string representation of the geometry.
Parameters
- geometry
-
To create a geometry from a GeoJSON or WKT string (first format): Geometry definition in GeoJSON or WKT format.
To create a geometry from a WKB object (second format): Geometry definition in WKB format.
To create a geometry using a Hive object (third format): Geometry definition in any Hive supported type.
- srid
- Spatial reference system (coordinate system) identifier.
- hiveRecordInfoProvider
- The fully qualified name of an implementation of the interface
oracle.spatial.hadoop.vector.hive.HiveRecordInfoProvider
to extract the geometry in GeoJSON format.The function format with the
hiveRecordInfoProvider
parameter does not apply to Spark spatial SQL functions.
Usage Notes
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
-- creates a polygon using GeoJSON select ST_Polygon (' { "type": "Polygon","coordinates": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]] }', 8307) from hivetable LIMIT 1; -- creates a polygon using WKT select ST_ Polygon ('polygon((0 0, 10 0, 10 10, 0 0))', 8307) from hivetable LIMIT 1; -- creates the polygons using a HiveRecordInfoProvider select ST_ Polygon (geoColumn, ‘mypackage.hiveRecordInfoProviderImpl’) from hivetable;
Parent topic: Hive and Spark Spatial SQL Functions
B.19 ST_Simplify
Format
ST_Simplify( geometry ST_Geometry, threshold NUMBER);
Description
Generates a new ST_Geometry object by simplifying the input geometry using the Douglas-Peucker algorithm.
Parameters
- geometry
-
Any 2D geometry object. If the geometry is geodetic, it is interpreted as longitude/latitude values in the WGS84 spatial reference system, and
bufferWidth
andtolerance
are interpreted as meters. - threshold
-
Threshold value to be used for the geometry simplification. Should be a positive number. (Zero causes the input geometry to be returned.) If the input geometry is geodetic, the value is the number of meters; if the input geometry is non-geodetic, the value is the number of units associated with the data.
As the threshold value is decreased, the generated geometry is likely to be closer to the input geometry; as the threshold value is increased, fewer vertices are likely to be in the returned geometry.
Usage Notes
Depending on the threshold value, a polygon can simplify into a line or a point, and a line can simplify into a point. Therefore, the output object should be checked for type, because the output geometry type might be different from the input geometry type.
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_Simplify( ST_POLYGON('{"type": "Polygon","coordinates": [[[1, 2], [1.01, 2.01], [5, 2], [5, 6], [1, 6], [1, 2]]]}', 0), 1) from hivetable LIMIT 1; -- return {"type":"Polygon", "coordinates":[[[1,2],[5,2],[5,6],[1,6],[1,2]]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}
Parent topic: Hive and Spark Spatial SQL Functions
B.20 ST_SimplifyVW
Format
ST_SimplifyVW( geometry ST_Geometry, threshold NUMBER);
Description
Generates a new ST_Geometry object by simplifying the input geometry using the Visvalingham-Whyatt algorithm.
Parameters
- geometry
-
Any 2D geometry object. If the geometry is geodetic, it is interpreted as longitude/latitude values in the WGS84 spatial reference system, and
bufferWidth
andtolerance
are interpreted as meters. - threshold
-
Threshold value to be used for the geometry simplification. Should be a positive number. (Zero causes the input geometry to be returned.) If the input geometry is geodetic, the value is the number of meters; if the input geometry is non-geodetic, the value is the number of units associated with the data.
As the threshold value is decreased, the generated geometry is likely to be closer to the input geometry; as the threshold value is increased, fewer vertices are likely to be in the returned geometry.
Usage Notes
Depending on the threshold value, a polygon can simplify into a line or a point, and a line can simplify into a point. Therefore, the output object should be checked for type, because the output geometry type might be different from the input geometry type.
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_SimplifyVW( ST_POLYGON('{"type": "Polygon","coordinates": [[[1, 2], [1.01, 2.01], [5, 2], [5, 6], [1, 6], [1, 2]]]}', 0), 50) from hivetable LIMIT 1; -- return {"type":"Polygon", "coordinates":[[[1,2],[5,6],[1,6],[1,2]]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}
Parent topic: Hive and Spark Spatial SQL Functions
B.21 ST_Volume
Format
ST_Volume( multipolygon ST_MultiPolygon, tolerance NUMBER DEFAULT 0 (nongeodetic geometries) or 0.05 (geodetic geometries));
Description
Returns the area of a multipolygon 3D geometry. The multipolygon is handled as a solid.
Parameters
Usage Notes
For projected data, the volume is in the same unit as the unit of projection. For geodetic data, the volume is in cubic meters.
Returns -1 in case of an error.
See also Oracle Big Data Spatial Vector Hive Analysis and Oracle Big Data Spatial Vector Analysis for Spark for conceptual and usage information.
Examples
select ST_Volume( ST_MultiPolygon (' { "type": "MultiPolygon", "coordinates": [[[[0, 0, 0], [0, 0, 1], [0, 1, 1], [0, 1, 0], [0, 0, 0]]], [[[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0], [0, 0, 0]]], [[[0, 0, 0], [1, 0, 0], [1, 0, 1], [0, 0, 1], [0, 0, 0]]], [[[1, 1, 0], [1, 1, 1], [1, 0, 1], [1, 0, 0], [1, 1, 0]]], [[[0, 1, 0], [0, 1, 1], [1, 1, 1], [1, 1, 0], [0, 1, 0]]], [[[0, 0, 1], [1, 0, 1], [1, 1, 1], [0, 1, 1], [0, 0, 1]]]]}', 0)) from hivetable LIMIT 1; -- return 1.0
Parent topic: Hive and Spark Spatial SQL Functions