PostGIS pl/pgSQL Spatial Functions

$5.00 (inc. GST Australia)


A collection of PostGIS pl/pgSQL functions to enhance one’s use of PostGIS.

The documentation for these functions is available here.

DD2DMS — Returns string equivalent of decimal degree numeric value.
DMS2DD — Function computes a decimal degree floating point number from individual degrees, minutes and seconds values.
DMSS2DD — Function computes a decimal degree floating point number from individual degrees, minutes and seconds values encoded in supplied string.
ST_Append — Appends two linestrings not just start-end but end-start, start-start and end-end. Two versions one changes for point equivalence using a distance parameter the other compares point ordinate values.
ST_Average — Averages ordinates of 2 Points
ST_BearingBetweenPoints(geometry,geometry) — Returns a (Normalized) bearing in Degrees between two non-geodetic (XY) coordinates
ST_BearingBetweenPoints(numeric,numeric,numeric,numeric) — Returns a (Normalized) bearing in Degrees between two non-geodetic (XY) coordinates
ST_Chop — Splits a (multi)linestring into individual linestrings.
ST_CircularStringN — Extracts nominated 3-point circular string from a CIRCULARSTRING with more than 3 points.
ST_CurveN – Returns requested Curve within COMPOUNDCURVE
ST_Densify — Adds additional vertices to geometries defined by linestrings.
ST_Equals — Checks if all two points are equal by comparing ordinate values or by distance between points.
ST_Determine – Determines all possible spatial relations between two geometry instances.
ST_Explode — Extracts elements that described the supplied object; rings of polygons; circularstring/linestring from CompoundCurve
ST_Extend — Function which extends the supplied linestring required distance at its start/end or both.
ST_GridFromPoint — Computes a set (numTilesX/numTilesY) of tiles of size tilesSizeX/tileSizeY centred over p_point.
ST_GridFromXY — Covers supplied envelope (LL/UR) with a mesh of tiles of size TileSizeX and TileSizeY with optional rotation.
ST_GridGeometry — Computes a set of tiles (a grid) over the MBR of the supplied geometry.
ST_HasM – Determines if supplied geometry has M ordinates.
ST_HasZ – Determines if supplied geometry has Z ordinates.
ST_Hilbert — Function that generates a Hilbert number from the supplied grid inputs.
ST_Hilbert2Point — Function that generates a point at the Hilbert number created from the supplied grid inputs.
ST_InsideLine — Generates a line that is fitted inside a polygon.
ST_IsCollinear — Checks three points are collinear
ST_IsGeographicSrid — Checks p_srid to see if exists in sys.spatial_reference_systems table (which holds geodetic SRIDS)
ST_LineInsidePolygon — Generates line and clips to polygon returning part p_point is within
ST_MakeCircularString – Makes a 3 point circular arc from 3 supplied points
ST_Morton — Calculates the Morton number of a cell defined by input parameters.
ST_NormalizeBearing — Function ensures supplied bearing is between 0 and 360.
ST_NumCircularStrings – Compute number of 3-point circular strings within a CIRCULARSTRING with more than 3 points.
ST_NumCurves – Returned number of sub-objects within a COMPOUNDCURVE
ST_OneSidedBuffer — An attempt to create a buffer on one side of a line.
ST_PointFromBearingAndDistance — Returns a projected point given starting point as X and Y, a bearing in Degrees, and a distance (geometry SRID units).
ST_PointFromCOGO — Returns a projected point given starting point (geometry), a bearing in Degrees, and a distance (geometry SRID units).
ST_Reduce — Function that shortens the supplied linestring at either its start or end (p_end) the required length.
ST_Segmentize – Function that breaks linear geometry objects into single 2-point linestrings or 3-point CircularStrings.
ST_SmoothTile — Function that removes “steps” in vector data created by raster processing.
ST_ToGeography — Converts a geometry object to a geography.
ST_ToGeometry — Converts a geography object to a geometry.
random_between(numeric,numeric) — Randomly generates number in range defined by parameters.

Geography Wrappers

These functions are geography wrappers over existing PostGIS geometry functions.

The functions are stored in the public schema.

FUNCTION ST_AddMeasure(geography,float8,float8);
FUNCTION ST_AddPoint(geography,geography);
FUNCTION ST_AddPoint(geography,geography,integer);
FUNCTION ST_CoordDim(geography,geography);
FUNCTION ST_Dimension(geography);
FUNCTION ST_EndPoint(geography);
FUNCTION ST_ExteriorRing(geography);
FUNCTION ST_FlipCoordinates(geography);
FUNCTION ST_GeometryN(geography,integer);
FUNCTION ST_GeometryType(geography);
FUNCTION ST_InteriorRingN(geography,integer);
FUNCTION ST_IsClosed(geography);
FUNCTION ST_IsEmpty(geography);
FUNCTION ST_IsValid(geography);
FUNCTION ST_IsValid(geography,integer);
FUNCTION ST_IsValidDetail(geography);
FUNCTION ST_IsValidDetail(geography,integer);
FUNCTION ST_IsValidReason(geography);
FUNCTION ST_IsValidReason(geography,integer);
FUNCTION ST_M(geography);
FUNCTION ST_NPoints(geography);
FUNCTION ST_NumGeometries(geography);
FUNCTION ST_NumInteriorRings(geography);
FUNCTION ST_NumPoints(geography);
FUNCTION ST_PointN(geography,integer);
FUNCTION ST_Points(geography);
FUNCTION ST_RemovePoint(geography,integer);
FUNCTION ST_SetPoint(geography,integer,geography);
FUNCTION ST_StartPoint(geography);
FUNCTION ST_X(geography);
FUNCTION ST_Y(geography);
FUNCTION ST_Z(geography);


There are no reviews yet.

Be the first to review “PostGIS pl/pgSQL Spatial Functions”

Your email address will not be published. Required fields are marked *