Chapter 7. Referência do PostGIS

Table of Contents

As funções descritas abaixo são as que um usuário do PostGIS devem precisar. Existem outras funções que são necessárias para suportar os objetos PostGIS mas que não são de uso comum pelo usuário.

[Note]

O PostGIS iniciou uma transição da convenção de nomenclatura existente para uma convenção em torno do SQL-MM. Como resultado, a maioria das funções que você conhece e ama foram renomeadas usando o padrão de tipo espacial (com o prefixo ST). As funções anteriores ainda existem, porém não são listadas nesta documentação onde as funções atualizadas são equivalentes. As funções que não possuem prefixo ST_ não listadas nesta documentação estão obsoletas e serão removidas em futuros lançamentos, então PAREM DE UTILIZÁ-LAS.

7.1. PostgreSQL PostGIS Geometry/Geography/Box Types

Abstract

Essa seção lista os tipos de dados PostgreSQL instalados pelo PostGIS. Note que descrevemos que o comportamento desses é muito importante , especialmente quando designando suas próprias funções.

Each data type describes its type casting behavior. A type cast converts values of one data type into another type. PostgreSQL allows defining casting behavior for custom types, along with the functions used to convert type values. Casts can have automatic behavior, which allows automatic conversion of a function argument to a type supported by the function.

Some casts have explicit behavior, which means the cast must be specified using the syntax CAST(myval As sometype) or myval::sometype. Explicit casting avoids the issue of ambiguous casts, which can occur when using an overloaded function which does not support a given type. For example, a function may accept a box2d or a box3d, but not a geometry. Since geometry has an automatic cast to both box types, this produces an "ambiguous function" error. To prevent the error use an explicit cast to the desired box type.

All data types can be cast to text, so this does not need to be specified explicitly.

  • box2d — The type representing a 2-dimensional bounding box.
  • box3d — The type representing a 3-dimensional bounding box.
  • geometry — geografia é um tipo de dado espacial usado para representar uma característica no sistema de coordenada da terra-redonda.
  • 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. Funções de Gestão

Abstract

These functions assist in defining tables containing geometry columns.

  • AddGeometryColumn — Remove uma coluna geometria de uma spatial table.
  • DropGeometryColumn — Remove uma coluna geometria de uma spatial table.
  • DropGeometryTable — Derruba uma table e todas suas referências em geometry_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. Construtores de geometria

  • ST_Collect — Creates a GeometryCollection or Multi* geometry from a set of geometries.
  • ST_LineFromMultiPoint — Cria uma linestring de um multiponto geométrico.
  • ST_MakeEnvelope — Cria um polígono retangular formado a partir dos mínimos e máximos dados. Os valores de entrada devem ser em SRS especificados pelo SRID.
  • ST_MakeLine — Cria uma Linestring de ponto, multiponto ou linha das geometrias.
  • ST_MakePoint — Creates a 2D, 3DZ or 4D Point.
  • ST_MakePointM — Cria um ponto com uma coordenada x y e 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. Acessors de Geometria

  • GeometryType — Retorna o tipo de geometria de valor ST_Geometry.
  • ST_Boundary — Retorna o encerramento da borda combinatória dessa geometria.
  • ST_BoundingDiagonal — Retorna a diagonal da geometria fornecida da caixa limitada.
  • ST_CoordDim — Retorna a dimensão da coordenada do valor ST_Geometry.
  • ST_Dimension — Retorna a dimensão da coordenada do valor ST_Geometry.
  • ST_Dump — Returns a set of geometry_dump rows for the components of a geometry.
  • ST_DumpPoints — Retorna um texto resumo dos conteúdos da geometria.
  • ST_DumpSegments — Retorna um texto resumo dos conteúdos da geometria.
  • ST_DumpRings — Returns a set of geometry_dump rows for the exterior and interior rings of a Polygon.
  • ST_EndPoint — Retorna o número de pontos em um valor ST_LineString ou ST_CircularString.
  • ST_Envelope — Retorna uma geometria representando a precisão da dobrada (float8) da caixa limitada da geometria fornecida.
  • ST_ExteriorRing — Retorna o número de anéis interiores de um polígono.
  • ST_GeometryN — Retorna o tipo de geometria de valor ST_Geometry.
  • ST_GeometryType — Retorna o tipo de geometria de valor ST_Geometry.
  • ST_HasArc — Tests if a geometry contains a circular arc
  • ST_InteriorRingN — Retorna o número de anéis interiores de um polígono.
  • ST_NumCurves — Return the number of component curves in a CompoundCurve.
  • ST_CurveN — Returns the Nth component curve geometry of a CompoundCurve.
  • ST_IsClosed — Retorna VERDADEIRO se os pontos de começo e fim da LINESTRING são coincidentes. Para superfície poliédrica está fechada (volumétrica).
  • ST_IsCollection — Retorna verdadeiro se essa geometria é uma coleção vazia, polígono, ponto etc.
  • ST_IsEmpty — Tests if a geometry is empty.
  • ST_IsPolygonCCW — Tests if Polygons have exterior rings oriented counter-clockwise and interior rings oriented clockwise.
  • ST_IsPolygonCW — Tests if Polygons have exterior rings oriented clockwise and interior rings oriented counter-clockwise.
  • ST_IsRing — Tests if a LineString is closed and simple.
  • ST_IsSimple — Retorna (VERDADEIRA) se essa geometria não tem nenhum ponto irregular, como auto intersecção ou tangenciação.
  • ST_M — Returns the M coordinate of a Point.
  • ST_MemSize — Retorna o tipo de geometria de valor ST_Geometry.
  • ST_NDims — Retorna a dimensão da coordenada do valor ST_Geometry.
  • ST_NPoints — Retorna o número de pontos (vértices) em uma geometria.
  • ST_NRings — Retorna o número de anéis interiores de um polígono.
  • ST_NumGeometries — Retorna o número de pontos em uma geometria. Funciona para todas as geometrias.
  • ST_NumInteriorRings — Retorna o número de anéis interiores de um polígono.
  • ST_NumInteriorRing — Retorna o número de anéis interiores de um polígono na geometria. Sinônimo para ST_NumInteriorRings.
  • ST_NumPatches — Retorna o número de faces em uma superfícies poliédrica. Retornará nulo para geometrias não poliédricas.
  • ST_NumPoints — Retorna o número de pontos em um valor ST_LineString ou ST_CircularString.
  • ST_PatchN — Retorna o tipo de geometria de valor ST_Geometry.
  • ST_PointN — Retorna o número de pontos em um valor ST_LineString ou ST_CircularString.
  • ST_Points — Retorna uma multilinestring contendo todas as coordenadas de uma geometria.
  • ST_StartPoint — Returns the first point of a LineString.
  • ST_Summary — Retorna um texto resumo dos conteúdos da geometria.
  • 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 — Retorna a dimensão da coordenada do valor ST_Geometry.
  • ST_HasZ — Checks if a geometry has a Z dimension.
  • ST_HasM — Checks if a geometry has an M (measure) dimension.

7.5. Editores de geometria

Abstract

These functions create modified geometries by changing type, structure or vertices.

  • ST_AddPoint — Adicione um ponto para uma LineString.
  • 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 — Força a geometria para o modo de 2 dimensões.
  • ST_Force3D — Força a geometria para um modo XYZ. Este é um apelido para a função ST_Force_3DZ.
  • ST_Force3DZ — Força as geometrias para o modo XYZ.
  • ST_Force3DM — Força as geometrias para o modo XYM.
  • ST_Force4D — Força as geometrias para o modo XYZM.
  • ST_ForceCollection — Converte a geometria para um GEOMETRYCOLLECTION.
  • ST_ForceCurve — Converte para cima uma geometria para seu tipo curvo, se aplicável.
  • ST_ForcePolygonCCW — Orients all exterior rings counter-clockwise and all interior rings clockwise.
  • ST_ForcePolygonCW — Orients all exterior rings clockwise and all interior rings counter-clockwise.
  • ST_ForceSFS — Força as geometrias a utilizarem os tipos disponíveis na especificação SFS 1.1.
  • ST_ForceRHR — Força a orientação dos vértices em um polígono a seguir a regra da mão direita.
  • ST_LineExtend — Returns a line extended forwards and backwards by specified distances.
  • ST_LineToCurve — Converts a linear geometry to a curved geometry.
  • ST_Multi — Restitui a geometria como uma MULTI* geometria.
  • ST_Normalize — Retorna a geometria na sua 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 — Retorna a geometria com a ordem dos vértices revertida.
  • ST_Segmentize — Returns a modified geometry/geography having no segment longer than a given distance.
  • ST_SetPoint — Substitui ponto de uma linestring com um dado ponto.
  • ST_ShiftLongitude — Shifts the longitude coordinates of a geometry between -180..180 and 0..360.
  • ST_WrapX — Envolve uma geometria em torno de um valor X.
  • ST_SnapToGrid — Rompe todos os pontos da geometria de entrada para uma rede regular.
  • ST_Snap — Rompe segmentos e vértices de geometria de entrada para vértices de uma geometria de referência.
  • ST_SwapOrdinates — Retorna uma versão da geometria dada com os valores ordenados dados trocados.

7.6. Geometry Validation

Abstract

These functions test whether geometries are valid according to the OGC SFS standard. They also provide information about the nature and location of invalidity. There is also a function to create a valid geometry out of an invalid one.

  • 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

Abstract

These functions work with the Spatial Reference System of geometries as defined in the spatial_ref_sys table.

  • 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

Abstract

These functions create geometry objects from various textual or binary formats.

7.8.1. Well-Known Text (WKT)

  • ST_BdPolyFromText — Constrói um polígono dada uma coleção arbitrária de linestrings fechadas como uma representação de texto de uma multilinestring bem conhecida.
  • ST_BdMPolyFromText — Constrói um polígono dada uma coleção arbitrária de linestrings fechadas como uma representação de texto de uma multilinestring bem conhecida.
  • ST_GeogFromText — Retorna um valor de geografia específico de uma representação bem conhecida de texto ou estendida (WKT).
  • ST_GeographyFromText — Retorna um valor de geografia específico de uma representação bem conhecida de texto ou estendida (WKT).
  • ST_GeomCollFromText — Makes a collection Geometry from collection WKT with the given SRID. If SRID is not given, it defaults to 0.
  • ST_GeomFromEWKT — Retorna um valor ST_Geometry especifico da representação de texto estendida bem conhecida (EWKT).
  • ST_GeomFromMARC21 — Takes MARC21/XML geographic data as input and returns a PostGIS geometry object.
  • ST_GeometryFromText — Retorna um valor ST_Geometry especifico da representação de texto estendida bem conhecida (EWKT). Isso é um heterônimo para ST_GeomFromText
  • ST_GeomFromText — Retorna um valor ST_Geometry específico da representação de texto bem conhecida (WKT).
  • ST_LineFromText — Faz uma geometria de uma representação WKT com a SRID dada. Se a SRID não for dada, isso leva a 0.
  • ST_MLineFromText — Retorna um valor específico ST_MultiLineString de uma representação WKT.
  • ST_MPointFromText — Makes a Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0.
  • ST_MPolyFromText — Makes a MultiPolygon Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0.
  • ST_PointFromText — Faz um ponto de um WKT com o SRID dado. Se o SRID não for dado, isso leva a desconhecido.
  • ST_PolygonFromText — Makes a Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0.
  • ST_WKTToSQL — Retorna um valor ST_Geometry especifico da representação de texto estendida bem conhecida (EWKT). Isso é um heterônimo para ST_GeomFromText

7.8.2. Well-Known Binary (WKB)

  • ST_GeogFromWKB — Cria uma ocasião geografia de uma geometria binária bem conhecida (WKB) ou binário estendido bem conhecido (EWKB).
  • ST_GeomFromEWKB — Retorna um valor ST_Geometry especifico da representação binária estendida bem conhecida (EWKB).
  • ST_GeomFromWKB — Criar uma geometria exemplo de um representação bem conhecida de geometria binária (WKB) e SRID opcional.
  • ST_LineFromWKB — Faz uma LINESTRING de uma WKB com o SRID dado
  • ST_LinestringFromWKB — Faz uma geometria de uma WKB com o SRID dado.
  • ST_PointFromWKB — Faz uma geometria a partir de um WKB com o SRID dado
  • ST_WKBToSQL — Retorna um valor ST_Geometry especifico da representação de texto binário bem conhecida (WKB). Isso é um heterônimo para ST_GeomFromWKB que não pega nenhum srid

7.8.3. Other Formats

  • ST_Box2dFromGeoHash — Retorna uma CAIXA2D de uma string GeoHash.
  • ST_GeomFromGeoHash — Retorna uma geometria de uma string GeoHash.
  • ST_GeomFromGML — Utiliza como entrada uma representação GML de geometria e como saída um objeto de geometria PostGIS
  • ST_GeomFromGeoJSON — Utiliza como entrada uma representação geojson de uma geometria e como saída um objeto de geometria PostGIS
  • ST_GeomFromKML — Utiliza como entrada uma representação KML de geometria e como saída um objeto de geometria PostGIS
  • ST_GeomFromTWKB — Cria uma ocasião de uma TWKB ("Tiny Well-Known Binary") representação de geometria.
  • ST_GMLToSQL — Retorna um valor ST_Geometry específico da representação GML. Esse é um heterônimo para ST_GeomFromGML
  • ST_LineFromEncodedPolyline — Cria uma LineString de uma Encoded Polyline.
  • ST_PointFromGeoHash — Retorna um ponto de uma string GeoHash.
  • ST_FromFlatGeobufToTable — Creates a table based on the structure of FlatGeobuf data.
  • ST_FromFlatGeobuf — Reads FlatGeobuf data.

7.9. Geometry Output

Abstract

These functions convert geometry objects into various textual or binary formats.

7.9.1. Well-Known Text (WKT)

  • ST_AsEWKT — Retorna a representação de texto bem conhecida (WKT) da geometria com os meta dados SRID.
  • ST_AsText — Retorna a representação de texto bem conhecida (WKT) da geometria/geografia sem os meta dados do SRID.

7.9.2. Well-Known Binary (WKB)

  • ST_AsBinary — Return the OGC/ISO Well-Known Binary (WKB) representation of the geometry/geography without SRID meta data.
  • ST_AsEWKB — Return the Extended Well-Known Binary (EWKB) representation of the geometry with SRID meta data.
  • ST_AsHEXEWKB — Retorna uma geometria no formato HEXEWKB (como texto) usando little-endian (NDR) ou big-endian (XDR) encoding.

7.9.3. Other Formats

  • ST_AsEncodedPolyline — Retorna uma Polilinha Encoded de uma geometria LineString.
  • ST_AsFlatGeobuf — Return a FlatGeobuf representation of a set of rows.
  • ST_AsGeobuf — Return a Geobuf representation of a set of rows.
  • ST_AsGeoJSON — Return a geometry or feature in GeoJSON format.
  • ST_AsGML — Retorna a geometria como uma versão GML com 2 ou 3 elementos.
  • ST_AsKML — Retorna a geometria como uma versão GML com 2 ou 3 elementos.
  • ST_AsLatLonText — Retorna a representação de Graus, Minutos, Segundos do ponto dado.
  • ST_AsMARC21 — Returns geometry as a MARC21/XML record with a geographic datafield (034).
  • ST_AsMVTGeom — Transforms a geometry into the coordinate space of a MVT tile.
  • ST_AsMVT — Aggregate function returning a MVT representation of a set of rows.
  • ST_AsSVG — Returns SVG path data for a geometry.
  • ST_AsTWKB — Retorna a geometria como TWKB, também conhecido como "Tiny Well-Known Binary"
  • ST_AsX3D — Retorna uma geometria em X3D nó xml formato do elemento: ISO-IEC-19776-1.2-X3DEncodings-XML
  • ST_GeoHash — Retorna uma representação GeoHash da geometria.

7.10. Operadores

7.10.1. Bounding Box Operators

  • && — Retorna VERDADE se a caixa limitadora 2D de A intersecta a caixa limitadora 2D de B.
  • &&(geometry,box2df) — Returns TRUE if a geometry's (cached) 2D bounding box intersects a 2D float precision bounding box (BOX2DF).
  • &&(box2df,geometry) — Returns TRUE if a 2D float precision bounding box (BOX2DF) intersects a geometry's (cached) 2D bounding box.
  • &&(box2df,box2df) — Returns TRUE if two 2D float precision bounding boxes (BOX2DF) intersect each other.
  • &&& — Retorna VERDADE se a caixa limitadora n-D de A intersecta a caixa limitadora n-D de B.
  • &&&(geometry,gidx) — Returns TRUE if a geometry's (cached) n-D bounding box intersects a n-D float precision bounding box (GIDX).
  • &&&(gidx,geometry) — Returns TRUE if a n-D float precision bounding box (GIDX) intersects a geometry's (cached) n-D bounding box.
  • &&&(gidx,gidx) — Returns TRUE if two n-D float precision bounding boxes (GIDX) intersect each other.
  • &< — Retorna VERDADE se a caixa limitadora de A sobrepõe ou está à esquerda de B.
  • &<| — Retorna VERDADE se a caixa limitadora de A sobrepõe ou está abaixo de B.
  • &> — Retorna VERDADE se a caixa limitadora de A sobrepõe ou está à direita de B.
  • << — Retorna VERDADE se uma caixa limitadora de A está estritamente à esquerda da de B.
  • <<| — Retorna VERDADE se uma caixa limitadora de A está estritamente abaixo da de B.
  • = — Returns TRUE if the coordinates and coordinate order geometry/geography A are the same as the coordinates and coordinate order of geometry/geography B.
  • >> — Returns TRUE if A's bounding box is strictly to the right of B's.
  • @ — Retorna VERDADE se uma caixa limitadora de A está contida pela de B.
  • @(geometry,box2df) — Returns TRUE if a geometry's 2D bounding box is contained into a 2D float precision bounding box (BOX2DF).
  • @(box2df,geometry) — Returns TRUE if a 2D float precision bounding box (BOX2DF) is contained into a geometry's 2D bounding box.
  • @(box2df,box2df) — Returns TRUE if a 2D float precision bounding box (BOX2DF) is contained into another 2D float precision bounding box.
  • |&> — Retorna VERDADE se a caixa limitadora de A sobrepõe ou está acima de B.
  • |>> — Retorna VERDADE se uma caixa limitadora de A está estritamente acima da de B.
  • ~ — Retorna VERDADE se uma caixa limitadora de A contém a de B.
  • ~(geometry,box2df) — Returns TRUE if a geometry's 2D bonding box contains a 2D float precision bounding box (GIDX).
  • ~(box2df,geometry) — Returns TRUE if a 2D float precision bounding box (BOX2DF) contains a geometry's 2D bonding box.
  • ~(box2df,box2df) — Returns TRUE if a 2D float precision bounding box (BOX2DF) contains another 2D float precision bounding box (BOX2DF).
  • ~= — Retorna VERDADE se a caixa limitadora de A é a mesma de B.

7.10.2. Operadores

  • <-> — Retorna a distância 2D entre A e B.
  • |=| — Retorna a distância entre As trajetórias A e B ao ponto de aproximação mais perto.
  • <#> — Retorna a distância 2D entre as caixas limitadoras de A e B.
  • <<->> — Returns the n-D distance between the A and B geometries or bounding boxes

7.11. Spatial Relationships

Abstract

These functions determine spatial relationships between geometries.

7.11.1. Topological Relationships

  • ST_3DIntersects — Tests if two geometries spatially intersect in 3D - only for points, linestrings, polygons, polyhedral surface (area)
  • ST_Contains — Tests if every point of B lies in A, and their interiors have a point in common
  • ST_ContainsProperly — Tests if every point of B lies in the interior of A
  • ST_CoveredBy — Tests if every point of A lies in B
  • ST_Covers — Tests if every point of B lies in A
  • ST_Crosses — Tests if two geometries have some, but not all, interior points in common
  • ST_Disjoint — Tests if two geometries have no points in common
  • ST_Equals — Tests if two geometries include the same set of points
  • ST_Intersects — Tests if two geometries intersect (they have at least one point in common)
  • ST_LineCrossingDirection — Returns a number indicating the crossing behavior of two LineStrings
  • ST_OrderingEquals — Tests if two geometries represent the same geometry and have points in the same directional order
  • ST_Overlaps — Tests if two geometries have the same dimension and intersect, but each has at least one point not in the other
  • ST_Relate — Tests if two geometries have a topological relationship matching an Intersection Matrix pattern, or computes their Intersection Matrix
  • ST_RelateMatch — Tests if a DE-9IM Intersection Matrix matches an Intersection Matrix pattern
  • ST_Touches — Tests if two geometries have at least one point in common, but their interiors do not intersect
  • ST_Within — Tests if every point of A lies in B, and their interiors have a point in common

7.11.2. Distance Relationships

  • ST_3DDWithin — Tests if two 3D geometries are within a given 3D distance
  • ST_3DDFullyWithin — Tests if two 3D geometries are entirely within a given 3D distance
  • ST_DFullyWithin — Tests if a geometry is entirely inside a distance of another
  • ST_DWithin — Tests if two geometries are within a given distance
  • ST_PointInsideCircle — Tests if a point geometry is inside a circle defined by a center and radius

7.12. Measurement Functions

Abstract

These functions compute measurements of distance, area and angles. There are also functions to compute geometry values determined by measurements.

  • ST_Area — Retorna o centro geométrico de uma geometria.
  • ST_Azimuth — Retorna a menor linha 2-dimensional entre duas geometrias
  • ST_Angle — Retorna a linha 3-dimensional mais longa entre duas geometrias
  • 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 — Retorna o ponto 3 dimensional em g1 que é o mais próximo de g2. Este é o primeiro ponto da linha mais curta em três dimensões.
  • ST_Distance — Retorna a linha 3-dimensional mais longa entre duas geometrias
  • ST_3DDistance — Para tipo geometria, retorna a menor distância cartesiana 3-dimensional (baseado no sistema de referência espacial) entre duas geometrias em unidades projetadas.
  • ST_DistanceSphere — Retorna a menor distância entre duas geometrias lon/lat dado um esferoide específico. As versões anteriores a 1.5 só suportam pontos.
  • ST_DistanceSpheroid — Retorna a menor distância entre duas geometrias lon/lat dado um esferoide específico. As versões anteriores a 1.5 só suportam pontos.
  • ST_FrechetDistance — Retorna a menor linha 3-dimensional entre duas geometrias
  • ST_HausdorffDistance — Retorna a menor linha 3-dimensional entre duas geometrias
  • ST_Length — Retorna o centro geométrico de uma geometria.
  • ST_Length2D — Retorna o comprimento 2-dimensional da geometria se for uma linestring ou multi-linestring. Isto é um heterônimo para ST_Length
  • ST_3DLength — Retorna o centro geométrico de uma geometria.
  • ST_LengthSpheroid — Retorna o centro geométrico de uma geometria.
  • ST_LongestLine — Retorna a linha 3-dimensional mais longa entre duas geometrias
  • ST_3DLongestLine — Retorna a linha 3-dimensional mais longa entre duas geometrias
  • ST_MaxDistance — Retorna a maior distância 2-dimensional entre duas geometrias em unidades projetadas.
  • ST_3DMaxDistance — Para tipo de geometria retorna a maior distância 3-dimensional cartesiana (baseada na referência espacial) entre duas geometrias em unidade projetadas.
  • ST_MinimumClearance — Retorna a liquidação mínima de uma geometria, uma medida de uma robustez de uma geometria.
  • ST_MinimumClearanceLine — Retorna a LineString de dois pontos abrangendo a liquidação mínima de uma geometria.
  • 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 — Retorna o centro geométrico de uma geometria.
  • ST_ShortestLine — Retorna a menor linha 2-dimensional entre duas geometrias
  • ST_3DShortestLine — Retorna a menor linha 3-dimensional entre duas geometrias

7.13. Overlay Functions

Abstract

These functions compute results arising from the overlay of two geometries. These are also known as point-set theoretic boolean operations. Some related functions are also provided.

  • 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. Processamento de Geometria

Abstract

These functions compute geometric constructions, or alter geometry size or shape.

  • 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 — Retorna o centro geométrico de uma geometria.
  • 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 — Retorna a mediana de um MultiPonto.
  • ST_LineMerge — Return the lines formed by sewing together a MultiLineString.
  • ST_MaximumInscribedCircle — Retorna o centro geométrico de uma geometria.
  • 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 — Retorna uma coleção contendo caminhos compartilhados pelas duas linestrings/multilinestrings de entrada.
  • ST_Simplify — Returns a simplified representation of a geometry, using the Douglas-Peucker algorithm.
  • ST_SimplifyPreserveTopology — Returns a simplified and valid representation 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 representation 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

Abstract

These functions operate on sets of polygonal geometry that form "implicit coverages". To form a valid coverage polygons must not overlap, and the vertices of adjacent edges must match exactly. Coverages are fast to process, and can be operated on with window functions, which retain the coverage topology inside the window partition while altering the edges.

  • 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

Abstract

These functions change the position and shape of geometries using 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

Abstract

These functions implement clustering algorithms for sets of geometries.

  • 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

Abstract

These functions produce or operate on bounding boxes. They can also provide and accept geometry values, by using automatic or explicit casts.

See also Section 13.7, “PostGIS 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. Referência linear

7.20. Trajectory Functions

Abstract

These functions support working with trajectories. A trajectory is a linear geometry with increasing measures (M value) on each coordinate. Spatio-temporal data can be modeled by using relative times (such as the epoch) as the measure values.

  • 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. Version Functions

Abstract

These functions report and upgrade PostGIS versions.

7.22. Grandes Variáveis Unificadas Personalizadas do PostGIS (GUCs)

Abstract

Essa seção lista as Grandes Variáveis Unificadas Personalizadas (GUC) do PostGIS personalizado. Elas podem ser globalmente configuradas, por banco de dados, por sessão ou por transação. A melhor configuração a nível global ou database.

  • postgis.backend — O backend para fazer a manutenção de uma função onde GEOS e SFCGAL sobrepõe. Opções: geos ou sfcgal. Padrão para geos.
  • postgis.gdal_datapath — Uma opção de configuração para designar o valor da opção GDAL_DATA do GDAL. Se não funcionar, a variável ambiental GDAL_DATA é usada.
  • postgis.gdal_enabled_drivers — Uma opção de configuração para estabelecer os drivers GDAL ativados no ambiente POstGIS. Afeta a variável GDAL_SKIP do GDAL.
  • postgis.enable_outdb_rasters — Uma opção de configuração booleana para ativar o acesso ao out-db raster bands.
  • postgis.gdal_vsi_options — Uma opção de configuração booleana para ativar o acesso ao out-db raster bands.

7.23. Troubleshooting Functions

Abstract

These functions are utilities for troubleshooting and repairing geometry data. They are only needed if the geometry data is corrupted in some way, which should never happen under normal circumstances.

  • PostGIS_AddBBox — Adicionar o retângulo envolvente a geometria.
  • PostGIS_DropBBox — Exclui o cache de retângulos envolventes da geometria.
  • PostGIS_HasBBox — Retorna verdadeiro se o retângulo desta geometria está cacheado. FALSO caso contrário.