首页 > 其他 > 详细

PostGIS Intro (一) -- geometries

时间:2021-07-18 23:22:39      阅读:25      评论:0      收藏:0      [点我收藏+]

空间数据库

组成部分

  • Spatial Data Types
  • Spatial Indexes and Bounding Boxes
  • Spatial Functions

geometry_columns 默认视图

为数据库中的空间表信息,做一个基本的描述

  • f_geometry_column 空间信息列名
  • corrd_dimansion 几维图形 2-4
  • srid
  • type geom 的类型,Point、Polygon...

反映真实世界模型

  • ST_GeometryType(geom)
  • ST_NDims(geom)
  • ST_SRID(geom)

Points

  • ST_X(geometry)
  • ST_Y(geometry)

LineStrings

  • ST_Length(geometry) returns the length of the linestring
  • ST_StartPoint(geometry) returns the first coordinate as a point
  • ST_EndPoint(geometry) returns the last coordinate as a point
  • ST_NPoints(geometry) returns the number of coordinates in the linestring

Polygons

Collections

  • MultiPoint
  • MultiLineString
  • MultiPolygon
  • GeometryCollection
    • st_numgeometries()

Geometry 输入和输出格式

出现的函数

  • ST_Area: Returns the area of the surface if it is a polygon or multi-polygon. For “geometry” type area is in SRID units. For “geography” area is in square meters.

  • ST_AsText: Returns the Well-Known Text (WKT) representation of the geometry/geography without SRID metadata.

  • ST_AsBinary: Returns the Well-Known Binary (WKB) representation of the geometry/geography without SRID meta data.

  • ST_EndPoint: Returns the last point of a LINESTRING geometry as a POINT.

  • ST_AsEWKB: Returns the Well-Known Binary (WKB) representation of the geometry with SRID meta data.

  • ST_AsEWKT: Returns the Well-Known Text (WKT) representation of the geometry with SRID meta data.

  • ST_AsGeoJSON: Returns the geometry as a GeoJSON element.

  • ST_AsGML: Returns the geometry as a GML version 2 or 3 element.

  • ST_AsKML: Returns the geometry as a KML element. Several variants. Default version=2, default precision=15.

  • ST_AsSVG: Returns a Geometry in SVG path data given a geometry or geography object.

  • ST_ExteriorRing: Returns a line string representing the exterior ring of the POLYGON geometry. Return NULL if the geometry is not a polygon. Will not work with MULTIPOLYGON

  • ST_GeometryN: Returns the 1-based Nth geometry if the geometry is a GEOMETRYCOLLECTION, MULTIPOINT, MULTILINESTRING, MULTICURVE or MULTIPOLYGON. Otherwise, return NULL.

  • ST_GeomFromGML: Takes as input GML representation of geometry and outputs a PostGIS geometry object.

  • ST_GeomFromKML: Takes as input KML representation of geometry and outputs a PostGIS geometry object

  • ST_GeomFromText: Returns a specified ST_Geometry value from Well-Known Text representation (WKT).

  • ST_GeomFromWKB: Creates a geometry instance from a Well-Known Binary geometry representation (WKB) and optional SRID.

  • ST_GeometryType: Returns the geometry type of the ST_Geometry value.

  • ST_InteriorRingN: 返回 polygon geometry 的内部边个数

  • ST_Length: Returns the 2d length of the geometry if it is a linestring or multilinestring. geometry are in units of spatial reference and geography are in meters (default spheroid)

  • ST_NDims: Returns coordinate dimension of the geometry as a small int. Values are: 2,3 or 4.

  • ST_NPoints: Returns the number of points (vertexes) in a geometry.

  • ST_NRings: If the geometry is a polygon or multi-polygon returns the number of rings.

  • ST_NumGeometries: If geometry is a GEOMETRYCOLLECTION (or MULTI*) returns the number of geometries, otherwise return NULL.

  • ST_Perimeter: 周长. (Polygon, Multipolygon)

  • ST_SRID: Returns the spatial reference identifier for the ST_Geometry as defined in spatial_ref_sys table.

  • ST_StartPoint: Returns the first point of a LINESTRING geometry as a POINT.

  • ST_X: Returns the X coordinate of the point, or NULL if not available. Input must be a point.

  • ST_Y: Returns the Y coordinate of the point, or NULL if not available. Input must be a point.

PostGIS Intro (一) -- geometries

原文:https://www.cnblogs.com/wangzx1973/p/15027982.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!