Mathematical functions for temporal types
Bounding box functions for temporal types
Bounding box functions for set and span types
Bounding box functions for box types
Spatial functions for temporal points
Aggregate functions for set and span types
Conversion functions for set and span types
Accessor functions for set and span types
Input/output functions for set and span types
Constructor functions for set and span types
Transformation functions for set and span types
Return a valid SRID from an arbitrary integer
Raises a notice if what comes out is different from
what went in.
Raises an error if SRID value is out of bounds.
Convert a char into a human readable hex digit
Distance functions for set and span types
Distance functions for temporal types
Transformation functions for temporal types
Conversion functions for box types
Constructor functions for box types
Return #LW_TRUE if the first #GBOX contains the second on the 2d plane, #LW_FALSE otherwise.
Return true if the point is inside the gbox
Return a copy of the #GBOX, based on dimensionality of flags.
Copy the values of original #GBOX into duplicate.
Move the box minimums down and the maximums up by the distance provided.
Move the box minimums down and the maximums up by the distances provided.
Round given GBOX to float boundaries
Warning, do not use this function, it is very particular about inputs.
Return a sortable key based on the center point of the GBOX.
Zero out all the entries in the #GBOX. Useful for cleaning
statically allocated gboxes.
Initialize a #GBOX using the values of the point.
Return false if any of the dimensions is NaN or infinite
Update the merged #GBOX to be large enough to include itself and the new box.
Update the #GBOX to be large enough to include itself and the new point.
Create a new gbox with the dimensionality indicated by the flags. Caller
is responsible for freeing.
Return #LW_TRUE if the #GBOX overlaps, #LW_FALSE otherwise.
Return #LW_TRUE if the #GBOX overlaps on the 2d plane, #LW_FALSE otherwise.
Calculate a spherical point that falls outside the geocentric gbox
Check if 2 given Gbox are the same
Check if 2 given GBOX are the same in x and y
Check if two given GBOX are the same in x and y, or would round to the same
GBOX in x and if serialized in GSERIALIZED
Return the number of bytes necessary to hold a #GBOX of this dimension in
serialized form.
Allocate a string representation of the #GBOX, based on dimensionality of flags.
Update the output #GBOX to be large enough to include both inputs.
Utility function to get type number from string. For example, a string ‘POINTZ’
would return type of 1 and z of 1 and m of 0. Valid
Return -1 if g1 is “less than” g2, 1 if g1 is “greater than”
g2 and 0 if g1 and g2 are the “same”. Equality is evaluated
with a memcmp and size check. So it is possible that two
identical objects where one lacks a bounding box could be
evaluated as non-equal initially. Greater and less than
are evaluated by calculating a sortable key from the center
point of the object bounds.
Remove the bounding box from a #GSERIALIZED. Returns a freshly
allocated #GSERIALIZED every time.
Pull a #GBOX from the header of a #GSERIALIZED, if one is available. If
it is not, return LW_FAILURE.
Allocate a new #GSERIALIZED from an #LWGEOM. For all non-point types, a bounding
box will be calculated and embedded in the serialization. The geodetic flag is used
to control the box calculation (cartesian or geocentric). If set, the size pointer
will contain the size of the final output, which is useful for setting the PgSQL
VARSIZE information.
Access to the float bounding box, if there is one.
NULL if there is not.
Pull a #GBOX from the header of a #GSERIALIZED, if one is available. If
it is not, calculate it from the geometry. If that doesn’t work (null
or empty) return LW_FAILURE.
Read standard lwflags from gserialized
Return a sortable key based on gserialized.
Extract the SRID from the serialized form (it is packed into
three bytes so this is a handy function).
Extract the geometry type from the serialized form (it hides in
the anonymous data area, so this is a handy function).
Return the serialization version
Check if a #GSERIALIZED has a bounding box without deserializing first.
Check if a #GSERIALIZED has an M ordinate.
Check if a #GSERIALIZED has a Z ordinate.
Returns a hash code for the srid/type/geometry information
in the GSERIALIZED. Ignores metadata like flags and optional
boxes, etc.
Check if a #GSERIALIZED is empty without deserializing first.
Only checks if the number of elements of the parent geometry
is zero, will not catch collections of empty, eg:
GEOMETRYCOLLECTION(POINT EMPTY)
Check if a #GSERIALIZED is a geography.
Returns the size in bytes to read from toast to get the basic
information from a geometry: GSERIALIZED struct, bbox and type
Return the number of dimensions (2, 3, 4) in a geometry
Pull the first point values of a #GSERIALIZED. Only works for POINTTYPE
Copy a new bounding box into an existing gserialized.
If necessary a new #GSERIALIZED will be allocated. Test
that input != output before freeing input.
Write the SRID into the serialized form (it is packed into
three bytes so this is a handy function).
Set functions for set and span types
LWMULTIx and LWCOLLECTION functions
LWGEOM functions
Add a component, allocating extra space if necessary. The compoundcurve
takes owership of the passed geometry.
Construct an equivalent compound curve from a linestring.
Compound curves can have linear components, so this works fine
@param geom input geometry
@param tol tolerance, semantic driven by tolerance_type
@param type see LW_LINEARIZE_TOLERANCE_TYPE
@param flags bitwise OR of operational flags, see LW_LINEARIZE_FLAGS
Add a ring, allocating extra space if necessary. The curvepolygon takes
ownership of the passed point array.
Construct an equivalent curve polygon from a polygon. Curve polygons
can have linear rings as their rings, so this works fine (in theory?)
Construct a new flags bitmask.
Compute a bbox if not already computed
Compute a box for geom and all sub-geometries, if not already computed
Calculate the geodetic area of a lwgeom on the sphere. The result
will be multiplied by the average radius of the supplied spheroid.
Calculate the geodetic area of a lwgeom on the spheroid. The result
will have the squared units of the spheroid axes.
Calculate the bearing between two points on a spheroid.
Take a geometry and return an areal geometry
(Polygon or MultiPolygon).
Actually a wrapper around GEOSpolygonize,
transforming the resulting collection into
a valid polygon Geometry.
Calculate bounding box of a geometry, automatically taking into account
whether it is cartesian or geodetic.
Calculate the 2-4D bounding box of a geometry. Z/M coordinates are honored
for this calculation, though for curves they are not included in calculations
of curvature.
Calculate the geodetic bounding box for an LWGEOM. Z/M coordinates are
ignored for this calculation. Pass in non-null, geodetic bounding box for function
to fill out. LWGEOM must have been built from a GSERIALIZED to provide
double aligned point arrays.
Cancel any interruption request
Check that coordinates of LWGEOM are all within the geodetic range (-180, -90, 180, 90)
Given a geometry clip based on the from/to range of one of its ordinates (x, y, z, m). Use for m- and z- clipping.
@brief Clone LWGEOM object. Serialized point lists are not copied.
Deep clone an LWGEOM, everything is copied
Take a list of LWGEOMs and a number of clusters and return an integer
array indicating which cluster each geometry is in.
Count the total number of rings in any #LWGEOM. Multipolygons
and other collections get counted, not the same as OGC st_numrings.
Count the total number of vertices in any #LWGEOM.
Calculate covers predicate for two lwgeoms on the sphere. Currently
only handles point-in-polygon.
Is the closest point of approach within a distance ?
Take vertices of a geometry and build a delaunay
triangulation on them.
Return the dimensionality (relating to point/line/poly) of an lwgeom
Calculate the geodetic distance from lwgeom1 to lwgeom2 on the spheroid.
A spheroid with major axis == minor axis will be treated as a sphere.
Pass in a tolerance in spheroid units.
Call this function to drop BBOX and SRID
from LWGEOM. If LWGEOM type is not flagged
with the HASBBOX flag and has a bbox, it
will be released.
@param opts output options bitfield, see LW_GML macros for meaning
Strip out the Z/M components of an #LWGEOM
Force coordinates of LWGEOM into geodetic range (-180, -90, 180, 90)
Create an LWGEOM object from an Encoded Polyline representation
Create an LWGEOM object from a GeoJSON representation
Allocate a new #LWGEOM from a #GSERIALIZED. The resulting #LWGEOM will have coordinates
that are double aligned and suitable for direct reading using getPoint2d_cp
@param check parser check flags, see LW_PARSER_CHECK_* macros
@param twkb Input twkb buffer
@param twkb_size parser check flags, see LW_PARSER_CHECK_* macros
@param check parser check flags, see LW_PARSER_CHECK_* macros
@param wkb_size length of WKB byte buffer
@param wkb WKB byte buffer
@param check parser check flags, see LW_PARSER_CHECK_* macros
@param wkt WKT string
@param check parser check flags, see LW_PARSER_CHECK_* macros
Calculate the GeoHash (http://geohash.org) string for a geometry. Caller must free.
Convert an LWGEOM to a GEOS Geometry and convert back – for debug only
Return GEOS version string (not to be freed)
Get a non-empty geometry bounding box, computing and
caching it if not already there
Return SRID number
Geometry includes at least one actual circular arc
Return #LW_TRUE if geometry has M ordinates.
Return true or false depending on whether a geometry has
a valid SRID set.
Return #LW_TRUE if geometry has Z ordinates
Find the measure value at the location on the line closest to the point.
Ensure the outer ring is clockwise oriented and all inner rings
are counter-clockwise.
Return true or false depending on whether a geometry is a linear
feature that closes on itself.
Determine whether a LWGEOM can contain sub-geometries or not
Return #LW_TRUE if geometry has SOLID flag.
Return LW_TRUE or LW_FALSE depending on whether or not a geometry is
a linestring with measure value growing from start to end vertex
Check if a LWGEOM has any non-finite (NaN or Inf) coordinates.
Calculate the geodetic length of a lwgeom on the unit sphere. The result
will have to by multiplied by the real radius to get the real length.
Determine the location(s) along a measured line where m occurs and
return as a multipoint. Offset to left (positive) or right (negative).
Determine the segments along a measured line that fall within the m-range
given. Return as a multiline or geometrycollection.
Offset to left (positive) or right (negative).
Attempts to make an invalid geometries valid w/out losing points.
Return the number of dimensions (2, 3, 4) in a geometry
@brief Check whether or not a lwgeom is big enough to warrant a bounding box.
Gently move coordinates of LWGEOM if they are close enough into geodetic range.
Calculate the location of a point on a spheroid, give a start point, bearing and distance.
Calculate the location of a point on a spheroid, give a start point, end point and distance.
Drop current bbox and calculate a fresh one.
Request interruption of any running code
READ/WRITE FUNCTIONS
Derive a new geometry with vertices added to ensure no vertex is more
than max_seg_length (in radians) from any other vertex.
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists
Install custom memory management and error handling functions you want your
application to use.
@ingroup system
@todo take a structure ?
Set the SRID on an LWGEOM
For collections, only the parent gets an SRID, all
the children get SRID_UNKNOWN.
Simplification
Snap vertices and segments of a geometry to another using a given tolerance.
Convert type with arcs into equivalent linearized type
Swap ordinate values in every vertex of the geometry.
Find the time of closest point of approach
@param lwgeom geometry to convert to EWKT
@param geom geometry to convert to HEXWKB
@param variant output format to use
(WKB_ISO, WKB_SFSQL, WKB_EXTENDED, WKB_NDR, WKB_XDR)
@param size_out (Out parameter) size of the buffer
@param geom input geometry
@param variant what variations on TWKB are requested?
@param twkb_size returns the length of the output TWKB in bytes if set
@param geom geometry to convert to WKB
@param variant output format to use
(WKB_ISO, WKB_SFSQL, WKB_EXTENDED, WKB_NDR, WKB_XDR)
@param geom geometry to convert to WKT
@param variant output format to use (WKT_ISO, WKT_SFSQL, WKT_EXTENDED)
@param precision Double precision
@param size_out (Out parameter) size of the buffer
@param geom geometry to convert to WKT
@param variant output format to use (WKT_ISO, WKT_SFSQL, WKT_EXTENDED)
@param precision Double precision
Transform (reproject) a geometry in-place.
@param geom the geometry to transform
@param pj the transformation
PROJ4-dependent extra functions on LWGEOM
Transform (reproject) a geometry in-place using a PROJ pipeline.
@param geom the geometry to transform
@param pipeline the coordinate operation pipeline string. Either:
- urn:ogc:def:coordinateOperation:AUTHORITY::CODE
- a PROJ pipeline string: +proj=pipeline ...
- concatenated operations: urn:ogc:def:coordinateOperation,coordinateOperation:EPSG::3895,coordinateOperation:EPSG::1618
@param is_forward whether to execute the pipeline in a forward or inverse
direction.
Trim the bits of an LWGEOM in place, to optimize it for compression.
Sets all bits to zero that are not required to maintain a specified
number of digits after the decimal point. Negative precision values
indicate digits before the decimal point do not need to be preserved.
Geometry type is one of the potentially “arc containing”
types (circstring, multicurve, etc) but does not necessarily
contain an actual arc.
Convert linearized type into arc type, de-linearizing the
strokes where possible.
Return lwgeom version string (not to be freed)
Take vertices of a geometry and build the Voronoi diagram
@brief wrap geometry on given cut x value
Add a LWPOINT to an LWLINE
Given two lines, characterize how (and if) they cross each other
Extend the ends of a line
Interpolate one point along a line in 3D
Interpolate one or more points along a line
Add a measure dimension to a line, interpolating linearly from the start
to the end value.
Create a new LWPOINTITERATOR over supplied LWGEOM*
Create a new LWPOINTITERATOR over supplied LWGEOM*
Supports modification of coordinates during iteration.
Free all memory associated with the iterator
Returns LW_TRUE if there is another point available in the iterator.
Attempts to replace the next point int the iterator with p, and advances
the iterator to the next point.
Returns LW_SUCCESS if the assignment was successful, LW_FAILURE otherwise.
Attempts to assign the next point in the iterator to p, and advances
the iterator to the next point. If p is NULL, the iterator will be
advanced without reading a point.
Returns LW_SUCCESS if the assignment was successful, LW_FAILURE otherwise.
Attempts to assigns the next point in the iterator to p. Does not advance.
Returns LW_SUCCESS if the assignment was successful, LW_FAILURE otherwise.
Add a ring, allocating extra space if necessary. The polygon takes
ownership of the passed point array.
Allocate a new LWPROJ containing the reference to the PROJ’s PJ
If extra_geography_data is true, it will generate the following values for
the source srs: is_latlong (geometric or not) and spheroid values
Allocate a new LWPROJ containing the reference to the PROJ’s PJ using a
PROJ pipeline definition:
@param str_pipeline the coordinate operation pipeline string. Either:
- urn:ogc:def:coordinateOperation:AUTHORITY::CODE
- a PROJ pipeline: +proj=pipeline ...
- concatenated operations: urn:ogc:def:coordinateOperation,coordinateOperation:EPSG::3895,coordinateOperation:EPSG::1618
- any other coordinate operation accepted via proj_create()
@param is_foward whether to execute the the pipeline in a forward or inverse
direction.
Given an lwtype number, what homogeneous collection can hold it?
Determine whether a type number is a collection or not
Return the type name string associated with a type number
(e.g. Point, LineString, Polygon)
Convert a single hex digit into the corresponding char
Utility
@brief Add a point in a pointarray.
Append a point to the end of an existing #POINTARRAY
If allow_duplicate is LW_FALSE, then a duplicate point will
not be added.
Append a #POINTARRAY, pa2 to the end of an existing #POINTARRAY, pa1.
Calculate box (x/y) and add values to gbox. Return #LW_SUCCESS on success.
Calculate geodetic (x/y/z) box and add values to gbox. Return #LW_SUCCESS on success.
@param pa the subject pointarray
@param qp the query point
@param dist optional output for actual distance from segment
@return 0-based segment index for the closest segment
(earliest segment in case of same distance)
@param pa the subject pointarray
@param qp the query point
@param dist optional output for actual distance from vertex
Construct an empty pointarray, allocating storage and setting
the npoints, but not filling in any information. Should be used in conjunction
with ptarray_set_point4d to fill in the information in the array.
Construct a new #POINTARRAY, copying in the data from ptlist
Create a new #POINTARRAY with no points. Allocate enough storage
to hold maxpoints vertices before having to reallocate the storage
area.
Construct a new #POINTARRAY, referencing to the data from ptlist
MEMORY MANAGEMENT
Insert a point into an existing #POINTARRAY. Zero
is the index of the start of the array.
@brief Merge two given POINTARRAY and returns a pointer
on the new aggregate one.
Warning: this function free the two inputs POINTARRAY
@return #POINTARRAY is newly allocated
@brief Remove a point from a pointarray.
@param where - is the offset (starting at 0)
@return #POINTARRAY is newly allocated
Remove a point from an existing #POINTARRAY. Zero
is the index of the start of the array.
@d1 start location (distance from start / total distance)
@d2 end location (distance from start / total distance)
@param tolerance snap to vertices at locations < tolerance away from given ones
Comparison functions for set and span types
Initialize a spheroid object for use in geodetic functions.
Transformation functions for box types
Accessor functions for box types
Boolean functions for temporal types
Restriction functions for temporal types
Accessor functions for temporal types
Constructor functions for temporal types
Input and output functions for temporal types
Aggregate functions for temporal types
Comparison functions for box types
Input and output functions for box types
Modification functions for temporal types
Comparison functions for temporal types
Analytics functions for temporal types
Conversion functions for temporal types
Text functions for temporal types
Set functions for box types