Manual PostGIS 3.5.0dev

DEV (Thu 21 Sep 2023 07:23:39 AM UTC rev. 4395b1f )

The PostGIS Development Group

Abstract

PostGIS es una extension del sistema de base de datos relacional PostgreSQL que permite almacenar objetos SIG (Sistemas de Información Geografica) en la base de datos. PostGIS incluye soporte de indices de tipos basados en GiST R-Tree, y funciones de análisis y procesado de objetos SIG.

Este es el manual de la version 3.5.0dev

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Feel free to use this material any way you like, but we ask that you attribute credit to the PostGIS Project and wherever possible, a link back to https://postgis.net.


Table of Contents
1. Introducción
1.1. Comité de Dirección del Proyecto (Project Steering Committee)
1.2. Principales colaboradores presentes
1.3. Colaboradores principales Pasado
1.4. Otros colaboradores
2. Instalación de PostGIS
2.1. Versión corta
2.2. Compilación e instalación desde el código fuente
2.2.1. Obteniendo el código fuente
2.2.2. Install Requirements
2.2.3. Configuración
2.2.4. Compilando
2.2.5. Compilando e Instalando Extensiones de PostGIS
2.2.6. Tests
2.2.7. Instalación
2.3. Installing and Using the address standardizer
2.4. Installing, Upgrading Tiger Geocoder, and loading data
2.4.1. Tiger Geocoder Enabling your PostGIS database
2.4.2. Using Address Standardizer Extension with Tiger geocoder
2.4.3. Required tools for tiger data loading
2.4.4. Upgrading your Tiger Geocoder Install and Data
2.5. Common Problems during installation
3. Administración de PostGIS
3.1. Performance Tuning
3.1.1. Startup
3.1.2. Runtime
3.2. Configuring raster support
3.3. Creating spatial databases
3.3.1. Spatially enable database using EXTENSION
3.3.2. Spatially enable database without using EXTENSION (discouraged)
3.4. Upgrading spatial databases
3.4.1. Soft upgrade
3.4.2. Hard upgrade
4. Data Management
4.1. Spatial Data Model
4.1.1. OGC Geometry
4.1.2. SQL/MM Part 3 - Curves
4.1.3. WKT and WKB
4.2. Geometry Data Type
4.2.1. PostGIS EWKB and EWKT
4.3. Geography Data Type
4.3.1. Creating Geography Tables
4.3.2. Using Geography Tables
4.3.3. When to use the Geography data type
4.3.4. Preguntas frecuentes Avanzadas de Geography
4.4. Geometry Validation
4.4.1. Simple Geometry
4.4.2. Valid Geometry
4.4.3. Managing Validity
4.5. Spatial Reference Systems
4.5.1. SPATIAL_REF_SYS Table
4.5.2. User-Defined Spatial Reference Systems
4.6. Spatial Tables
4.6.1. Crear una tabla espacial
4.6.2. GEOMETRY_COLUMNS View
4.6.3. Manually Registering Geometry Columns
4.7. Loading Spatial Data
4.7.1. Using SQL to Load Data
4.7.2. Using the Shapefile Loader
4.8. Extracting Spatial Data
4.8.1. Using SQL to Extract Data
4.8.2. Using the Shapefile Dumper
4.9. Spatial Indexes
4.9.1. Indices GiST
4.9.2. BRIN Indexes
4.9.3. SP-GiST Indexes
4.9.4. Tuning Index Usage
5. Consulta Espacial
5.1. Determining Spatial Relationships
5.1.1. Dimensionally Extended 9-Intersection Model
5.1.2. Named Spatial Relationships
5.1.3. General Spatial Relationships
5.2. Using Spatial Indexes
5.3. Examples of Spatial SQL
6. Consejos de rendimiento
6.1. Tablas pequeñas de geometrías grandes
6.1.1. Descripcion del problema
6.1.2. Soluciones provisionales
6.2. CLUSTERing o indices geométricos
6.3. Evitar la conversión de dimensión
7. Manual de Referencia PostGIS
7.1. Tipos Geometry/Geography/Box en PostgreSQL PostGIS
box2d — The type representing a 2-dimensional bounding box.
box3d — The type representing a 3-dimensional bounding box.
geometry — geography es un tipo de dato espacial usado para representar una feature en un sistema de coordenadas de Tierra esférica.
geometry_dump — A composite type used to describe the parts of complex geometry.
geography — The type representing spatial features with geodetic (ellipsoidal) coordinate systems.
7.2. Funciones de Gestión
AddGeometryColumn — Suprime una columna de geometrías de una tabla espacial.
DropGeometryColumn — Suprime una columna de geometrías de una tabla espacial.
DropGeometryTable — Borra una tabla y todas sus referencias en la tabla geómetra_columns.
Find_SRID — Returns the SRID defined for a geometry column.
Populate_Geometry_Columns — Ensures geometry columns are defined with type modifiers or have appropriate spatial constraints.
UpdateGeometrySRID — Updates the SRID of all features in a geometry column, and the table metadata.
7.3. Contructores Geométricos
ST_Collect — Creates a GeometryCollection or Multi* geometry from a set of geometries.
ST_LineFromMultiPoint — Crea una LineString desde una geometría MultiPoint.
ST_MakeEnvelope — Crea un polígono rectangular formado a partir de los mínimos y máximos especificados. Los valores de entrada deben estar en el SRS especificado en el SRID.
ST_MakeLine — Crea una cadena de línea desde geometrías de punto, multipunto o de línea.
ST_MakePoint — Creates a 2D, 3DZ or 4D Point.
ST_MakePointM — Crea un punto con coordenadas x, y y un valor de medida.
ST_MakePolygon — Creates a Polygon from a shell and optional list of holes.
ST_Point — Creates a Point with X, Y and SRID values.
ST_PointZ — Creates a Point with X, Y, Z and SRID values.
ST_PointM — Creates a Point with X, Y, M and SRID values.
ST_PointZM — Creates a Point with X, Y, Z, M and SRID values.
ST_Polygon — Creates a Polygon from a LineString with a specified SRID.
ST_TileEnvelope — Creates a rectangular Polygon in Web Mercator (SRID:3857) using the XYZ tile system.
ST_HexagonGrid — Returns a set of hexagons and cell indices that completely cover the bounds of the geometry argument.
ST_Hexagon — Returns a single hexagon, using the provided edge size and cell coordinate within the hexagon grid space.
ST_SquareGrid — Returns a set of grid squares and cell indices that completely cover the bounds of the geometry argument.
ST_Square — Returns a single square, using the provided edge size and cell coordinate within the square grid space.
ST_Letters — Returns the input letters rendered as geometry with a default start position at the origin and default text height of 100.
7.4. Métodos de Acceso a Geometrías
GeometryType — Devuelve el tipo de geometría del valor de ST_Geometry.
ST_Boundary — Devuelve el cierre del limite combinatorio de esta geometría.
ST_BoundingDiagonal — Devuelve la diagonal del cuadro delimitador de la geometría suministrada.
ST_CoordDim — Devuelve la dimensión de las coordenadas del valor de ST_Geometry.
ST_Dimension — Devuelve la dimensión de las coordenadas del valor de ST_Geometry.
ST_Dump — Returns a set of geometry_dump rows for the components of a geometry.
ST_DumpPoints — Devuelve un conjunto de geometry_dump filas para las coordenadas de una geometría.
ST_DumpSegments — Devuelve un conjunto de geometry_dump filas para los segmentos de una geometría.
ST_DumpRings — Returns a set of geometry_dump rows for the exterior and interior rings of a Polygon.
ST_EndPoint — Devuelve el número de puntos en un valor ST_LineString o ST_CircularString.
ST_Envelope — Devuelve una geometría que representa la caja en doble precisión (float8) de la geometría dada.
ST_ExteriorRing — Devuelva el número de anillos interiores de una geometría poligonal.
ST_GeometryN — Devuelve el tipo de geometría del valor de ST_Geometry.
ST_GeometryType — Devuelve el tipo de geometría del valor de ST_Geometry.
ST_HasArc — Tests if a geometry contains a circular arc
ST_InteriorRingN — Devuelva el número de anillos interiores de una geometría poligonal.
ST_IsClosed — Devuelve TRUE si los puntos de inicio y final de una LINESTRINGson coincidentes. Para superficies poliedricas si son cerradas (volumetricas).
ST_IsCollection — Devuelve True si la Geometría es una colección vacía, polígono vacio, punto vacío etc.
ST_IsEmpty — Tests if a geometry is empty.
ST_IsPolygonCCW — Devuelve true si todos los aros exteriores están orientados hacia la izquierda y todos los aros interiores están orientados hacia la derecha.
ST_IsPolygonCW — Devuelve true si todos los aros exteriores están orientados hacia la derecha y todos los aros interiores están orientados en sentido contrario a las agujas del reloj.
ST_IsRing — Tests if a LineString is closed and simple.
ST_IsSimple — Devuelve (TRUE) si la geometría no tiene puntos geométricos anómalos, como auto intersecciones o tangencias.
ST_M — Returns the M coordinate of a Point.
ST_MemSize — Devuelve el tipo de geometría del valor de ST_Geometry.
ST_NDims — Devuelve la dimensión de las coordenadas del valor de ST_Geometry.
ST_NPoints — Devuelve el numero de puntos (vértices) en la geometría.
ST_NRings — Devuelva el número de anillos interiores de una geometría poligonal.
ST_NumGeometries — Devuelve el numero de puntos en la geometría. Funciona con todas las geometrías.
ST_NumInteriorRings — Devuelva el número de anillos interiores de una geometría poligonal.
ST_NumInteriorRing — Devuelve el número de anillos interiores de un polígono en la geometría. Sinónimo de ST_NumInteriorRings.
ST_NumPatches — Devuelve el número de caras en una superficie poliédrica. Devolverá nulo para geometrías no poliédricas.
ST_NumPoints — Devuelve el número de puntos en un valor ST_LineString o ST_CircularString.
ST_PatchN — Devuelve el tipo de geometría del valor de ST_Geometry.
ST_PointN — Devuelve el número de puntos en un valor ST_LineString o ST_CircularString.
ST_Points — Devuelve un MultiPoint que contiene todas las coordenadas de una geometría.
ST_StartPoint — Returns the first point of a LineString.
ST_Summary — Devuelve un resumen de texto del contenido de la geometría.
ST_X — Returns the X coordinate of a Point.
ST_Y — Returns the Y coordinate of a Point.
ST_Z — Returns the Z coordinate of a Point.
ST_Zmflag — Devuelve la dimensión de las coordenadas del valor de ST_Geometry.
7.5. Editores de Geometría
ST_AddPoint — Añade un punto a una cadena de línea.
ST_CollectionExtract — Given a geometry collection, returns a multi-geometry containing only elements of a specified type.
ST_CollectionHomogenize — Returns the simplest representation of a geometry collection.
ST_CurveToLine — Converts a geometry containing curves to a linear geometry.
ST_Scroll — Change start point of a closed LineString.
ST_FlipCoordinates — Returns a version of a geometry with X and Y axis flipped.
ST_Force2D — Forzar las geometrías en un "modo de 2 dimensiones".
ST_Force3D — Forzar las geometrías en modo XYZ. Este es un alias para ST_Force3DZ.
ST_Force3DZ — Fuerza las geometrías en modo XYZ.
ST_Force3DM — Fuerza las geometrías en modo XYM.
ST_Force4D — Fuerza las geometrías en modo XYZM.
ST_ForcePolygonCCW — Orienta todos los aros exteriores en sentido contrario a las agujas del reloj y todos los aros interiores en sentido horario.
ST_ForceCollection — Convertir la geometría en una GEOMETRYCOLLECTION.
ST_ForcePolygonCW — Orienta todos los anillos exteriores en el sentido de las agujas del reloj y todos los anillos interiores en sentido contrario a las agujas del reloj.
ST_ForceSFS — Fuerza las geometrías para usar sólo los tipos de geometría SFS 1.1.
ST_ForceRHR — Fuerza la orientación de los vértices en un polígono para seguir la regla de la mano derecha.
ST_ForceCurve — Relanzar una geometría en su tipo curvo, si corresponde.
ST_LineToCurve — Converts a linear geometry to a curved geometry.
ST_Multi — Devuelve la geometría como una geometría MULTI*.
ST_LineExtend — Returns a line with the last and first segments extended the specified distance(s).
ST_Normalize — Devuelve la geometría en su forma canónica.
ST_Project — Returns a point projected from a start point by a distance and bearing (azimuth).
ST_QuantizeCoordinates — Sets least significant bits of coordinates to zero
ST_RemovePoint — Remove a point from a linestring.
ST_RemoveRepeatedPoints — Returns a version of a geometry with duplicate points removed.
ST_Reverse — Devuelve la geometría con el orden de vértice invertido.
ST_Segmentize — Returns a modified geometry/geography having no segment longer than a given distance.
ST_SetPoint — Reemplace el punto de una cadena de línea con un punto dado.
ST_ShiftLongitude — Shifts the longitude coordinates of a geometry between -180..180 and 0..360.
ST_WrapX — Wrap a geometry around an X value.
ST_SnapToGrid — Ajusta todos los puntos de la geometría de entrada a una cuadrícula regular.
ST_Snap — Ajusta segmentos y vértices de la geometría de entrada a vértices de una geometría de referencia.
ST_SwapOrdinates — Returns a version of the given geometry with given ordinate values swapped.
7.6. Geometry Validation
ST_IsValid — Tests if a geometry is well-formed in 2D.
ST_IsValidDetail — Returns a valid_detail row stating if a geometry is valid or if not a reason and a location.
ST_IsValidReason — Returns text stating if a geometry is valid, or a reason for invalidity.
ST_MakeValid — Attempts to make an invalid geometry valid without losing vertices.
7.7. Spatial Reference System Functions
ST_InverseTransformPipeline — Return a new geometry with coordinates transformed to a different spatial reference system using the inverse of a defined coordinate transformation pipeline.
ST_SetSRID — Set the SRID on a geometry.
ST_SRID — Returns the spatial reference identifier for a geometry.
ST_Transform — Return a new geometry with coordinates transformed to a different spatial reference system.
ST_TransformPipeline — Return a new geometry with coordinates transformed to a different spatial reference system using a defined coordinate transformation pipeline.
postgis_srs_codes — Return the list of SRS codes associated with the given authority.
postgis_srs — Return a metadata record for the requested authority and srid.
postgis_srs_all — Return metadata records for every spatial reference system in the underlying Proj database.
postgis_srs_search — Return metadata records for projected coordinate systems that have areas of useage that fully contain the bounds parameter.
7.8. Geometry Input
7.8.1. Well-Known Text (WKT)
7.8.2. Well-Known Binary (WKB)
7.8.3. Other Formats
7.9. Geometry Output
7.9.1. Well-Known Text (WKT)
7.9.2. Well-Known Binary (WKB)
7.9.3. Other Formats
7.10. Operadores
7.10.1. Bounding Box Operators
7.10.2. Operadores
7.11. Spatial Relationships
7.11.1. Topological Relationships
7.11.2. Distance Relationships
7.12. Measurement Functions
ST_Area — Returns the area of a polygonal geometry.
ST_Azimuth — Returns the north-based azimuth of a line between two points.
ST_Angle — Returns the angle between two vectors defined by 3 or 4 points, or 2 lines.
ST_ClosestPoint — Returns the 2D point on g1 that is closest to g2. This is the first point of the shortest line from one geometry to the other.
ST_3DClosestPoint — Returns the 3D point on g1 that is closest to g2. This is the first point of the 3D shortest line.
ST_Distance — Returns the distance between two geometry or geography values.
ST_3DDistance — Returns the 3D cartesian minimum distance (based on spatial ref) between two geometries in projected units.
ST_DistanceSphere — Returns minimum distance in meters between two lon/lat geometries using a spherical earth model.
ST_DistanceSpheroid — Returns the minimum distance between two lon/lat geometries using a spheroidal earth model.
ST_FrechetDistance — Returns the Fréchet distance between two geometries.
ST_HausdorffDistance — Returns the Hausdorff distance between two geometries.
ST_Length — Returns the 2D length of a linear geometry.
ST_Length2D — Returns the 2D length of a linear geometry. Alias for ST_Length
ST_3DLength — Returns the 3D length of a linear geometry.
ST_LengthSpheroid — Returns the 2D or 3D length/perimeter of a lon/lat geometry on a spheroid.
ST_LongestLine — Returns the 2D longest line between two geometries.
ST_3DLongestLine — Returns the 3D longest line between two geometries
ST_MaxDistance — Returns the 2D largest distance between two geometries in projected units.
ST_3DMaxDistance — Returns the 3D cartesian maximum distance (based on spatial ref) between two geometries in projected units.
ST_MinimumClearance — Returns the minimum clearance of a geometry, a measure of a geometry's robustness.
ST_MinimumClearanceLine — Returns the two-point LineString spanning a geometry's minimum clearance.
ST_Perimeter — Returns the length of the boundary of a polygonal geometry or geography.
ST_Perimeter2D — Returns the 2D perimeter of a polygonal geometry. Alias for ST_Perimeter.
ST_3DPerimeter — Returns the 3D perimeter of a polygonal geometry.
ST_ShortestLine — Returns the 2D shortest line between two geometries
ST_3DShortestLine — Returns the 3D shortest line between two geometries
7.13. Overlay Functions
ST_ClipByBox2D — Computes the portion of a geometry falling within a rectangle.
ST_Difference — Computes a geometry representing the part of geometry A that does not intersect geometry B.
ST_Intersection — Computes a geometry representing the shared portion of geometries A and B.
ST_MemUnion — Aggregate function which unions geometries in a memory-efficent but slower way
ST_Node — Nodes a collection of lines.
ST_Split — Returns a collection of geometries created by splitting a geometry by another geometry.
ST_Subdivide — Computes a rectilinear subdivision of a geometry.
ST_SymDifference — Computes a geometry representing the portions of geometries A and B that do not intersect.
ST_UnaryUnion — Computes the union of the components of a single geometry.
ST_Union — Computes a geometry representing the point-set union of the input geometries.
7.14. Procesamiento de geometría
ST_Buffer — Computes a geometry covering all points within a given distance from a geometry.
ST_BuildArea — Creates a polygonal geometry formed by the linework of a geometry.
ST_Centroid — Returns the geometric center of a geometry.
ST_ChaikinSmoothing — Returns a smoothed version of a geometry, using the Chaikin algorithm
ST_ConcaveHull — Computes a possibly concave geometry that contains all input geometry vertices
ST_ConvexHull — Computes the convex hull of a geometry.
ST_DelaunayTriangles — Returns the Delaunay triangulation of the vertices of a geometry.
ST_FilterByM — Removes vertices based on their M value
ST_GeneratePoints — Generates a multipoint of random points contained in a Polygon or MultiPolygon.
ST_GeometricMedian — Returns the geometric median of a MultiPoint.
ST_LineMerge — Return the lines formed by sewing together a MultiLineString.
ST_MaximumInscribedCircle — Computes the largest circle contained within a geometry.
ST_LargestEmptyCircle — Computes the largest circle not overlapping a geometry.
ST_MinimumBoundingCircle — Returns the smallest circle polygon that contains a geometry.
ST_MinimumBoundingRadius — Returns the center point and radius of the smallest circle that contains a geometry.
ST_OrientedEnvelope — Returns a minimum-area rectangle containing a geometry.
ST_OffsetCurve — Returns an offset line at a given distance and side from an input line.
ST_PointOnSurface — Computes a point guaranteed to lie in a polygon, or on a geometry.
ST_Polygonize — Computes a collection of polygons formed from the linework of a set of geometries.
ST_ReducePrecision — Returns a valid geometry with points rounded to a grid tolerance.
ST_SharedPaths — Returns a collection containing paths shared by the two input linestrings/multilinestrings.
ST_Simplify — Returns a simplified version of a geometry, using the Douglas-Peucker algorithm.
ST_SimplifyPreserveTopology — Returns a simplified and valid version of a geometry, using the Douglas-Peucker algorithm.
ST_SimplifyPolygonHull — Computes a simplifed topology-preserving outer or inner hull of a polygonal geometry.
ST_SimplifyVW — Returns a simplified version of a geometry, using the Visvalingam-Whyatt algorithm
ST_SetEffectiveArea — Sets the effective area for each vertex, using the Visvalingam-Whyatt algorithm.
ST_TriangulatePolygon — Computes the constrained Delaunay triangulation of polygons
ST_VoronoiLines — Returns the boundaries of the Voronoi diagram of the vertices of a geometry.
ST_VoronoiPolygons — Returns the cells of the Voronoi diagram of the vertices of a geometry.
7.15. Coverages
ST_CoverageInvalidEdges — Window function that finds locations where polygons fail to form a valid coverage.
ST_CoverageSimplify — Window function that simplifies the edges of a polygonal coverage.
ST_CoverageUnion — Computes the union of a set of polygons forming a coverage by removing shared edges.
7.16. Affine Transformations
ST_Affine — Apply a 3D affine transformation to a geometry.
ST_Rotate — Rotates a geometry about an origin point.
ST_RotateX — Rotates a geometry about the X axis.
ST_RotateY — Rotates a geometry about the Y axis.
ST_RotateZ — Rotates a geometry about the Z axis.
ST_Scale — Scales a geometry by given factors.
ST_Translate — Translates a geometry by given offsets.
ST_TransScale — Translates and scales a geometry by given offsets and factors.
7.17. Clustering Functions
ST_ClusterDBSCAN — Window function that returns a cluster id for each input geometry using the DBSCAN algorithm.
ST_ClusterIntersecting — Aggregate function that clusters input geometries into connected sets.
ST_ClusterIntersectingWin — Window function that returns a cluster id for each input geometry, clustering input geometries into connected sets.
ST_ClusterKMeans — Window function that returns a cluster id for each input geometry using the K-means algorithm.
ST_ClusterWithin — Aggregate function that clusters geometries by separation distance.
ST_ClusterWithinWin — Window function that returns a cluster id for each input geometry, clustering using separation distance.
7.18. Bounding Box Functions
Box2D — Returns a BOX2D representing the 2D extent of a geometry.
Box3D — Returns a BOX3D representing the 3D extent of a geometry.
ST_EstimatedExtent — Returns the estimated extent of a spatial table.
ST_Expand — Returns a bounding box expanded from another bounding box or a geometry.
ST_Extent — Aggregate function that returns the bounding box of geometries.
ST_3DExtent — Aggregate function that returns the 3D bounding box of geometries.
ST_MakeBox2D — Creates a BOX2D defined by two 2D point geometries.
ST_3DMakeBox — Creates a BOX3D defined by two 3D point geometries.
ST_XMax — Returns the X maxima of a 2D or 3D bounding box or a geometry.
ST_XMin — Returns the X minima of a 2D or 3D bounding box or a geometry.
ST_YMax — Returns the Y maxima of a 2D or 3D bounding box or a geometry.
ST_YMin — Returns the Y minima of a 2D or 3D bounding box or a geometry.
ST_ZMax — Returns the Z maxima of a 2D or 3D bounding box or a geometry.
ST_ZMin — Returns the Z minima of a 2D or 3D bounding box or a geometry.
7.19. Referencia Lineal 
ST_LineInterpolatePoint — Returns a point interpolated along a line at a fractional location.
ST_3DLineInterpolatePoint — Returns a point interpolated along a 3D line at a fractional location.
ST_LineInterpolatePoints — Returns points interpolated along a line at a fractional interval.
ST_LineLocatePoint — Returns the fractional location of the closest point on a line to a point.
ST_LineSubstring — Returns the part of a line between two fractional locations.
ST_LocateAlong — Returns the point(s) on a geometry that match a measure value.
ST_LocateBetween — Returns the portions of a geometry that match a measure range.
ST_LocateBetweenElevations — Returns the portions of a geometry that lie in an elevation (Z) range.
ST_InterpolatePoint — Devuelve el valor de la dimensión medida de una geometría en el punto cerrado al punto proporcionado.
ST_AddMeasure — Interpolates measures along a linear geometry.
7.20. Trajectory Functions
ST_IsValidTrajectory — Tests if the geometry is a valid trajectory.
ST_ClosestPointOfApproach — Returns a measure at the closest point of approach of two trajectories.
ST_DistanceCPA — Returns the distance between the closest point of approach of two trajectories.
ST_CPAWithin — Tests if the closest point of approach of two trajectories is within the specified distance.
7.21. SFCGAL Functions
postgis_sfcgal_version — Returns the version of SFCGAL in use
postgis_sfcgal_full_version — Returns the full version of SFCGAL in use including CGAL and Boost versions
ST_3DArea — Computes area of 3D surface geometries. Will return 0 for solids.
ST_3DConvexHull — Computes the 3D convex hull of a geometry.
ST_3DIntersection — Perform 3D intersection
ST_3DDifference — Perform 3D difference
ST_3DUnion — Perform 3D union.
ST_AlphaShape — Computes an Alpha-shape enclosing a geometry
ST_ApproximateMedialAxis — Compute the approximate medial axis of an areal geometry.
ST_ConstrainedDelaunayTriangles — Return a constrained Delaunay triangulation around the given input geometry.
ST_Extrude — Extrude a surface to a related volume
ST_ForceLHR — Force LHR orientation
ST_IsPlanar — Check if a surface is or not planar
ST_IsSolid — Test if the geometry is a solid. No validity check is performed.
ST_MakeSolid — Cast the geometry into a solid. No check is performed. To obtain a valid solid, the input geometry must be a closed Polyhedral Surface or a closed TIN.
ST_MinkowskiSum — Performs Minkowski sum
ST_OptimalAlphaShape — Computes an Alpha-shape enclosing a geometry using an "optimal" alpha value.
ST_Orientation — Determine surface orientation
ST_StraightSkeleton — Compute a straight skeleton from a geometry
ST_Tesselate — Perform surface Tesselation of a polygon or polyhedralsurface and returns as a TIN or collection of TINS
ST_Volume — Computes the volume of a 3D solid. If applied to surface (even closed) geometries will return 0.
7.22. Soporte para transacciones grandes
AddAuth — Agrega un testigo de autorización para usarlo en la transacción actual.
CheckAuth — Crea un disparador sobre una tabla para prevenir/permitir actualizaciones y borrados de filas basados en el testigo de autorización.
DisableLongTransactions — DisableLongTransactions
EnableLongTransactions — EnableLongTransactions
LockRow — Configura el bloqueo/autorización para una fila específica de la tabla
UnlockRows — Removes all locks held by an authorization token.
7.23. Version Functions
PostGIS_Extensions_Upgrade — Packages and upgrades PostGIS extensions (e.g. postgis_raster, postgis_topology, postgis_sfcgal) to given or latest version.
PostGIS_Full_Version — Reports full PostGIS version and build configuration infos.
PostGIS_GEOS_Version — Returns the version number of the GEOS library.
PostGIS_GEOS_Compiled_Version — Returns the version number of the GEOS library against which PostGIS was built.
PostGIS_Liblwgeom_Version — Returns the version number of the liblwgeom library. This should match the version of PostGIS.
PostGIS_LibXML_Version — Returns the version number of the libxml2 library.
PostGIS_Lib_Build_Date — Returns build date of the PostGIS library.
PostGIS_Lib_Version — Returns the version number of the PostGIS library.
PostGIS_PROJ_Version — Returns the version number of the PROJ4 library.
PostGIS_Wagyu_Version — Returns the version number of the internal Wagyu library.
PostGIS_Scripts_Build_Date — Returns build date of the PostGIS scripts.
PostGIS_Scripts_Installed — Returns version of the PostGIS scripts installed in this database.
PostGIS_Scripts_Released — Returns the version number of the postgis.sql script released with the installed PostGIS lib.
PostGIS_Version — Returns PostGIS version number and compile-time options.
7.24. Grand Unified Custom Variables (GUCs)
postgis.backend — The backend to service a function where GEOS and SFCGAL overlap. Options: geos or sfcgal. Defaults to geos.
postgis.gdal_datapath — A configuration option to assign the value of GDAL's GDAL_DATA option. If not set, the environmentally set GDAL_DATA variable is used.
postgis.gdal_enabled_drivers — A configuration option to set the enabled GDAL drivers in the PostGIS environment. Affects the GDAL configuration variable GDAL_SKIP.
postgis.enable_outdb_rasters — A boolean configuration option to enable access to out-db raster bands.
postgis.gdal_config_options — A string configuration to set options used when working with an out-db raster.
7.25. Troubleshooting Functions
PostGIS_AddBBox — Agregue el cuadro delimitador a la geometría.
PostGIS_DropBBox — Elimina el caché de cuadro delimitador de la geometría.
PostGIS_HasBBox — Devuelve TRUE si el bbox de la geometría está almacenado en caché, FALSE de lo contrario.
8. Topology
8.1. Tipos en Topology
getfaceedges_returntype — Un tipo compuesto que necesita un número de secuencia y un número de eje.
TopoGeometry — Un tipo compuesto que representa una geometría topológicamente definida.
validatetopology_returntype — Un tipo compuesto que consta de un mensaje de error e id1 e id2 para denotar la ubicación del error. Este es el tipo de valor devuelto por ValidateTopology.
8.2. Dominios de Topology
TopoElement — Una matriz de 2 enteros usada generalmente para identificar un componente TopoGeometry
TopoElementArray — Matriz de objetos TopoElement.
8.3. Topología y Gestión de TopoGeometría
AddTopoGeometryColumn — Agrega una columna topogeometry a una tabla existente, registra esta nueva columna como una capa en topology.layer y devuelve el nuevo layer_id
RenameTopoGeometryColumn — Renames a topogeometry column
DropTopology — Usar con precaución: Permite eliminar un esquema de topología y elimina su referencia de la talbla topology.topology y referencias a las tablas en ese esquema desde la tabla geometry_columns
RenameTopology — Renames a topology
DropTopoGeometryColumn — Elimina la columna topogeometry de la tabla nombrada en table_name en el esquema schema_name y anula el registro de las columnas de la tabla topology.layer.
Populate_Topology_Layer — Agrega entradas faltantes a la tabla topology.layer mediante la lectura de metadatos de las tablas de topo.
TopologySummary — Toma un nombre de topología y proporciona totales de resumen de tipos de objetos en la topología.
ValidateTopology — Devuelve un conjunto de objetos validatetopology_returntype que detallan problemas con la topología.
ValidateTopologyRelation — Returns info about invalid topology relation records
FindTopology — Returns a topology record by different means.
FindLayer — Returns a topology.layer record by different means.
8.4. Topology Statistics Management
8.5. Constructores de Topología
CreateTopology — Creates a new topology schema and registers it in the topology.topology table.
CopyTopology — Makes a copy of a topology (nodes, edges, faces, layers and TopoGeometries) into a new schema
ST_InitTopoGeo — Creates a new topology schema and registers it in the topology.topology table.
ST_CreateTopoGeo — Agrega una colección de geometrías a una topología vacía dada y devuelve un mensaje que detalla el éxito.
TopoGeo_AddPoint — Agrega un punto a una topología existente utilizando una tolerancia y posiblemente dividiendo un borde existente.
TopoGeo_AddLineString — Agrega una cadena de línea a una topología existente utilizando una tolerancia y posiblemente dividiendo las aristas/caras existentes. Devuelve identificadores de borde.
TopoGeo_AddPolygon — Agrega un polígono a una topología existente utilizando una tolerancia y posiblemente dividiendo las aristas/caras existentes. Devuelve identificadores de cara.
8.6. Editores de Topología
ST_AddIsoNode — Agrega un nodo aislado a una cara de una topología y devuelve el identificardor de nodo del nuevo nodo. Si la cara es nula, el nodo es creado de todas maneras.
ST_AddIsoEdge — Agrega un borde aislado definido por la geometría alinestring a una topología que conecta dos nodos aislados existentes anode y anothernode y devuelve el identificador de borde del nuevo borde.
ST_AddEdgeNewFaces — Agrega un nuevo borde y, si al hacerlo divide una cara, se elimina la cara original y es reemplazada con dos nuevas caras.
ST_AddEdgeModFace — Añada un nuevo borde y, si al hacerlo, divide una cara, modifica la cara original y añade una nueva cara.
ST_RemEdgeNewFace — Elimina un borde y, si el borde eliminado separa dos caras, borra las caras originales y las reemplaza con una nueva cara.
ST_RemEdgeModFace — Removes an edge, and if the edge separates two faces deletes one face and modifies the other face to cover the space of both.
ST_ChangeEdgeGeom — Cambia la forma de un borde sin afectar la estructura de la topología.
ST_ModEdgeSplit — Dividir un borde creando un nuevo nodo a lo largo de un borde existente, modificando el borde original y agregando un nuevo borde.
ST_ModEdgeHeal — Cura dos aristas eliminando el nodo que las conecta, modificando la primera arista y eliminando la segunda arista. Devuelve el identificador del nodo eliminado.
ST_NewEdgeHeal — Cura dos aristas eliminando el nodo que las conecta, eliminando ambas aristas y sustituyéndolas por una arista cuya dirección sea la misma que la primera arista proporcionada.
ST_MoveIsoNode — Mueve un nodo aislado en una topología de un punto a otro. Si la nueva geometría apoint existe como nodo se lanza un error. Devuelve la descripción del movimiento.
ST_NewEdgesSplit — Divide un borde creando un nuevo nodo a lo largo de un borde existente, eliminando el borde original y reemplazandolo con dos bordes nuevos. Devuelve el identificador del nuevo nodo creado que une los nuevos bordes.
ST_RemoveIsoNode — Elimina un nodo aislado y devuelve la descripción de la acción. Si el nodo no está aislado (es el inicio o el final de un borde), entonces se lanza una excepción.
ST_RemoveIsoEdge — Elimina un borde aislado y devuelve la descripción de la acción. Si el borde no está aislado, se lanza una excepción.
8.7. Accesores de Topología
GetEdgeByPoint — Busca el identificador de arista de una arista que cruza un punto determinado.
GetFaceByPoint — Finds face intersecting a given point.
GetFaceContainingPoint — Finds the face containing a point.
GetNodeByPoint — Busca el identificador de nodo de un nodo en un punto de ubicación.
GetTopologyID — Devuelve el identificador de una topología en la tabla topology.topology dado el nombre de la topología.
GetTopologySRID — Devuelve el SRID de una topología en la tabla topology.topology dado el nombre de la topología.
GetTopologyName — Devuelve el nombre de una topología (esquema) dado el identificador de la topología.
ST_GetFaceEdges — Devuelve un conjunto de bordes ordenados que ligan aface.
ST_GetFaceGeometry — Devuelve el polígono en la topología dada con el identificador de la cara especificada.
GetRingEdges — Devuelve el conjunto ordenado de identificadores de borde con signo asignado al caminar en un lado de borde dado.
GetNodeEdges — Devuelve un conjunto ordenado de aristas incidente al nodo dado.
8.8. Procesamiento de Topología
Polygonize — Busca y registra todas las caras definidas por aristas de topología.
AddNode — Agrega un nodo de punto a la tabla de nodos del esquema de topología especificado y devuelve el identificador de nodo del nuevo nodo. Si el punto ya existe como nodo, se devuelve el identificador de nodo existente.
AddEdge — Agrega una arista de LineString a la tabla de arista y los puntos de inicio y fin asociados a la tabla nodos de puntos del esquema de topología usando la geometría LineString especificada y devuelve el identificador de arista de la arista nueva (o existente).
AddFace — Registra una primitiva de cara a una topología y obtiene su identificador.
ST_Simplify — Devuelve una versión "simplificada" de la geometría de la TopoGeometry dada usando el algoritmo de Douglas-Peucker.
RemoveUnusedPrimitives — Removes topology primitives which not needed to define existing TopoGeometry objects.
8.9. Constructores de Geometría Topográfica
CreateTopoGeom — Crea un nuevo objeto de geometría topo de la matriz de elementos topo - tg_type: 1:[multi]point, 2:[multi]line, 3:[multi]poly, 4:collection
toTopoGeom — Convierte un Geometry simple en una geometría topo.
TopoElementArray_Agg — Devuelve un topoelementarray para un conjunto de element_id, matriz de tipo (topoelements).
TopoElement — Converts a topogeometry to a topoelement.
8.10. Editores TopoGeometry
clearTopoGeom — Borra el contenido de una topo geometry.
TopoGeom_addElement — Agrega un elemento a la definición de una TopoGeometry.
TopoGeom_remElement — Quita un elemento de la definición de una TopoGeometry.
TopoGeom_addTopoGeom — Adds element of a TopoGeometry to the definition of another TopoGeometry.
toTopoGeom — Agrega una forma de geometría a una geometría topográfica existente.
8.11. Descriptores de Geometría Topográfica
GetTopoGeomElementArray — Devuelve un topoelementarray (una matriz de topoelements) que contiene los elementos topológicos y el tipo de la TopoGeometry (elementos primitivos) especificados.
GetTopoGeomElements — Devuelve un conjunto de objetos topoelement que contienen el element_id topológico, element_type de la TopoGeometry (elementos primitivos) especificados.
ST_SRID — Returns the spatial reference identifier for a topogeometry.
8.12. Salidas de Geometría Topográfica
AsGML — Devuelve una representación GML de una geometría topográfica.
AsTopoJSON — Devuelve la representación TopoJSON de una topogeometry.
8.13. Relaciones espaciales de topología
Equals — Devuelve true si dos topogeometries están compuestas de las mismas primitivas topologicas.
Intersects — Devuelve verdadero si cualquier par de primitivas de las dos topogeometries se intersectan.
8.14. Importing and exporting Topologies
8.14.1. Using the Topology exporter
8.14.2. Using the Topology importer
9. Gestión, Consulta y Aplicaciones de Datos Raster
9.1. Cargando y Creando Rasters
9.1.1. Utilizar el paquete raster2pgsql para cargar rasters
9.1.2. Crear rastrees utilizando las funciones raster de PostGIS
9.1.3. Using "out db" cloud rasters
9.2. Catalogos raster
9.2.1. Catalogo de columnas raster
9.2.2. Previsualizaciones raster
9.3. Contruyendo aplicaciones personalizadas con PostGIS Raster
9.3.1. Ejemplo de salida utilizando ST_AsPNG junto con otras opciones raster en PHP
9.3.2. Ejemplo de salida utilizando ST_AsPNG junto con otras opciones raster en ASP.NET C#
9.3.3. Aplicación de consola Java que extrae un raster como un fichero de imagen
9.3.4. Utilizar PLPython para extraer imágenes vía SQL
9.3.5. Extraer un raster con PSQL
10. Raster Reference
10.1. Raster Support Data types
geomval — A spatial datatype with two fields - geom (holding a geometry object) and val (holding a double precision pixel value from a raster band).
addbandarg — A composite type used as input into the ST_AddBand function defining the attributes and initial value of the new band.
rastbandarg — A composite type for use when needing to express a raster and a band index of that raster.
raster — raster spatial data type.
reclassarg — A composite type used as input into the ST_Reclass function defining the behavior of reclassification.
summarystats — A composite type returned by the ST_SummaryStats and ST_SummaryStatsAgg functions.
unionarg — A composite type used as input into the ST_Union function defining the bands to be processed and behavior of the UNION operation.
10.2. Raster Management
AddRasterConstraints — Adds raster constraints to a loaded raster table for a specific column that constrains spatial ref, scaling, blocksize, alignment, bands, band type and a flag to denote if raster column is regularly blocked. The table must be loaded with data for the constraints to be inferred. Returns true if the constraint setting was accomplished and issues a notice otherwise.
DropRasterConstraints — Drops PostGIS raster constraints that refer to a raster table column. Useful if you need to reload data or update your raster column data.
AddOverviewConstraints — Tag a raster column as being an overview of another.
DropOverviewConstraints — Untag a raster column from being an overview of another.
PostGIS_GDAL_Version — Reports the version of the GDAL library in use by PostGIS.
PostGIS_Raster_Lib_Build_Date — Reports full raster library build date.
PostGIS_Raster_Lib_Version — Reports full raster version and build configuration infos.
ST_GDALDrivers — Returns a list of raster formats supported by PostGIS through GDAL. Only those formats with can_write=True can be used by ST_AsGDALRaster
ST_Contour — Generates a set of vector contours from the provided raster band, using the GDAL contouring algorithm.
ST_InterpolateRaster — Interpolates a gridded surface based on an input set of 3-d points, using the X- and Y-values to position the points on the grid and the Z-value of the points as the surface elevation.
UpdateRasterSRID — Change the SRID of all rasters in the user-specified column and table.
ST_CreateOverview — Create an reduced resolution version of a given raster coverage.
10.3. Raster Constructors
ST_AddBand — Returns a raster with the new band(s) of given type added with given initial value in the given index location. If no index is specified, the band is added to the end.
ST_AsRaster — Converts a PostGIS geometry to a PostGIS raster.
ST_Band — Returns one or more bands of an existing raster as a new raster. Useful for building new rasters from existing rasters.
ST_MakeEmptyCoverage — Cover georeferenced area with a grid of empty raster tiles.
ST_MakeEmptyRaster — Returns an empty raster (having no bands) of given dimensions (width & height), upperleft X and Y, pixel size and rotation (scalex, scaley, skewx & skewy) and reference system (srid). If a raster is passed in, returns a new raster with the same size, alignment and SRID. If srid is left out, the spatial ref is set to unknown (0).
ST_Tile — Returns a set of rasters resulting from the split of the input raster based upon the desired dimensions of the output rasters.
ST_Retile — Return a set of configured tiles from an arbitrarily tiled raster coverage.
ST_FromGDALRaster — Returns a raster from a supported GDAL raster file.
10.4. Raster Accessors
ST_GeoReference — Returns the georeference meta data in GDAL or ESRI format as commonly seen in a world file. Default is GDAL.
ST_Height — Returns the height of the raster in pixels.
ST_IsEmpty — Returns true if the raster is empty (width = 0 and height = 0). Otherwise, returns false.
ST_MemSize — Returns the amount of space (in bytes) the raster takes.
ST_MetaData — Returns basic meta data about a raster object such as pixel size, rotation (skew), upper, lower left, etc.
ST_NumBands — Returns the number of bands in the raster object.
ST_PixelHeight — Returns the pixel height in geometric units of the spatial reference system.
ST_PixelWidth — Returns the pixel width in geometric units of the spatial reference system.
ST_ScaleX — Returns the X component of the pixel width in units of coordinate reference system.
ST_ScaleY — Returns the Y component of the pixel height in units of coordinate reference system.
ST_RasterToWorldCoord — Returns the raster's upper left corner as geometric X and Y (longitude and latitude) given a column and row. Column and row starts at 1.
ST_RasterToWorldCoordX — Returns the geometric X coordinate upper left of a raster, column and row. Numbering of columns and rows starts at 1.
ST_RasterToWorldCoordY — Returns the geometric Y coordinate upper left corner of a raster, column and row. Numbering of columns and rows starts at 1.
ST_Rotation — Returns the rotation of the raster in radian.
ST_SkewX — Returns the georeference X skew (or rotation parameter).
ST_SkewY — Returns the georeference Y skew (or rotation parameter).
ST_SRID — Returns the spatial reference identifier of the raster as defined in spatial_ref_sys table.
ST_Summary — Returns a text summary of the contents of the raster.
ST_UpperLeftX — Returns the upper left X coordinate of raster in projected spatial ref.
ST_UpperLeftY — Returns the upper left Y coordinate of raster in projected spatial ref.
ST_Width — Returns the width of the raster in pixels.
ST_WorldToRasterCoord — Returns the upper left corner as column and row given geometric X and Y (longitude and latitude) or a point geometry expressed in the spatial reference coordinate system of the raster.
ST_WorldToRasterCoordX — Returns the column in the raster of the point geometry (pt) or a X and Y world coordinate (xw, yw) represented in world spatial reference system of raster.
ST_WorldToRasterCoordY — Returns the row in the raster of the point geometry (pt) or a X and Y world coordinate (xw, yw) represented in world spatial reference system of raster.
10.5. Raster Band Accessors
ST_BandMetaData — Returns basic meta data for a specific raster band. band num 1 is assumed if none-specified.
ST_BandNoDataValue — Returns the value in a given band that represents no data. If no band num 1 is assumed.
ST_BandIsNoData — Returns true if the band is filled with only nodata values.
ST_BandPath — Returns system file path to a band stored in file system. If no bandnum specified, 1 is assumed.
ST_BandFileSize — Returns the file size of a band stored in file system. If no bandnum specified, 1 is assumed.
ST_BandFileTimestamp — Returns the file timestamp of a band stored in file system. If no bandnum specified, 1 is assumed.
ST_BandPixelType — Returns the type of pixel for given band. If no bandnum specified, 1 is assumed.
ST_MinPossibleValue — Returns the minimum value this pixeltype can store.
ST_HasNoBand — Returns true if there is no band with given band number. If no band number is specified, then band number 1 is assumed.
10.6. Raster Pixel Accessors and Setters
ST_PixelAsPolygon — Returns the polygon geometry that bounds the pixel for a particular row and column.
ST_PixelAsPolygons — Returns the polygon geometry that bounds every pixel of a raster band along with the value, the X and the Y raster coordinates of each pixel.
ST_PixelAsPoint — Returns a point geometry of the pixel's upper-left corner.
ST_PixelAsPoints — Returns a point geometry for each pixel of a raster band along with the value, the X and the Y raster coordinates of each pixel. The coordinates of the point geometry are of the pixel's upper-left corner.
ST_PixelAsCentroid — Returns the centroid (point geometry) of the area represented by a pixel.
ST_PixelAsCentroids — Returns the centroid (point geometry) for each pixel of a raster band along with the value, the X and the Y raster coordinates of each pixel. The point geometry is the centroid of the area represented by a pixel.
ST_Value — Returns the value of a given band in a given columnx, rowy pixel or at a particular geometric point. Band numbers start at 1 and assumed to be 1 if not specified. If exclude_nodata_value is set to false, then all pixels include nodata pixels are considered to intersect and return value. If exclude_nodata_value is not passed in then reads it from metadata of raster.
ST_NearestValue — Returns the nearest non-NODATA value of a given band's pixel specified by a columnx and rowy or a geometric point expressed in the same spatial reference coordinate system as the raster.
ST_SetZ — Returns a geometry with the same X/Y coordinates as the input geometry, and values from the raster copied into the Z dimension using the requested resample algorithm.
ST_SetM — Returns a geometry with the same X/Y coordinates as the input geometry, and values from the raster copied into the M dimension using the requested resample algorithm.
ST_Neighborhood — Returns a 2-D double precision array of the non-NODATA values around a given band's pixel specified by either a columnX and rowY or a geometric point expressed in the same spatial reference coordinate system as the raster.
ST_SetValue — Returns modified raster resulting from setting the value of a given band in a given columnx, rowy pixel or the pixels that intersect a particular geometry. Band numbers start at 1 and assumed to be 1 if not specified.
ST_SetValues — Returns modified raster resulting from setting the values of a given band.
ST_DumpValues — Get the values of the specified band as a 2-dimension array.
ST_PixelOfValue — Get the columnx, rowy coordinates of the pixel whose value equals the search value.
10.7. Raster Editors
ST_SetGeoReference — Set Georeference 6 georeference parameters in a single call. Numbers should be separated by white space. Accepts inputs in GDAL or ESRI format. Default is GDAL.
ST_SetRotation — Set the rotation of the raster in radian.
ST_SetScale — Sets the X and Y size of pixels in units of coordinate reference system. Number units/pixel width/height.
ST_SetSkew — Sets the georeference X and Y skew (or rotation parameter). If only one is passed in, sets X and Y to the same value.
ST_SetSRID — Sets the SRID of a raster to a particular integer srid defined in the spatial_ref_sys table.
ST_SetUpperLeft — Sets the value of the upper left corner of the pixel of the raster to projected X and Y coordinates.
ST_Resample — Resample a raster using a specified resampling algorithm, new dimensions, an arbitrary grid corner and a set of raster georeferencing attributes defined or borrowed from another raster.
ST_Rescale — Resample a raster by adjusting only its scale (or pixel size). New pixel values are computed using the NearestNeighbor (english or american spelling), Bilinear, Cubic, CubicSpline, Lanczos, Max or Min resampling algorithm. Default is NearestNeighbor.
ST_Reskew — Resample a raster by adjusting only its skew (or rotation parameters). New pixel values are computed using the NearestNeighbor (english or american spelling), Bilinear, Cubic, CubicSpline or Lanczos resampling algorithm. Default is NearestNeighbor.
ST_SnapToGrid — Resample a raster by snapping it to a grid. New pixel values are computed using the NearestNeighbor (english or american spelling), Bilinear, Cubic, CubicSpline or Lanczos resampling algorithm. Default is NearestNeighbor.
ST_Resize — Resize a raster to a new width/height
ST_Transform — Reprojects a raster in a known spatial reference system to another known spatial reference system using specified resampling algorithm. Options are NearestNeighbor, Bilinear, Cubic, CubicSpline, Lanczos defaulting to NearestNeighbor.
10.8. Raster Band Editors
ST_SetBandNoDataValue — Sets the value for the given band that represents no data. Band 1 is assumed if no band is specified. To mark a band as having no nodata value, set the nodata value = NULL.
ST_SetBandIsNoData — Sets the isnodata flag of the band to TRUE.
ST_SetBandPath — Update the external path and band number of an out-db band
ST_SetBandIndex — Update the external band number of an out-db band
10.9. Raster Band Statistics and Analytics
ST_Count — Returns the number of pixels in a given band of a raster or raster coverage. If no band is specified defaults to band 1. If exclude_nodata_value is set to true, will only count pixels that are not equal to the nodata value.
ST_CountAgg — Aggregate. Returns the number of pixels in a given band of a set of rasters. If no band is specified defaults to band 1. If exclude_nodata_value is set to true, will only count pixels that are not equal to the NODATA value.
ST_Histogram — Returns a set of record summarizing a raster or raster coverage data distribution separate bin ranges. Number of bins are autocomputed if not specified.
ST_Quantile — Compute quantiles for a raster or raster table coverage in the context of the sample or population. Thus, a value could be examined to be at the raster's 25%, 50%, 75% percentile.
ST_SummaryStats — Returns summarystats consisting of count, sum, mean, stddev, min, max for a given raster band of a raster or raster coverage. Band 1 is assumed is no band is specified.
ST_SummaryStatsAgg — Aggregate. Returns summarystats consisting of count, sum, mean, stddev, min, max for a given raster band of a set of raster. Band 1 is assumed is no band is specified.
ST_ValueCount — Returns a set of records containing a pixel band value and count of the number of pixels in a given band of a raster (or a raster coverage) that have a given set of values. If no band is specified defaults to band 1. By default nodata value pixels are not counted. and all other values in the pixel are output and pixel band values are rounded to the nearest integer.
10.10. Raster Inputs
ST_RastFromWKB — Return a raster value from a Well-Known Binary (WKB) raster.
ST_RastFromHexWKB — Return a raster value from a Hex representation of Well-Known Binary (WKB) raster.
10.11. Raster Outputs
ST_AsBinary/ST_AsWKB — Return the Well-Known Binary (WKB) representation of the raster.
ST_AsHexWKB — Return the Well-Known Binary (WKB) in Hex representation of the raster.
ST_AsGDALRaster — Return the raster tile in the designated GDAL Raster format. Raster formats are one of those supported by your compiled library. Use ST_GDALDrivers() to get a list of formats supported by your library.
ST_AsJPEG — Return the raster tile selected bands as a single Joint Photographic Exports Group (JPEG) image (byte array). If no band is specified and 1 or more than 3 bands, then only the first band is used. If only 3 bands then all 3 bands are used and mapped to RGB.
ST_AsPNG — Return the raster tile selected bands as a single portable network graphics (PNG) image (byte array). If 1, 3, or 4 bands in raster and no bands are specified, then all bands are used. If more 2 or more than 4 bands and no bands specified, then only band 1 is used. Bands are mapped to RGB or RGBA space.
ST_AsTIFF — Return the raster selected bands as a single TIFF image (byte array). If no band is specified or any of specified bands does not exist in the raster, then will try to use all bands.
10.12. Raster Processing: Map Algebra
ST_Clip — Returns the raster clipped by the input geometry. If band number not is specified, all bands are processed. If crop is not specified or TRUE, the output raster is cropped.
ST_ColorMap — Creates a new raster of up to four 8BUI bands (grayscale, RGB, RGBA) from the source raster and a specified band. Band 1 is assumed if not specified.
ST_Grayscale — Creates a new one-8BUI band raster from the source raster and specified bands representing Red, Green and Blue
ST_Intersection — Returns a raster or a set of geometry-pixelvalue pairs representing the shared portion of two rasters or the geometrical intersection of a vectorization of the raster and a geometry.
ST_MapAlgebra (callback function version) — Callback function version - Returns a one-band raster given one or more input rasters, band indexes and one user-specified callback function.
ST_MapAlgebra (expression version) — Expression version - Returns a one-band raster given one or two input rasters, band indexes and one or more user-specified SQL expressions.
ST_MapAlgebraExpr — 1 raster band version: Creates a new one band raster formed by applying a valid PostgreSQL algebraic operation on the input raster band and of pixeltype provided. Band 1 is assumed if no band is specified.
ST_MapAlgebraExpr — 2 raster band version: Creates a new one band raster formed by applying a valid PostgreSQL algebraic operation on the two input raster bands and of pixeltype provided. band 1 of each raster is assumed if no band numbers are specified. The resulting raster will be aligned (scale, skew and pixel corners) on the grid defined by the first raster and have its extent defined by the "extenttype" parameter. Values for "extenttype" can be: INTERSECTION, UNION, FIRST, SECOND.
ST_MapAlgebraFct — 1 band version - Creates a new one band raster formed by applying a valid PostgreSQL function on the input raster band and of pixeltype prodived. Band 1 is assumed if no band is specified.
ST_MapAlgebraFct — 2 band version - Creates a new one band raster formed by applying a valid PostgreSQL function on the 2 input raster bands and of pixeltype prodived. Band 1 is assumed if no band is specified. Extent type defaults to INTERSECTION if not specified.
ST_MapAlgebraFctNgb — 1-band version: Map Algebra Nearest Neighbor using user-defined PostgreSQL function. Return a raster which values are the result of a PLPGSQL user function involving a neighborhood of values from the input raster band.
ST_Reclass — Creates a new raster composed of band types reclassified from original. The nband is the band to be changed. If nband is not specified assumed to be 1. All other bands are returned unchanged. Use case: convert a 16BUI band to a 8BUI and so forth for simpler rendering as viewable formats.
ST_Union — Returns the union of a set of raster tiles into a single raster composed of 1 or more bands.
10.13. Built-in Map Algebra Callback Functions
ST_Distinct4ma — Raster processing function that calculates the number of unique pixel values in a neighborhood.
ST_InvDistWeight4ma — Raster processing function that interpolates a pixel's value from the pixel's neighborhood.
ST_Max4ma — Raster processing function that calculates the maximum pixel value in a neighborhood.
ST_Mean4ma — Raster processing function that calculates the mean pixel value in a neighborhood.
ST_Min4ma — Raster processing function that calculates the minimum pixel value in a neighborhood.
ST_MinDist4ma — Raster processing function that returns the minimum distance (in number of pixels) between the pixel of interest and a neighboring pixel with value.
ST_Range4ma — Raster processing function that calculates the range of pixel values in a neighborhood.
ST_StdDev4ma — Raster processing function that calculates the standard deviation of pixel values in a neighborhood.
ST_Sum4ma — Raster processing function that calculates the sum of all pixel values in a neighborhood.
10.14. Raster Processing: DEM (Elevation)
ST_Aspect — Returns the aspect (in degrees by default) of an elevation raster band. Useful for analyzing terrain.
ST_HillShade — Returns the hypothetical illumination of an elevation raster band using provided azimuth, altitude, brightness and scale inputs.
ST_Roughness — Returns a raster with the calculated "roughness" of a DEM.
ST_Slope — Returns the slope (in degrees by default) of an elevation raster band. Useful for analyzing terrain.
ST_TPI — Returns a raster with the calculated Topographic Position Index.
ST_TRI — Returns a raster with the calculated Terrain Ruggedness Index.
10.15. Raster Processing: Raster to Geometry
Box3D — Returns the box 3d representation of the enclosing box of the raster.
ST_ConvexHull — Return the convex hull geometry of the raster including pixel values equal to BandNoDataValue. For regular shaped and non-skewed rasters, this gives the same result as ST_Envelope so only useful for irregularly shaped or skewed rasters.
ST_DumpAsPolygons — Returns a set of geomval (geom,val) rows, from a given raster band. If no band number is specified, band num defaults to 1.
ST_Envelope — Returns the polygon representation of the extent of the raster.
ST_MinConvexHull — Return the convex hull geometry of the raster excluding NODATA pixels.
ST_Polygon — Returns a multipolygon geometry formed by the union of pixels that have a pixel value that is not no data value. If no band number is specified, band num defaults to 1.
10.16. Raster Operators
&& — Returns TRUE if A's bounding box intersects B's bounding box.
&< — Returns TRUE if A's bounding box is to the left of B's.
&> — Returns TRUE if A's bounding box is to the right of B's.
= — Returns TRUE if A's bounding box is the same as B's. Uses double precision bounding box.
@ — Returns TRUE if A's bounding box is contained by B's. Uses double precision bounding box.
~= — Returns TRUE if A's bounding box is the same as B's.
~ — Returns TRUE if A's bounding box is contains B's. Uses double precision bounding box.
10.17. Raster and Raster Band Spatial Relationships
ST_Contains — Return true if no points of raster rastB lie in the exterior of raster rastA and at least one point of the interior of rastB lies in the interior of rastA.
ST_ContainsProperly — Return true if rastB intersects the interior of rastA but not the boundary or exterior of rastA.
ST_Covers — Return true if no points of raster rastB lie outside raster rastA.
ST_CoveredBy — Return true if no points of raster rastA lie outside raster rastB.
ST_Disjoint — Return true if raster rastA does not spatially intersect rastB.
ST_Intersects — Return true if raster rastA spatially intersects raster rastB.
ST_Overlaps — Return true if raster rastA and rastB intersect but one does not completely contain the other.
ST_Touches — Return true if raster rastA and rastB have at least one point in common but their interiors do not intersect.
ST_SameAlignment — Returns true if rasters have same skew, scale, spatial ref, and offset (pixels can be put on same grid without cutting into pixels) and false if they don't with notice detailing issue.
ST_NotSameAlignmentReason — Returns text stating if rasters are aligned and if not aligned, a reason why.
ST_Within — Return true if no points of raster rastA lie in the exterior of raster rastB and at least one point of the interior of rastA lies in the interior of rastB.
ST_DWithin — Return true if rasters rastA and rastB are within the specified distance of each other.
ST_DFullyWithin — Return true if rasters rastA and rastB are fully within the specified distance of each other.
10.18. Raster Tips
10.18.1. Out-DB Rasters
11. Extras de PostGIS
11.1. Normalizador de Direcciones
11.1.1. Cómo funciona el analizador
11.1.2. Tipos de Address Standardizer
11.1.3. Tipos de Address Standardizer
11.1.4. Funciones de Address Standardizer
11.2. Geocodificador Tiger
Drop_Indexes_Generate_Script — Generates a script that drops all non-primary key and non-unique indexes on tiger schema and user specified schema. Defaults schema to tiger_data if no schema is specified.
Drop_Nation_Tables_Generate_Script — Generates a script that drops all tables in the specified schema that start with county_all, state_all or state code followed by county or state.
Drop_State_Tables_Generate_Script — Generates a script that drops all tables in the specified schema that are prefixed with the state abbreviation. Defaults schema to tiger_data if no schema is specified.
Geocode — Takes in an address as a string (or other normalized address) and outputs a set of possible locations which include a point geometry in NAD 83 long lat, a normalized address for each, and the rating. The lower the rating the more likely the match. Results are sorted by lowest rating first. Can optionally pass in maximum results, defaults to 10, and restrict_region (defaults to NULL)
Geocode_Intersection — Takes in 2 streets that intersect and a state, city, zip, and outputs a set of possible locations on the first cross street that is at the intersection, also includes a geomout as the point location in NAD 83 long lat, a normalized_address (addy) for each location, and the rating. The lower the rating the more likely the match. Results are sorted by lowest rating first. Can optionally pass in maximum results, defaults to 10. Uses Tiger data (edges, faces, addr), PostgreSQL fuzzy string matching (soundex, levenshtein).
Get_Geocode_Setting — Returns value of specific setting stored in tiger.geocode_settings table.
Get_Tract — Returns census tract or field from tract table of where the geometry is located. Default to returning short name of tract.
Install_Missing_Indexes — Finds all tables with key columns used in geocoder joins and filter conditions that are missing used indexes on those columns and will add them.
Loader_Generate_Census_Script — Generates a shell script for the specified platform for the specified states that will download Tiger census state tract, bg, and tabblocks data tables, stage and load into tiger_data schema. Each state script is returned as a separate record.
Loader_Generate_Script — Generates a shell script for the specified platform for the specified states that will download Tiger data, stage and load into tiger_data schema. Each state script is returned as a separate record. Latest version supports Tiger 2010 structural changes and also loads census tract, block groups, and blocks tables.
Loader_Generate_Nation_Script — Generates a shell script for the specified platform that loads in the county and state lookup tables.
Missing_Indexes_Generate_Script — Finds all tables with key columns used in geocoder joins that are missing indexes on those columns and will output the SQL DDL to define the index for those tables.
Normalize_Address — Given a textual street address, returns a composite norm_addy type that has road suffix, prefix and type standardized, street, streetname etc. broken into separate fields. This function will work with just the lookup data packaged with the tiger_geocoder (no need for tiger census data).
Pagc_Normalize_Address — Given a textual street address, returns a composite norm_addy type that has road suffix, prefix and type standardized, street, streetname etc. broken into separate fields. This function will work with just the lookup data packaged with the tiger_geocoder (no need for tiger census data). Requires address_standardizer extension.
Pprint_Addy — Given a norm_addy composite type object, returns a pretty print representation of it. Usually used in conjunction with normalize_address.
Reverse_Geocode — Takes a geometry point in a known spatial ref sys and returns a record containing an array of theoretically possible addresses and an array of cross streets. If include_strnum_range = true, includes the street range in the cross streets.
Topology_Load_Tiger — Loads a defined region of tiger data into a PostGIS Topology and transforming the tiger data to spatial reference of the topology and snapping to the precision tolerance of the topology.
Set_Geocode_Setting — Sets a setting that affects behavior of geocoder functions.
12. PostGIS Special Functions Index
12.1. PostGIS Aggregate Functions
12.2. PostGIS Window Functions
12.3. PostGIS SQL-MM Compliant Functions
12.4. PostGIS Geography Support Functions
12.5. PostGIS Raster Support Functions
12.6. PostGIS Geometry / Geography / Raster Dump Functions
12.7. PostGIS Box Functions
12.8. PostGIS Functions that support 3D
12.9. PostGIS Curved Geometry Support Functions
12.10. PostGIS Polyhedral Surface Support Functions
12.11. PostGIS Function Support Matrix
12.12. New, Enhanced or changed PostGIS Functions
12.12.1. PostGIS Functions new or enhanced in 3.4
12.12.2. PostGIS Functions new or enhanced in 3.3
12.12.3. PostGIS Functions new or enhanced in 3.2
12.12.4. PostGIS Functions new or enhanced in 3.1
12.12.5. PostGIS Functions new or enhanced in 3.0
12.12.6. PostGIS Functions new or enhanced in 2.5
12.12.7. PostGIS Functions new or enhanced in 2.4
12.12.8. PostGIS Functions new or enhanced in 2.3
12.12.9. PostGIS Functions new or enhanced in 2.2
12.12.10. PostGIS Functions new or enhanced in 2.1
12.12.11. PostGIS Functions new or enhanced in 2.0
12.12.12. PostGIS Functions new or enhanced in 1.5
12.12.13. PostGIS Functions new or enhanced in 1.4
12.12.14. PostGIS Functions new or enhanced in 1.3
13. Informar de problemas
13.1. Informar sobre errores de software
13.2. Informando sobre problemas de documentación
A. Apéndice
A.1. PostGIS 3.4.0