GIS Functions
Geographic Information System (GIS) functions for geospatial data types.
GIS.POINT
Constructs a point using the supplied longitude and latitude.
SYNTAX
gis.point(lon, lat)
lon
- Type: double
- Description: longitude
lat
- Type: double
- Description: latitude
OUTPUT
{'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
EXAMPLE
SELECT gis.point(lon, lat) as geo
lon | lat | → | geo |
---|---|---|---|
-71.12109 | 42.37392 | {'point': [-71.12109, 42.37392]} | |
-0.09044 | 51.51819 | {'point': [-0.09044, 51.51819]} | |
null | 42.37392 | null | |
-0.09044 | null | null | |
null | null | null |
GIS.MULTI_POINT
Constructs a multiPoint using the supplied array of positions, each position should be given as an array of 2 Doubles
SYNTAX
gis.multi_point(multiPoint)
multiPoint
- Type: {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}
- Description: array of positions
OUTPUT
{'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
EXAMPLE
SELECT gis.multi_point(input) as geo
input | → | geo |
---|---|---|
[[-71.12109, 42.37392], [-0.09044, 51.51819]] | {'multiPoint': [[-71.12109, 42.37392], [-0.09044, 51.51819]]} | |
[[-71.12109, 42.37392]] | {'multiPoint': [[-71.12109, 42.37392]]} | |
[[-71.12109, 42.373929], null] | null | |
[[-71.12109, null], [-0.09044, 51.51819]] | null | |
[null, [-71.12109, 42.37392]] | null | |
[null, null] | null |
GIS.LINE_STRING
Constructs a lineString using the supplied array of positions, each position should be given as an array of 2 Doubles
SYNTAX
gis.line_string(lineString)
lineString
- Type: {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}
- Description: array of positions
OUTPUT
{'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
EXAMPLE
SELECT gis.line_string(input) as geo
input | → | geo |
---|---|---|
[[-71.12109, 42.37392], [-0.09044, 51.51819]] | {'lineString': [[-71.12109, 42.37392], [-0.09044, 51.51819]]} | |
[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]] | {'lineString': [[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]} | |
[[null, 42.37392], [-0.09044, 51.51819]] | null | |
[[-71.12109, null], [-0.09044, 51.51819]] | null | |
[[-71.12109, 42.37392], null] | null |
GIS.MULTI_LINE_STRING
Constructs a multiLineString using the supplied array of lineStrings
SYNTAX
gis.multi_line_string(multiLineString)
multiLineString
- Type: {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}
- Description: array of lineStrings
OUTPUT
{'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
EXAMPLE
SELECT gis.multi_line_string(input) as geo
input | → | geo |
---|---|---|
[[[-71.12109, 42.37392], [-0.09044, 51.51819]], [[-73.99332, 40.73897], [-122.34771, 37.58016]]] | {'multiLineString': [[[-71.12109, 42.37392], [-0.09044, 51.51819]], [[-73.99332, 40.73897], [-122.34771, 37.58016]]]} | |
[[[-71.12109, 42.37392], [-0.09044, 51.51819]], null] | null | |
[[[null, 42.37392], [-0.09044, 51.51819]], [[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]] | null | |
[[[-71.12109, null], [-0.09044, 51.51819]], [[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]] | null | |
[[[null, null], [-0.09044, 51.51819]], [[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]] | null |
GIS.POLYGON
Constructs a polygon using the supplied array of arrays of positions, the points must form a closed cycle
SYNTAX
gis.polygon(polygon)
polygon
- Type: {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}
- Description: array of lineStrings
OUTPUT
{'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
EXAMPLE
SELECT gis.polygon(input) as geo
input | → | geo |
---|---|---|
[[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]] | {'polygon': [[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]} | |
[[[-71.12109, 42.37392], [-73.99332, 40.73897], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]] | {'polygon': [[[-71.12109, 42.37392], [-73.99332, 40.73897], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]} | |
[[[-71.12109, 42.37392], [-122.34771, null], [-0.09044, 51.51819], [-71.12109, 42.37392]]] | null | |
[[[-71.12109, 42.37392], [null, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]] | null | |
[[[-71.12109, 42.37392], [null, null], [-0.09044, 51.51819], [-71.12109, 42.37392]]] | null | |
[[null, [-122.34770999999999, 37.58016], null, [-71.12109, 42.37392]]] | null |
GIS.MULTI_POLYGON
Constructs a multiPolygon using the supplied array of polygons.
SYNTAX
gis.multi_polygon(polygon)
polygon
- Type: {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}
- Description: array of polygons
OUTPUT
{'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
EXAMPLE
SELECT gis.multi_polygon(input) as geo
input | → | geo |
---|---|---|
[[[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]], [[[-71.12109, 42.37392], [-73.99332, 40.73897], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]] | {'multiPolygon': [[[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]], [[[-71.12109, 42.37392], [-73.99332, 40.73897], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]]} | |
[[[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]], null] | null | |
[[[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]], [[[null, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [null, null]]]] | null | |
[[[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]], [[[-71.12109, null], [-122.34771, 37.58016], [null, 51.51819], [-71.12109, 42.37392]]]] | null |
GIS.AREA
Computes the area of geospatial objects in square meters.
SYNTAX
gis.area(geometry)
geometry
- Type: {'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
- Description: the geospatial object
OUTPUT
double
EXAMPLE
SELECT gis.area(geo) as area
geo | → | area |
---|---|---|
{'point': [-71.12109, 42.37392]} | 0.0 | |
{'multiPoint': [[-71.12109, 42.37392], [-0.09044, 51.51819]]} | 0.0 | |
{'lineString': [[-71.12109, 42.37392], [-0.09044, 51.51819]]} | 0.0 | |
{'multiLineString': [[[-71.12109, 42.37392], [-0.09044, 51.51819]], [[-71.12109, 42.37392], [-122.34771, 37.58016]]]} | 0.0 | |
{'polygon': [[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]} | 10327580280709.47 | |
{'multiPolygon': [[[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]], [[[-71.12109, 42.37392], [-73.99332, 40.73897], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]]} | 21146702198308.133 |
GIS.CENTROID
Computes a point in degrees longitude and latitude representing the center of the supplied geospatial object.
SYNTAX
gis.centroid(geo)
geo
- Type: {'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
- Description: the geospatial object
OUTPUT
{'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
EXAMPLE
SELECT gis.centroid(geo) as centroid
geo | → | centroid |
---|---|---|
{'point': [-71.12109, 42.37392]} | {'point': [-71.12109, 42.37391999999999]} | |
{'multiPoint': [[-71.12109, 42.37392], [-0.09044, 51.51819]]} | {'point': [-39.10152000607361, 52.69688466499584]} | |
{'lineString': [[-71.12109, 42.37392], [-0.09044, 51.51819]]} | {'point': [-39.10152000607361, 52.69688466499584]} | |
{'multiLineString': [[[-71.12109, 42.37392], [-0.09044, 51.51819]], [[-71.12109, 42.37392], [-122.34771, 37.58016]]]} | {'point': [-69.39187404549496, 51.97025922215934]} | |
{'polygon': [[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]} | {'point': [-72.22351438117408, 54.5919087542993]} | |
{'multiPolygon': [[[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]], [[[-71.12109, 42.37392], [-73.99332, 40.73897], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]]} | {'point': [-72.84900918851707, 54.08981154383138]} |
GIS.GEOMETRY_ERROR
Tries to decode a field as a geospatial object. It returns null if the argument is valid, and the error message otherwise.
SYNTAX
gis.geometry_error(geo)
geo
- Type: {'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
- Description: the geospatial object
OUTPUT
string
EXAMPLE
SELECT gis.geometry_error(geo) as error
geo | → | error |
---|---|---|
null | null | |
{} | 'GeoDecodeException: Geometry struct must have exactly 1 non-null field, but found 0' | |
{'point': [-71.12109, 42.37392], 'multiPoint': [[-71.12109, 42.37392]]} | 'GeoDecodeException: Geometry struct must have exactly 1 non-null field, but found 2' | |
{'point': []} | 'GeoDecodeException: Position must have 2 or 3 coordinates, but found 0' | |
{'point': [null, 0.0]} | 'GeoDecodeException: The first position coordinate must be non-null' | |
{'point': [0.0, null]} | 'GeoDecodeException: The second position coordinate must be non-null' | |
{'point': [181.0, 0.0]} | 'GeoDecodeException: Longitude must be between -180 and 180 degrees, but found 181.0' | |
{'point': [0.0, 91.0]} | 'GeoDecodeException: Latitude must be between -90 and 90 degrees, but found 91.0' | |
{'multiPoint': []} | 'IllegalArgumentException: Multi-geometries must contain at least one input geometry' | |
{'multiPoint': [null]} | 'GeoDecodeException: Inner lists must not contain null' | |
{'lineString': [[-71.12109, 42.37392]]} | 'IllegalArgumentException: A line string has to contain at least two positions. Found positions are [PositionLongLat{longitude=-1.2412971881072137, latitude=0.7395644209766755}].' | |
{'polygon': []} | 'IllegalArgumentException: Exterior ring is not found.' | |
{'polygon': [[]]} | 'IllegalArgumentException: Cannot have less than 3 positions in a ring. Found positions are [].' |
GIS.PERIMETER
Computes the total length in meters of all line segments in a geospatial object. Point and multi-points have a perimeter of zero. For polygons and multi-polygons, the perimeter includes the segments of the interior rings, as well as those of the exterior rings.
SYNTAX
gis.perimeter(geo)
geo
- Type: {'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
- Description: the geospatial object
OUTPUT
double
EXAMPLE
SELECT gis.perimeter(geo) as perimeter
geo | → | perimeter |
---|---|---|
{'point': [-71.12109, 42.37392]} | 0.0 | |
{'multiPoint': [[-71.12109, 42.37392], [-0.09044, 51.51819]]} | 0.0 | |
{'lineString': [[-71.12109, 42.37392], [-0.09044, 51.51819]]} | 5269410.74226513 | |
{'multiLineString': [[[-71.12109, 42.37392], [-0.09044, 51.51819]], [[-71.12109, 42.37392], [-122.34771, 37.58016]]]} | 9600626.05565118 | |
{'polygon': [[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]} | 18232796.4197822 | |
{'multiPolygon': [[[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]], [[[-71.12109, 42.37392], [-73.99332, 40.73897], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]]} | 36565745.70318055 |
GIS.RELOCATE_TO_ORIGIN
Relocates the given geospatial object such that the center is at 0 degrees longitude, 0 degrees latitude.
SYNTAX
gis.relocate_to_origin(geo)
geo
- Type: {'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
- Description: the geospatial object
OUTPUT
{'type': 'record', 'fullySpecified': True, 'fields': [{'name': 'point', 'type': {'type': 'array', 'elementType': 'double'}}, {'name': 'multiPoint', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'lineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}, {'name': 'multiLineString', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'polygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}, {'name': 'multiPolygon', 'type': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': {'type': 'array', 'elementType': 'double'}}}}}]}
EXAMPLE
SELECT gis.relocate_to_origin(geo) as relocated
geo | → | relocated |
---|---|---|
{'point': [-71.12109, 42.37392]} | {'point': [-0.0, 0.0]} | |
{'multiPoint': [[-71.12109, 42.37392], [-0.09044, 51.51819]]} | {'multiPoint': [[-23.159189364951295, -5.151924764987099], [23.159189364951295, 5.151924764987099]]} | |
{'lineString': [[-71.12109, 42.37392], [-0.09044, 51.51819]]} | {'lineString': [[-23.159189364951295, -5.151924764987099], [23.159189364951295, 5.151924764987099]]} | |
{'multiLineString': [[[-71.12109, 42.37392], [-0.09044, 51.51819]], [[-71.12109, 42.37392], [-122.34771, 37.58016]]]} | {'multiLineString': [[[-0.9838272008140787, -9.625759823754697], [36.65714604255592, 19.074057915502816]], [[-0.9838272008140787, -9.625759823754697], [-39.656420455744026, -1.360436107390433]]]} | |
{'polygon': [[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]} | {'polygon': [[[0.7798447126797393, -12.268355901581819], [-37.53365543632313, -3.957733861898786], [38.2818165715597, 16.350424908443067], [0.7798447126797393, -12.268355901581819]]]} | |
{'multiPolygon': [[[[-71.12109, 42.37392], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]], [[[-71.12109, 42.37392], [-73.99332, 40.73897], [-122.34771, 37.58016], [-0.09044, 51.51819], [-71.12109, 42.37392]]]]} | {'multiPolygon': [[[[1.2039312886523057, -11.766906209372387], [-37.09581596622342, -3.8809686608924236], [38.67944159412384, 16.6434499031423], [1.2039312886523057, -11.766906209372387]]], [[[1.2039312886523057, -11.766906209372387], [-1.004360817519001, -13.412434219781353], [-37.09581596622342, -3.8809686608924236], [38.67944159412384, 16.6434499031423], [1.2039312886523057, -11.766906209372387]]]]} |
Updated 8 months ago