[1] | 1 | .. _postgis-functions: |
---|
| 2 | |
---|
| 3 | Appendix A: PostGIS Functions |
---|
| 4 | ============================= |
---|
| 5 | |
---|
| 6 | Constructors |
---|
| 7 | ------------ |
---|
| 8 | |
---|
| 9 | :command:`ST_MakePoint(Longitude, Latitude)` |
---|
| 10 | Returns a new point. Note the order of the coordinates (longitude then latitude). |
---|
| 11 | |
---|
| 12 | :command:`ST_GeomFromText(WellKnownText, srid)` |
---|
| 13 | Returns a new geometry from a standard WKT string and srid. |
---|
| 14 | |
---|
| 15 | :command:`ST_SetSRID(geometry, srid)` |
---|
| 16 | Updates the srid on a geometry. Returns the same geometry. This does not alter the coordinates of the geometry, it just updates the srid. This function is useful for conditioning geometries created without an srid. |
---|
| 17 | |
---|
| 18 | :command:`ST_Expand(geometry, Radius)` |
---|
| 19 | Returns a new geometry that is an expanded bounding box of the input geometry. This function is useful for creating envelopes for use in indexed searches. |
---|
| 20 | |
---|
| 21 | Outputs |
---|
| 22 | ------- |
---|
| 23 | |
---|
| 24 | :command:`ST_AsText(geometry)` |
---|
| 25 | Returns a geometry in a human-readable text format. |
---|
| 26 | |
---|
| 27 | :command:`ST_AsGML(geometry)` |
---|
| 28 | Returns a geometry in standard OGC :term:`GML` format. |
---|
| 29 | |
---|
| 30 | :command:`ST_AsGeoJSON(geometry)` |
---|
| 31 | Returns a geometry to a standard `GeoJSON <http://geojson.org>`_ format. |
---|
| 32 | |
---|
| 33 | Measurements |
---|
| 34 | ------------ |
---|
| 35 | |
---|
| 36 | :command:`ST_Area(geometry)` |
---|
| 37 | Returns the area of the geometry in the units of the spatial reference system. |
---|
| 38 | |
---|
| 39 | :command:`ST_Length(geometry)` |
---|
| 40 | Returns the length of the geometry in the units of the spatial reference system. |
---|
| 41 | |
---|
| 42 | :command:`ST_Perimeter(geometry)` |
---|
| 43 | Returns the perimeter of the geometry in the units of the spatial reference system. |
---|
| 44 | |
---|
| 45 | :command:`ST_NumPoints(linestring)` |
---|
| 46 | Returns the number of vertices in a linestring. |
---|
| 47 | |
---|
| 48 | :command:`ST_NumRings(polygon)` |
---|
| 49 | Returns the number of rings in a polygon. |
---|
| 50 | |
---|
| 51 | :command:`ST_NumGeometries(geometry)` |
---|
| 52 | Returns the number of geometries in a geometry collection. |
---|
| 53 | |
---|
| 54 | Relationships |
---|
| 55 | ------------- |
---|
| 56 | |
---|
| 57 | :command:`ST_Distance(geometry, geometry)` |
---|
| 58 | Returns the distance between two geometries in the units of the spatial reference system. |
---|
| 59 | |
---|
| 60 | :command:`ST_DWithin(geometry, geometry, radius)` |
---|
| 61 | Returns true if the geometries are within the radius distance of one another, otherwise false. |
---|
| 62 | |
---|
| 63 | :command:`ST_Intersects(geometry, geometry)` |
---|
| 64 | Returns true if the geometries are not disjoint, otherwise false. |
---|
| 65 | |
---|
| 66 | :command:`ST_Contains(geometry, geometry)` |
---|
| 67 | Returns true if the first geometry fully contains the second geometry, otherwise false. |
---|
| 68 | |
---|
| 69 | :command:`ST_Crosses(geometry, geometry)` |
---|
| 70 | Returns true if a line or polygon boundary crosses another line or polygon boundary, otherwise false. |
---|