en to zh_Hans translation catalogue (354 entries)

note: Tag: title
en: Data Management
zh_Hans: 数据管理

note: Tag: title
en: Spatial Data Model
zh_Hans: 空间数据模型

note: Tag: title
en: OGC Geometry
zh_Hans: OGC几何图形

note: Tag: para
en: The Open Geospatial Consortium (OGC) developed the <ulink url="https://www.ogc.org/standards/sfa"><emphasis>Simple Features Access</emphasis></ulink> standard (SFA) to provide a model for geospatial data. It defines the fundamental spatial type of <emphasis role="bold">Geometry</emphasis>, along with operations which manipulate and transform geometry values to perform spatial analysis tasks. PostGIS implements the OGC Geometry model as the PostgreSQL data types <link linkend="PostGIS_Geometry">geometry</link> and <link linkend="PostGIS_Geography">geography</link>.
zh_Hans: 开放地理空间联盟 （OGC）开发了<ulink url="https://www.ogc.org/standards/sfa"><emphasis>简单要素访问</emphasis></ulink>标准（SFA），以提供地理空间数据模型。 它定义了几何的基本空间类型以及用于执行空间分析处理的操作和转换。PostGIS将OGC几何模型值实现为PostgreSQL数据类型几何和地理，以实现空间分析任务。

note: Tag: para
en: Geometry is an <emphasis>abstract</emphasis> type. Geometry values belong to one of its <emphasis>concrete</emphasis> subtypes which represent various kinds and dimensions of geometric shapes. These include the <emphasis role="bold">atomic</emphasis> types <link linkend="Point">Point</link>, <link linkend="LineString">LineString</link>, <link linkend="LinearRing">LinearRing</link> and <link linkend="Polygon">Polygon</link>, and the <emphasis role="bold">collection</emphasis> types <link linkend="MultiPoint">MultiPoint</link>, <link linkend="MultiLineString">MultiLineString</link>, <link linkend="MultiPolygon">MultiPolygon</link> and <link linkend="GeometryCollection">GeometryCollection</link>. The <ulink url="https://portal.ogc.org/files/?artifact_id=25355"><emphasis>Simple Features Access - Part 1: Common architecture v1.2.1</emphasis></ulink> adds subtypes for the structures <link linkend="PolyhedralSurface">PolyhedralSurface</link>, <link linkend="Triangle">Triangle</link> and <link linkend="TIN">TIN</link>.
zh_Hans: 几何是一种<emphasis>抽象</emphasis>类型。几何值属于其具体子类型之一。子类型表示各种类型和各种尺寸的几何形状。其中包括<emphasis role="bold">基本</emphasis>类型<link linkend="Point">点</link>, <link linkend="LineString">线</link>, <link linkend="LinearRing">线性环</link> 和 <link linkend="Polygon">面</link>, 以及<emphasis role="bold">集合</emphasis>类型<link linkend="MultiPoint">多点</link>, <link linkend="MultiLineString">多线</link>, <link linkend="MultiPolygon">多面</link> 和 <link linkend="GeometryCollection">几何对象集合</link>。<ulink url="https://portal.ogc.org/files/?artifact_id=25355"><emphasis>简单 功能访问 - 第一部分:通用体系结构v1.2.1</emphasis></ulink> 为结构<link linkend="PolyhedralSurface">PolyhedralSurface</link>, <link linkend="Triangle">Triangle</link>和<link linkend="TIN">TIN</link>添加了子类型。

note: Tag: para
en: Geometry models shapes in the 2-dimensional Cartesian plane. The PolyhedralSurface, Triangle, and TIN types can also represent shapes in 3-dimensional space. The size and location of shapes are specified by their <emphasis role="bold">coordinates</emphasis>. Each coordinate has a X and Y <emphasis role="bold">ordinate</emphasis> value determining its location in the plane. Shapes are constructed from points or line segments, with points specified by a single coordinate, and line segments by two coordinates.
zh_Hans: 几何图形在二维笛卡尔平面上对形状进行建模。PolyhedralSurface, Triangle,和 TIN 也可以表示三维空间中的形状。形状的大小和位置由<emphasis role="bold">坐标</emphasis>指定。每个坐标都有 X 和 Y <emphasis role="bold">坐标轴</emphasis>值，用于确定其在平面上的位置。形状由点和线构造，点由单个坐标定义，线由两个坐标定义。

note: Tag: para
en: Coordinates may contain optional Z and M ordinate values. The Z ordinate is often used to represent elevation. The M ordinate contains a measure value, which may represent time or distance. If Z or M values are present in a geometry value, they must be defined for each point in the geometry. If a geometry has Z or M ordinates the <emphasis role="bold">coordinate dimension</emphasis> is 3D; if it has both Z and M the coordinate dimension is 4D.
zh_Hans: 坐标可能包含可选的Z和M纵坐标值。Z纵坐标通常用于表示高程。M纵坐标包含一个测量值，该值可能表示时间或距离。如果几何值中存在Z或M值，则必须为几何中的每个点定义这些值。如果几何具有 Z 或 M 纵坐标，则<emphasis role="bold">坐标尺寸</emphasis>为 3D;如果它同时具有 Z 和 M，则坐标尺寸为 4D。

note: Tag: para
en: Geometry values are associated with a <emphasis role="bold">spatial reference system</emphasis> indicating the coordinate system in which it is embedded. The spatial reference system is identified by the geometry SRID number. The units of the X and Y axes are determined by the spatial reference system. In <emphasis role="bold">planar</emphasis> reference systems the X and Y coordinates typically represent easting and northing, while in <emphasis role="bold">geodetic</emphasis> systems they represent longitude and latitude. SRID 0 represents an infinite Cartesian plane with no units assigned to its axes. See <xref linkend="spatial_ref_sys"/>.
zh_Hans: 几何值与 <emphasis role="bold">空间参考系统</emphasis>指示它所嵌入的坐标系。空间参考系由几何SRID编号标识。X轴和Y轴的单位由空间参考系确定。<emphasis role="bold">平面</emphasis>参考系X和Y坐标通常表示东距和北距，而在 <emphasis role="bold">大地测量</emphasis>系统中，它们代表经度和纬度。SRID 0表示没有为其轴指定单位的无限笛卡尔平面。请参见<xref linkend="spatial_ref_sys"/>。

note: Tag: para
en: The geometry <emphasis role="bold">dimension</emphasis> is a property of geometry types. Point types have dimension 0, linear types have dimension 1, and polygonal types have dimension 2. Collections have the dimension of the maximum element dimension.
zh_Hans: 几何<emphasis role="bold">维度</emphasis>是几何类型的属性。点类型的维度为 0，线性类型的维度为 1， 多边形类型的维度为 2。集合具有最大元素维度的维度。

note: Tag: para
en: A geometry value may be <emphasis role="bold">empty</emphasis>. Empty values contain no vertices (for atomic geometry types) or no elements (for collections).
zh_Hans: 几何值可能为 <emphasis role="bold">空</emphasis>。空值不包含折点（对于原子几何类型）或无元素（对于集合）

note: Tag: para
en: An important property of geometry values is their spatial <emphasis role="bold">extent</emphasis> or <emphasis role="bold">bounding box</emphasis>, which the OGC model calls <emphasis role="bold">envelope</emphasis>. This is the 2 or 3-dimensional box which encloses the coordinates of a geometry. It is an efficient way to represent a geometry's extent in coordinate space and to check whether two geometries interact.
zh_Hans: 几何值的一个重要属性是它们的空间<emphasis role="bold">范围</emphasis>或<emphasis role="bold">边界框</emphasis>，OGC模型将其称为<emphasis role="bold">包络</emphasis>。这是包含几何坐标的2维或3维框。它是在坐标空间中表示几何图形范围并检查两个几何图形是否相互作用的有效方法

note: Tag: para
en: The geometry model allows evaluating topological spatial relationships as described in <xref linkend="DE-9IM"/>. To support this the concepts of <emphasis role="bold">interior</emphasis>, <emphasis role="bold">boundary</emphasis> and <emphasis role="bold">exterior</emphasis> are defined for each geometry type. Geometries are topologically closed, so they always contain their boundary. The boundary is a geometry of dimension one less than that of the geometry itself.
zh_Hans: 几何模型允许评估拓扑空间关系，如<xref linkend="DE-9IM"/>中所述。为了支持这一点，为每种几何类型定义了<emphasis role="bold">内部</emphasis>, <emphasis role="bold">boundary外部</emphasis>和<emphasis role="bold">边界</emphasis>的概念。几何图形在拓扑上是封闭的，因此它们总是包含它们的边界。边界是比几何体本身小一维的几何体。

note: Tag: para
en: The OGC geometry model defines validity rules for each geometry type. These rules ensure that geometry values represents realistic situations (e.g. it is possible to specify a polygon with a hole lying outside the shell, but this makes no sense geometrically and is thus invalid). PostGIS also allows storing and manipulating invalid geometry values. This allows detecting and fixing them if needed. See <xref linkend="OGC_Validity"/>
zh_Hans: OGC几何模型定义了每种几何类型的有效性规则。这些规则确保几何值代表现实情况（例如，可以指定一个带有位于壳外的孔的多边形，但这在几何上没有意义，因此是无效的）。PostGIS 还允许存储和操作无效的几何值。这允许在需要时检测并修复它们。请参阅<xref linkend="OGC_Validity"/>

note: Tag: title
en: Point
zh_Hans: 点（Point）

note: Tag: para
en: A Point is a 0-dimensional geometry that represents a single location in coordinate space.
zh_Hans: 点是表示坐标空间中单个位置的 0 维几何图形。

note: Tag: title
en: LineString
zh_Hans: 线串（LineString）

note: Tag: para
en: A LineString is a 1-dimensional line formed by a contiguous sequence of line segments. Each line segment is defined by two points, with the end point of one segment forming the start point of the next segment. An OGC-valid LineString has either zero or two or more points, but PostGIS also allows single-point LineStrings. LineStrings may cross themselves (self-intersect). A LineString is <emphasis role="bold">closed</emphasis> if the start and end points are the same. A LineString is <emphasis role="bold">simple</emphasis> if it does not self-intersect.
zh_Hans: 线串是由连续的线段序列形成的一维线。每条线段由两个点定义，一条线段的终点形成下一条线段的起点。OGC 有效的 线串具有零个或两个或多个点，但 PostGIS 也允许单点线串。线串可以与自身交叉（自相交）。如果起点和终点相同，则线串是<emphasis role="bold">闭合</emphasis>的。如果线串不自相交，则它是<emphasis role="bold">简单</emphasis>的。

note: Tag: title
en: LinearRing
zh_Hans: 线性环（LinearRing）

note: Tag: para
en: A LinearRing is a LineString which is both closed and simple. The first and last points must be equal, and the line must not self-intersect.
zh_Hans: 线性环是一个既封闭又简单的线串。第一个点和最后一个点必须相等，并且线不得自相交。

note: Tag: title
en: Polygon
zh_Hans: 多边形（Polygon）

note: Tag: para
en: A Polygon is a 2-dimensional planar region, delimited by an exterior boundary (the shell) and zero or more interior boundaries (holes). Each boundary is a <link linkend="LinearRing">LinearRing</link>.
zh_Hans: 多边形是二维平面区域，它有一个外部边界（壳）和零个或多个内部边界（孔）分隔，每个边界都是 <link linkend="LinearRing">线性环</link>

note: Tag: title
en: MultiPoint
zh_Hans: 多点（MultiPoint）

note: Tag: para
en: A MultiPoint is a collection of Points.
zh_Hans: 多点是点的集合

note: Tag: title
en: MultiLineString
zh_Hans: 多线（MultiLineString）

note: Tag: para
en: A MultiLineString is a collection of LineStrings. A MultiLineString is closed if each of its elements is closed.
zh_Hans: 多线是线串的集合，如果多线的每个元素都已闭合，则该多线闭合

note: Tag: title
en: MultiPolygon
zh_Hans: 多面（MultiPolygon）

note: Tag: para
en: A MultiPolygon is a collection of non-overlapping, non-adjacent Polygons. Polygons in the collection may touch only at a finite number of points.
zh_Hans: 多面是非重叠、不相邻多边形的集合。集合中的多边形只能在有限数量的点处接触。

note: Tag: title
en: GeometryCollection
zh_Hans: 几何集合（GeometryCollection）

note: Tag: para
en: A GeometryCollection is a heterogeneous (mixed) collection of geometries.
zh_Hans: 几何集合是几何的异构（混合）集合

note: Tag: title
en: PolyhedralSurface
zh_Hans: 多面体曲面（PolyhedralSurface）

note: Tag: para
en: A PolyhedralSurface is a contiguous collection of patches or facets which share some edges. Each patch is a planar Polygon. If the Polygon coordinates have Z ordinates then the surface is 3-dimensional.
zh_Hans: 多面体曲面是共享一些边的斑块或刻面的连续集合。每个面片都是一个平面多边形。如果多边形坐标具有 Z 纵坐标，则表面是三维的。

note: Tag: title
en: Triangle
zh_Hans: 三角形（Triangle）

note: Tag: para
en: A Triangle is a polygon defined by three distinct non-collinear vertices. Because a Triangle is a polygon it is specified by four coordinates, with the first and fourth being equal.
zh_Hans: 三角形是由三个不同的非共线顶点定义的多边形。因为三角形是一个多边形，所以它由四个坐标指定，第一和第四个相等。

note: Tag: para
en: A TIN is a collection of non-overlapping <link linkend="Triangle">Triangle</link>s representing a <ulink url="https://en.wikipedia.org/wiki/Triangulated_irregular_network">Triangulated Irregular Network</ulink>.
zh_Hans: TIN是代表<ulink url="https://en.wikipedia.org/wiki/Triangulated_irregular_network">不规则三角形网络</ulink>的非重叠<link linkend="Triangle">三角形</link>的集合。

note: Tag: title
en: SQL/MM Part 3 - Curves
zh_Hans: SQL/MM第3部分-曲线

note: Tag: para
en: The <ulink url="https://www.iso.org/obp/ui/#iso:std:iso-iec:13249:-3:ed-5:v1:en"><emphasis>ISO/IEC 13249-3 SQL Multimedia - Spatial</emphasis></ulink> standard (SQL/MM) extends the OGC SFA to define Geometry subtypes containing curves with circular arcs. The SQL/MM types support 3DM, 3DZ and 4D coordinates.
zh_Hans: <ulink url="https://www.iso.org/obp/ui/#iso:std:iso-iec:13249:-3:ed-5:v1:en"><emphasis>ISO/IEC 13249-3 SQL多媒体-空间</emphasis></ulink>标准 （SQL/MM）扩展了 OGC SFA 以定义包含弯曲几何图形的子类型。SQL/MM 类型支持 XYM、XYZ 和 XYZM。

note: Tag: para
en: All floating point comparisons within the SQL-MM implementation are performed to a specified tolerance, currently 1E-8.
zh_Hans: SQL-MM 实现中的所有浮点比较 按照指定的公差执行，目前为 1E-8。

note: Tag: title
en: CircularString
zh_Hans: 圆弧串（CircularString）

note: Tag: para
en: CircularString is the basic curve type, similar to a LineString in the linear world. A single arc segment is specified by three points: the start and end points (first and third) and some other point on the arc. To specify a closed circle the start and end points are the same and the middle point is the opposite point on the circle diameter (which is the center of the arc). In a sequence of arcs the end point of the previous arc is the start point of the next arc, just like the segments of a LineString. This means that a CircularString must have an odd number of points greater than 1.
zh_Hans: 圆弧串是基本曲线类型，类似于线性世界中的线串。单个圆弧段由三个点指定：起点和终点（第一个和第三个）以及圆弧上的其他点。 要指定闭合圆，起点和终点相同，中点是圆直径上的相对点（即圆弧的中心）。在弧序列中，前一个弧的终点是下一个弧的起点，就像线串的线段一样。 这意味着圆弧串必须具有大于 1 的奇数个点。

note: Tag: title
en: CompoundCurve
zh_Hans: 复合曲线（CompoundCurve）

note: Tag: para
en: A CompoundCurve is a single continuous curve that may contain both circular arc segments and linear segments. That means that in addition to having well-formed components, the end point of every component (except the last) must be coincident with the start point of the following component.
zh_Hans: 复合曲线是一条连续曲线，可以包含圆弧段和线性段。意味着除了具有格式良好的组件之外，每个组件（最后一个除外）的终点必须与后续组件的起点重合。

note: Tag: title
en: CurvePolygon
zh_Hans: 曲线多边形（CurvePolygon）

note: Tag: para
en: A CurvePolygon is like a polygon, with an outer ring and zero or more inner rings. The difference is that a ring can be a CircularString or CompoundCurve as well as a LineString.
zh_Hans: 曲线多边形与多边形相似，因为它们有一个外环和零个或多个内环。区别在于多边形环是线串，而曲线多边形环是复合曲线或圆弧串。

note: Tag: para
en: As of PostGIS 1.4 PostGIS supports compound curves in a curve polygon.
zh_Hans: 从PostGIS 1.4开始，PostGIS 现在支持曲线多边形上的复合曲线。

note: Tag: para
en: Example: A CurvePolygon with the shell defined by a CompoundCurve containing a CircularString and a LineString, and a hole defined by a CircularString
zh_Hans: 示例：具有由圆弧串和线串组成的复合曲线定义的外壳的曲线多边形，以及由圆弧串定义的孔

note: Tag: title
en: MultiCurve
zh_Hans: 多曲线（MultiCurve）

note: Tag: para
en: A MultiCurve is a collection of curves which can include LineStrings, CircularStrings or CompoundCurves.
zh_Hans: 多曲线是曲线的集合，可以包括线串、圆弧串或复合曲线。

note: Tag: title
en: MultiSurface
zh_Hans: 多曲面（MultiSurface）

note: Tag: para
en: A MultiSurface is a collection of surfaces, which can be (linear) Polygons or CurvePolygons.
zh_Hans: 多曲面是曲面的集合，可以是（线性的）多边形或曲线多边形。

note: Tag: title
en: WKT and WKB
zh_Hans: WKT和WKB

note: Tag: para
en: The OGC SFA specification defines two formats for representing geometry values for external use: Well-Known Text (WKT) and Well-Known Binary (WKB). Both WKT and WKB include information about the type of the object and the coordinates which define it.
zh_Hans: OGC SFA规范定义了两种标准格式，用于表示供外部使用的几何值。已知文本（WKT）和已知二进制文件（WKB）。WKT和WKB都包含有关定义对象的类型和坐标的信息。

note: Tag: para
en: Well-Known Text (WKT) provides a standard textual representation of spatial data. Examples of WKT representations of spatial objects are:
zh_Hans: 已知文本（WKT）提供空间数据的标准字符表示形式。以下是空间对象的 WKT 表示形式示例：

note: Tag: para
en: Input and output of WKT is provided by the functions <xref linkend="ST_AsText"/> and <xref linkend="ST_GeomFromText"/>:
zh_Hans: WKT输入和输出由函数<xref linkend="ST_AsText"/>和<xref linkend="ST_GeomFromText"/>提供。

note: Tag: para
en: For example, a statement to create and insert a spatial object from WKT and a SRID is:
zh_Hans: 例如，从WKT和SRID创建并插入空间对象的语句如下所示：

note: Tag: para
en: Well-Known Binary (WKB) provides a portable, full-precision representation of spatial data as binary data (arrays of bytes). Examples of the WKB representations of spatial objects are:
zh_Hans: 已知二进制 （WKB） 是空间数据二进制数据（字节数组）的可移植且准确的表示形式。空间对象的 WKB 表示如下所示。

note: Tag: para
en: Input and output of WKB is provided by the functions <xref linkend="ST_AsBinary"/> and <xref linkend="ST_GeomFromWKB"/>:
zh_Hans: WKB 的输入和输出由以下函数<xref linkend="ST_AsBinary"/>和 <xref linkend="ST_GeomFromWKB"/>提供：

note: Tag: para
en: For example, a statement to create and insert a spatial object from WKB is:
zh_Hans: 例如，用于创建和插入WKB的空间对象如下所示：

note: Tag: title
en: Geometry Data Type
zh_Hans: 几何数据类型

note: Tag: para
en: PostGIS implements the OGC Simple Features model by defining a PostgreSQL data type called <varname>geometry</varname>. It represents all of the geometry subtypes by using an internal type code (see <xref linkend="GeometryType"/> and <xref linkend="ST_GeometryType"/>). This allows modelling spatial features as rows of tables defined with a column of type <varname>geometry</varname>.
zh_Hans: PostGIS 通过定义称为<varname>geometry</varname>的 PostgreSQL 数据类型来实现 OGC 简单要素模型。它使用内部类型代码表示所有几何子类型（请参阅 <xref linkend="GeometryType"/> 和 <xref linkend="ST_GeometryType"/>）。这允许将空间要素建模为用<varname>geometry</varname>类型的列定义的表行。

note: Tag: para
en: The <varname>geometry</varname> data type is <emphasis>opaque</emphasis>, which means that all access is done via invoking functions on geometry values. Functions allow creating geometry objects, accessing or updating all internal fields, and compute new geometry values. PostGIS supports all the functions specified in the OGC <ulink url="https://portal.ogc.org/files/?artifact_id=25354"><emphasis>Simple feature access - Part 2: SQL option</emphasis></ulink> (SFS) specification, as well many others. See <xref linkend="reference"/> for the full list of functions.
zh_Hans: <varname>geometry</varname>数据类型是 <emphasis>不透明的</emphasis>，这意味着所有访问都是通过调用几何值的函数来完成的。 函数允许创建几何对象、访问或更新所有内部字段以及计算新的几何值。PostGIS 支持 OGC <ulink url="https://portal.ogc.org/files/?artifact_id=25354"><emphasis>简单功能访问 - 第二部分: SQL 选项</emphasis></ulink>(SFS) 规范中指定的所有功能以及许多其他功能。 请参阅<xref linkend="reference"/>以获取完整的函数列表。

note: Tag: para
en: PostGIS follows the SFA standard by prefixing spatial functions with "ST_". This was intended to stand for "Spatial and Temporal", but the temporal part of the standard was never developed. Instead it can be interpreted as "Spatial Type".
zh_Hans: PostGIS 遵循 SFA 标准，在空间函数前面加上前缀“ST_”。 这表示“空间和时间”，但标准时间部分尚未开发。 相反，它可以解释为“空间类型”。

note: Tag: para
en: The SFA standard specifies that spatial objects include a Spatial Reference System identifier (SRID). The SRID is required when creating spatial objects for insertion into the database (it may be defaulted to 0). See <xref linkend="ST_SRID"/> and <xref linkend="spatial_ref_sys"/>
zh_Hans: SFA 标准指定空间对象包含空间参考系统标识符 (SRID)。创建插入数据库的空间对象时需要 SRID（可能默认为 0）。 请参阅 <xref linkend="ST_SRID"/> 和<xref linkend="spatial_ref_sys"/>。

note: Tag: para
en: To make querying geometry efficient PostGIS defines various kinds of spatial indexes, and spatial operators to use them. See <xref linkend="build-indexes"/> and <xref linkend="using-query-indexes"/> for details.
zh_Hans: 为了使几何查询更加高效，PostGIS 定义了不同类型的空间索引。有关更多信息，请参见 <xref linkend="build-indexes"/>和<xref linkend="using-query-indexes"/>。

note: Tag: title
en: PostGIS EWKB and EWKT
zh_Hans: PostGIS EWKB 和 EWKT

note: Tag: para
en: OGC SFA specifications initially supported only 2D geometries, and the geometry SRID is not included in the input/output representations. The OGC SFA specification 1.2.1 (which aligns with the ISO 19125 standard) adds support for 3D (ZYZ) and measured (XYM and XYZM) coordinates, but still does not include the SRID value.
zh_Hans: OGC SFA 规范最初仅支持 2D 几何形状， 并且几何 SRID 不包含在输入/输出表示中。OGC SFA 规范 1.2.1（与 ISO 19125 标准一致） 增加了对 3D （ZYZ） 和测量（XYM 和 XYZM）坐标的支持， 但仍然不包括 SRID 值。

note: Tag: para
en: Because of these limitations PostGIS defined extended EWKB and EWKT formats. They provide 3D (XYZ and XYM) and 4D (XYZM) coordinate support and include SRID information. Including all geometry information allows PostGIS to use EWKB as the format of record (e.g. in DUMP files).
zh_Hans: 由于这些限制，PostGIS定义了扩展的EWKB和EWKT格式。它们提供 3D（XYZ 和 XYM）和 4D （XYZM） 坐标支持，并包括 SRID 信息。 包含所有几何信息允许 PostGIS 使用 EWKB 作为记录格式 （例如，在转储文件中）。

note: Tag: para
en: EWKB and EWKT are used for the "canonical forms" of PostGIS data objects. For input, the canonical form for binary data is EWKB, and for text data either EWKB or EWKT is accepted. This allows geometry values to be created by casting a text value in either HEXEWKB or EWKT to a geometry value using <varname>::geometry</varname>. For output, the canonical form for binary is EWKB, and for text it is HEXEWKB (hex-encoded EWKB).
zh_Hans: EWKB 和 EWKT 用于 PostGIS 数据对象的“规范形式”。 对于输入，二进制数据的规范形式是 EWKB，对于文本数据，接受 EWKB 或 EWKT。 这允许通过使用 <varname>::geometry</varname>将 HEXEWKB 或 EWKT中的文本值转换为几何值来创建几何值。 对于输出，二进制的规范形式是 EWKB，对于文本，规范形式是 HEXEWKB（十六进制编码的 EWKB）。

note: Tag: para
en: For example this statement creates a geometry by casting from an EWKT text value, and outputs it using the canonical form of HEXEWKB:
zh_Hans: 例如，此过程使用来自EWKT文本值的强制转换生成几何图形，并使用HEXWKB的规范格式输出它们。

note: Tag: para
en: PostGIS EWKT output has a few differences to OGC WKT:
zh_Hans: PostGIS EWKT 输出与 OGC WKT 有一些不同之处：

note: Tag: para
en: For 3DZ geometries the Z qualifier is omitted:
zh_Hans: 对于 3DZ 几何形状，省略了 Z 限定符：

note: Tag: para
en: For 3DM geometries the M qualifier is included:
zh_Hans: 对于 3DM 几何形状，包括 M 限定符：

note: Tag: para
en: For 4D geometries the ZM qualifier is omitted:
zh_Hans: 对于 4D 几何形状，省略了 ZM 限定符：

note: Tag: para
en: EWKT avoids over-specifying dimensionality and the inconsistencies that can occur with the OGC/ISO format, such as:
zh_Hans: EWKT避免过度指定维度以及OGC/ISO格式可能发生的不一致，例如：

note: Tag: para
en: PostGIS extended formats are currently a superset of the OGC ones, so that every valid OGC WKB/WKT is also valid EWKB/EWKT. However, this might vary in the future, if the OGC extends a format in a way that conflicts with the PosGIS definition. Thus you SHOULD NOT rely on this compatibility!
zh_Hans: PostGIS扩展格式向上兼容OGC格式，因此，每个有效的 OGC WKB/WKT 也是有效的 EWKB/EWKT。但是，将来这可能会有所不同，如果 OGC 以与 PosGIS 定义冲突的方式扩展格式。因此，您不应该依赖这种兼容性！

note: Tag: para
en: Examples of the EWKT text representation of spatial objects are:
zh_Hans: 空间对象的 EWKT 文本表示的示例如下：

note: Tag: para
en: SRID=32632;POINT(0 0) -- XY with SRID
zh_Hans: SRID=32632;POINT(0 0) -- XY 与 SRID

note: Tag: para
en: SRID=4326;MULTIPOINTM(0 0 0,1 2 1) -- XYM with SRID
zh_Hans: SRID=4326;MULTIPOINTM(0 0 0,1 2 1) -- XYM 与 SRID

note: Tag: para
en: Input and output using these formats is available using the following functions:
zh_Hans: 可以使用以下函数使用这些格式的输入和输出：

note: Tag: para
en: For example, a statement to create and insert a PostGIS spatial object using EWKT is:
zh_Hans: 例如，使用 EWKT 创建和插入 PostGIS 空间对象的语句为：

note: Tag: title
en: Geography Data Type
zh_Hans: 地理数据类型

note: Tag: para
en: The PostGIS <varname>geography</varname> data type provides native support for spatial features represented on "geographic" coordinates (sometimes called "geodetic" coordinates, or "lat/lon", or "lon/lat"). Geographic coordinates are spherical coordinates expressed in angular units (degrees).
zh_Hans: PostGIS <varname>geography</varname>数据类型为“地理”坐标（有时称为“大地”坐标，或“lat/lon”或“lon/lat”）表示的空间要素提供本机支持。地理坐标是以角度单位（度）表示的球坐标。

note: Tag: para
en: The basis for the PostGIS geometry data type is a plane. The shortest path between two points on the plane is a straight line. That means functions on geometries (areas, distances, lengths, intersections, etc) are calculated using straight line vectors and cartesian mathematics. This makes them simpler to implement and faster to execute, but also makes them inaccurate for data on the spheroidal surface of the earth.
zh_Hans: PostGIS几何类型的基础是平面。平面上两点之间的最短路径是直线。几何函数（面积、距离、长度、交点等）是使用线性向量和笛卡尔平面计算的。这简化了实施并运行得更快，但对于地球球面以上的数据是不准确的。

note: Tag: para
en: The PostGIS geography data type is based on a spherical model. The shortest path between two points on the sphere is a great circle arc. Functions on geographies (areas, distances, lengths, intersections, etc) are calculated using arcs on the sphere. By taking the spheroidal shape of the world into account, the functions provide more accurate results.
zh_Hans: PostGIS 地理数据类型基于球面模型。球体上两点之间的最短路径是一个大圆弧。地理上的函数（面积、距离、长度、交点等）是使用球体上的弧计算的。通过考虑世界的球体形状，函数可提供更准确的结果。

note: Tag: para
en: Because the underlying mathematics is more complicated, there are fewer functions defined for the geography type than for the geometry type. Over time, as new algorithms are added the capabilities of the geography type will expand. As a workaround one can convert back and forth between geometry and geography types.
zh_Hans: 由于基础数学更复杂，因此为地理类型定义的函数少于为几何类型定义的函数。随着时间的推移，随着新算法的添加，地理类型的功能将扩展。作为一种解决方法，可以在几何和地理类型之间来回转换。

note: Tag: para
en: Like the geometry data type, geography data is associated with a spatial reference system via a spatial reference system identifier (SRID). Any geodetic (long/lat based) spatial reference system defined in the <varname>spatial_ref_sys</varname> table can be used. (Prior to PostGIS 2.2, the geography type supported only WGS 84 geodetic (SRID:4326)). You can add your own custom geodetic spatial reference system as described in <xref linkend="user-spatial-ref-sys"/>.
zh_Hans: 与几何数据类型类似，地理数据通过空间参考系统标识符 (SRID) 与空间参考系统相关联。可以使用在<varname>spatial_ref_sys</varname> 表中定义的任何大地测量（基于经/纬度）空间参考系统。（在 PostGIS 2.2 之前，地理类型仅支持 WGS 84 大地测量 (SRID:4326)）。您可以添加自己的自定义大地测量空间参考系统，如<xref linkend="user-spatial-ref-sys"/>中所述。

note: Tag: para
en: For all spatial reference systems the units returned by measurement functions (e.g. <xref linkend="ST_Distance"/>, <xref linkend="ST_Length"/>, <xref linkend="ST_Perimeter"/>, <xref linkend="ST_Area"/>) and for the distance argument of <xref linkend="ST_DWithin"/> are in meters.
zh_Hans: 测量函数返回的单位（例如，<xref linkend="ST_Distance"/>, <xref linkend="ST_Length"/>, <xref linkend="ST_Perimeter"/>, <xref linkend="ST_Area"/>）与<xref linkend="ST_DWithin"/>参数中给出的距离之间的空间参考系统单位为米。

note: Tag: title
en: Creating Geography Tables
zh_Hans: 创建地理表

note: Tag: para
en: You can create a table to store geography data using the <ulink url="https://www.postgresql.org/docs/current/sql-createtable.html">CREATE TABLE</ulink> SQL statement with a column of type <varname>geography</varname>. The following example creates a table with a geography column storing 2D LineStrings in the WGS84 geodetic coordinate system (SRID 4326):
zh_Hans: 您可以使用带有地理类型列的 <ulink url="https://www.postgresql.org/docs/current/sql-createtable.html">CREATE TABLE</ulink>  SQL 语句创建一个表来存储地理数据。 以下示例创建一个表，其中包含存储 WGS84 大地坐标系 (SRID 4326) 中的 2D LineString 的地理列：

note: Tag: para
en: The geography type supports two optional type modifiers:
zh_Hans: 地理类型支持两个可选的类型修饰符:

note: Tag: para
en: the spatial type modifier restricts the kind of shapes and dimensions allowed in the column. Values allowed for the spatial type are: POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION. The geography type does not support curves, TINS, or POLYHEDRALSURFACEs. The modifier supports coordinate dimensionality restrictions by adding suffixes: Z, M and ZM. For example, a modifier of 'LINESTRINGM' only allows linestrings with three dimensions, and treats the third dimension as a measure. Similarly, 'POINTZM' requires four dimensional (XYZM) data.
zh_Hans: 空间类型修饰符用于调节列中允许的形状的类型和维度。根据值，空间类型可以是点、线串、面、多点、多线、多面、几何集合。地理类型不支持曲线、三角形或多面体曲面。通过将后置 Z、M 和 ZM 附加到类型修饰符，可以解决坐标维度的约束问题。 例如，“LINESTRINGM”只允许三维线串，第三个轴是M。 同样，“POINTZM”需要四维（XYZM）数据。

note: Tag: para
en: the SRID modifier restricts the spatial reference system SRID to a particular number. If omitted, the SRID defaults to 4326 (WGS84 geodetic), and all calculations are performed using WGS84.
zh_Hans: SRID 修饰符将空间参考系统 SRID 限制为特定数字。如果省略，SRID 默认为 4326（WGS84 大地测量），并且所有计算均使用 WGS84 执行。

note: Tag: para
en: Examples of creating tables with geography columns:
zh_Hans: 以下是生成包含地理列的表的示例：

note: Tag: para
en: Create a table with 2D POINT geography with the default SRID 4326 (WGS84 long/lat):
zh_Hans: 生成一个具有二维点地理的表，默认情况下SRID为4326（WGS84 经度/纬度）：

note: Tag: para
en: Create a table with 2D POINT geography in NAD83 longlat:
zh_Hans: 生成具有 NAD83 经纬度二维点地理的表：

note: Tag: para
en: Create a table with 3D (XYZ) POINTs and an explicit SRID of 4326:
zh_Hans: 创建一个包含 3D (XYZ) POINT 和默认 SRID 4326 的表：

note: Tag: para
en: Create a table with 2D LINESTRING geography with the default SRID 4326:
zh_Hans: 生成具有二维线串地理的表，SRID 默认值为 4326：

note: Tag: para
en: Create a table with 2D POLYGON geography with the SRID 4267 (NAD 1927 long lat):
zh_Hans: 使用 SRID 4267（NAD 1927 经纬度）创建包含二维多边形地理的表：

note: Tag: para
en: Geography fields are registered in the <varname>geography_columns</varname> system view. You can query the <varname>geography_columns</varname> view and see that the table is listed:
zh_Hans: 地理字段在系统视图中注册。 您可以查询 <varname>geography_columns</varname>视图并查看表是否列出：

note: Tag: para
en: Creating a spatial index works the same as for geometry columns. PostGIS will note that the column type is GEOGRAPHY and create an appropriate sphere-based index instead of the usual planar index used for GEOMETRY.
zh_Hans: 创建空间索引的工作方式与创建几何列相同。 PostGIS 将注意到列类型是 GEOGRAPHY，并创建适当的基于球体的索引，而不是用于 GEOMETRY 的常用平面索引。

note: Tag: title
en: Using Geography Tables
zh_Hans: 使用地理表

note: Tag: para
en: You can insert data into geography tables in the same way as geometry. Geometry data will autocast to the geography type if it has SRID 4326. The <link linkend="EWKB_EWKT">EWKT and EWKB</link> formats can also be used to specify geography values.
zh_Hans: 您可以采用与几何相同的方式将数据插入地理表中。如果几何数据具有 SRID 4326，则几何数据将自动转换为地理类型。也可以使用 <link linkend="EWKB_EWKT">EWKT和EWKB</link> 格式 以指定地理值。

note: Tag: para
en: Any geodetic (long/lat) spatial reference system listed in <varname>spatial_ref_sys</varname> table may be specified as a geography SRID. Non-geodetic coordinate systems raise an error if used.
zh_Hans: <varname>spatial_ref_sys</varname>表中列出的任何大地测量（经/纬度）空间参考系统都可以指定为地理 SRID。如果使用非大地坐标系，则会产生错误。

note: Tag: para
en: Query and measurement functions use units of meters. So distance parameters should be expressed in meters, and return values should be expected in meters (or square meters for areas).
zh_Hans: 查询和测量功能以米为单位。因此，距离参数以米为单位（面积为平方米）

note: Tag: para
en: You can see the power of geography in action by calculating how close a plane flying a great circle route from Seattle to London (LINESTRING(-122.33 47.606, 0.0 51.5)) comes to Reykjavik (POINT(-21.96 64.15)) (<ulink url="http://gc.kls2.com/cgi-bin/gc?PATH=SEA-LHR">map the route</ulink>).
zh_Hans: 通过计算一架从西雅图飞往伦敦的飞机（LINESTRING(-122.33 47.606, 0.0 51.5) 表示的大圆航线）飞行过程中距离雷克雅未克（POINT(-21.96 64.15)）的距离，您可以看到地理学的作用（<ulink url="http://gc.kls2.com/cgi-bin/gc?PATH=SEA-LHR">绘制路线</ulink>）。

note: Tag: para
en: The geography type calculates the true shortest distance of 122.235 km over the sphere between Reykjavik and the great circle flight path between Seattle and London.
zh_Hans: 地理类型计算出雷克雅未克与西雅图和伦敦之间的大圆飞行路径之间的球体上的真实最短距离为 122.235 公里。

note: Tag: para
en: The geometry type calculates a meaningless cartesian distance between Reykjavik and the straight line path from Seattle to London plotted on a flat map of the world. The nominal units of the result is "degrees", but the result doesn't correspond to any true angular difference between the points, so even calling them "degrees" is inaccurate.
zh_Hans: 几何类型在平面世界地图上计算雷克雅未克之间的笛卡尔距离以及西雅图和伦敦之间的直线，这是没有意义的。计算结果的标称单位是“度”，但它与点之间的真实角度差并不对应，称其为“度”本身是不准确的。

note: Tag: title
en: When to use the Geography data type
zh_Hans: 何时使用地理数据类型

note: Tag: para
en: The geography data type allows you to store data in longitude/latitude coordinates, but at a cost: there are fewer functions defined on GEOGRAPHY than there are on GEOMETRY; those functions that are defined take more CPU time to execute.
zh_Hans: 地理数据类型允许您将数据存储在经度/纬度坐标中，但有代价：在地理上定义的函数比在几何上定义的函数少;定义的那些函数需要更多 CPU 时间来执行。

note: Tag: para
en: The data type you choose should be determined by the expected working area of the application you are building. Will your data span the globe or a large continental area, or is it local to a state, county or municipality?
zh_Hans: 您选择的数据类型应由正在构建的应用程序的预期工作区域确定。您的数据是跨越全球还是大片大陆区域，还是州、县或直辖市的本地数据？

note: Tag: para
en: If your data is contained in a small area, you might find that choosing an appropriate projection and using GEOMETRY is the best solution, in terms of performance and functionality available.
zh_Hans: 如果数据包含在较小的区域中，您可能会发现，就可用的性能和功能而言，选择合适的投影并使用 GEOMETRY 是最佳解决方案。

note: Tag: para
en: If your data is global or covers a continental region, you may find that GEOGRAPHY allows you to build a system without having to worry about projection details. You store your data in longitude/latitude, and use the functions that have been defined on GEOGRAPHY.
zh_Hans: 如果您的数据是整个地球或大陆，您将能够构建一个系统，而无需担心地理投影的细节。保存经度/纬度数据并使用地理中定义的函数。

note: Tag: para
en: If you don't understand projections, and you don't want to learn about them, and you're prepared to accept the limitations in functionality available in GEOGRAPHY, then it might be easier for you to use GEOGRAPHY than GEOMETRY. Simply load your data up as longitude/latitude and go from there.
zh_Hans: 如果您不了解投影，并且不想了解它们，并且您准备接受地理中可用功能的限制，那么使用地理可能比使用几何更容易。只需将数据加载为经度/纬度，然后从那里开始。

note: Tag: para
en: Refer to <xref linkend="PostGIS_TypeFunctionMatrix"/> for compare between what is supported for Geography vs. Geometry. For a brief listing and description of Geography functions, refer to <xref linkend="PostGIS_GeographyFunctions"/>
zh_Hans: 有关地理和几何之间的支持比较，请参见<xref linkend="PostGIS_TypeFunctionMatrix"/>。有关地理函数的简要列表和说明，请参见 <xref linkend="PostGIS_GeographyFunctions"/>。

note: Tag: title
en: Geography Advanced FAQ
zh_Hans: 地理高级常见问题解答

note: Tag: para
en: Do you calculate on the sphere or the spheroid?
zh_Hans: 你是用球体还是椭球体计算?

note: Tag: para
en: By default, all distance and area calculations are done on the spheroid. You should find that the results of calculations in local areas match up will with local planar results in good local projections. Over larger areas, the spheroidal calculations will be more accurate than any calculation done on a projected plane.
zh_Hans: 默认情况下，所有距离和面积计算都在椭球体中执行。将局部区域的计算结果与投影良好的平面上的结果进行比较。对于大面积，椭球体计算比投影平面上的任何其他计算都更准确。

note: Tag: para
en: All the geography functions have the option of using a sphere calculation, by setting a final boolean parameter to 'FALSE'. This will somewhat speed up calculations, particularly for cases where the geometries are very simple.
zh_Hans: 所有地理函数都可以选择使用球体计算，方法是将最终布尔参数设置为“FALSE”。这将在一定程度上加快计算速度，特别是对于几何形状非常简单的情况。

note: Tag: para
en: What about the date-line and the poles?
zh_Hans: 日期变更线和极点呢？

note: Tag: para
en: All the calculations have no conception of date-line or poles, the coordinates are spherical (longitude/latitude) so a shape that crosses the dateline is, from a calculation point of view, no different from any other shape.
zh_Hans: 所有计算都没有日期变更线或极点的概念。 由于坐标是球体（经度/纬度），因此从计算的角度来看，穿过日期变更线的形状与其他任何形状没有什么不同。

note: Tag: para
en: What is the longest arc you can process?
zh_Hans: 您可以处理的最长圆弧是多少？

note: Tag: para
en: We use great circle arcs as the "interpolation line" between two points. That means any two points are actually joined up two ways, depending on which direction you travel along the great circle. All our code assumes that the points are joined by the *shorter* of the two paths along the great circle. As a consequence, shapes that have arcs of more than 180 degrees will not be correctly modelled.
zh_Hans: 我们使用大圆弧作为两点之间的“插值线”。 这意味着任何两点实际上以两种方式连接起来，具体取决于您沿着大圆行进的方向。我们所有的代码都假设这些点是由沿着大圆的两条路径中“较短的”一条连接起来的。因此，弧度超过 180 度的形状将无法正确建模。

note: Tag: para
en: Why is it so slow to calculate the area of Europe / Russia / insert big geographic region here ?
zh_Hans: 为什么计算欧洲/俄罗斯/大地理区域的面积这么慢？

note: Tag: para
en: Because the polygon is so darned huge! Big areas are bad for two reasons: their bounds are huge, so the index tends to pull the feature no matter what query you run; the number of vertices is huge, and tests (distance, containment) have to traverse the vertex list at least once and sometimes N times (with N being the number of vertices in the other candidate feature).
zh_Hans: 因为多边形大得离谱。大面积不好有两个原因 一个原因是边界框很大，因此无论您运行什么查询，索引都倾向于拉取特征。另一个原因是顶点计数很大，并且测试（距离、包含）函数必须至少遍历顶点一次，通常为 N（其中 N 是另一个要素的顶点计数）。

note: Tag: para
en: As with GEOMETRY, we recommend that when you have very large polygons, but are doing queries in small areas, you "denormalize" your geometric data into smaller chunks so that the index can effectively subquery parts of the object and so queries don't have to pull out the whole object every time. Please consult <xref linkend="ST_Subdivide"/> function documentation. Just because you *can* store all of Europe in one polygon doesn't mean you *should*.
zh_Hans: 与 GEOMETRY 一样，我们建议您在具有非常大的多边形，但在小区域中执行查询时，将几何数据“非规范化”为较小的块，以便索引可以有效地子查询对象的各个部分，这样查询就不必每次都提取整个对象。请参阅<xref linkend="ST_Subdivide"/> 函数文档。仅仅因为您*可以*将整个欧洲存储在一个多边形中并不意味着您*应该*。

note: Tag: title
en: Geometry Validation
zh_Hans: 几何有效性验证。

note: Tag: para
en: PostGIS is compliant with the Open Geospatial Consortium’s (OGC) Simple Features specification. That standard defines the concepts of geometry being <emphasis>simple</emphasis> and <emphasis>valid</emphasis>. These definitions allow the Simple Features geometry model to represent spatial objects in a consistent and unambiguous way that supports efficient computation. (Note: the OGC SF and SQL/MM have the same definitions for simple and valid.)
zh_Hans: PostGIS 符合开放地理空间联盟 （OGC） 简单要素规范。本标准要求几何形状简单，合理定义了几何的概念。这些定义允许简单要素几何模型以一致且清晰的方式表示空间对象，从而有助于高效计算（OGC 简单要素和 SQL/MM 具有相同的简单性和有效性定义）。

note: Tag: title
en: Simple Geometry
zh_Hans: 简单几何

note: Tag: para
en: A <emphasis>simple</emphasis> geometry is one that has no anomalous geometric points, such as self intersection or self tangency.
zh_Hans: <emphasis>简单</emphasis>几何是指没有异常几何点（例如自交或自相切）的几何。

note: Tag: para
en: A <varname>POINT</varname> is inherently <emphasis>simple</emphasis> as a 0-dimensional geometry object.
zh_Hans: <varname>POINT</varname>作为0维几何对象始终很简单。

note: Tag: para
en: <varname>MULTIPOINT</varname>s are <emphasis>simple</emphasis> if no two coordinates (<varname>POINT</varname>s) are equal (have identical coordinate values).
zh_Hans: 如果没有两个坐标 (<varname>POINT</varname>) 相等（具有相同的坐标值），则<varname>MULTIPOINT</varname>很<emphasis>simple</emphasis> 。

note: Tag: para
en: A <varname>LINESTRING</varname> is <emphasis>simple</emphasis> if it does not pass through the same point twice, except for the endpoints. If the endpoints of a simple LineString are identical it is called <emphasis>closed</emphasis> and referred to as a Linear Ring.
zh_Hans: 如果<varname>LINESTRING</varname>不两次穿过同一点（端点除外），则该 LINESTRING 很<emphasis>simple</emphasis>。如果简单线串的端点相同，则称为<emphasis>闭合线</emphasis>并称为线性环。

note: Tag: emphasis
en: <emphasis role="bold">(a)</emphasis> and <emphasis role="bold">(c)</emphasis> are simple <varname>LINESTRING</varname>s. <emphasis role="bold">(b)</emphasis> and <emphasis role="bold">(d)</emphasis> are not simple. <emphasis role="bold">(c)</emphasis> is a closed Linear Ring.
zh_Hans: <emphasis role="bold">(a)</emphasis> 和<emphasis role="bold">(c)</emphasis> 是简单的<varname>LINESTRING</varname>s. <emphasis role="bold">(b)</emphasis> 和 <emphasis role="bold">(d)</emphasis> 不简单。 <emphasis role="bold">(c)</emphasis> 是一个封闭的线性环。

note: Tag: para
en: A <varname>MULTILINESTRING</varname> is <emphasis>simple</emphasis> only if all of its elements are simple and the only intersection between any two elements occurs at points that are on the boundaries of both elements.
zh_Hans: 仅当<varname>MULTILINESTRING</varname> 的所有元素都很<emphasis>简单</emphasis> 并且任意两个元素之间的唯一交集发生在两个元素边界上的点时，MULTILINESTRING 才是简单的。

note: Tag: emphasis
en: <emphasis role="bold">(e)</emphasis> and <emphasis role="bold">(f)</emphasis> are simple <varname>MULTILINESTRING</varname>s. <emphasis role="bold">(g)</emphasis> is not simple.
zh_Hans: <emphasis role="bold">(e)</emphasis> 和<emphasis role="bold">(f)</emphasis> 是简单的 <varname>MULTILINESTRING</varname>s。<emphasis role="bold">(g)</emphasis>不简单。

note: Tag: para
en: <varname>POLYGON</varname>s are formed from linear rings, so valid polygonal geometry is always <emphasis>simple</emphasis>.
zh_Hans: <varname>POLYGON</varname>s 是由线性环形成的，所以常见的多边形几何总是简单的。

note: Tag: para
en: To test if a geometry is simple use the <xref linkend="ST_IsSimple"/> function:
zh_Hans: 测试几何图形是否简单，使用 <xref linkend="ST_IsSimple"/>函数：

note: Tag: para
en: Generally, PostGIS functions do not require geometric arguments to be simple. Simplicity is primarily used as a basis for defining geometric validity. It is also a requirement for some kinds of spatial data models (for example, linear networks often disallow lines that cross). Multipoint and linear geometry can be made simple using <xref linkend="ST_UnaryUnion"/>.
zh_Hans: 一般来说，PostGIS 函数不要求几何参数很简单。简单性主要用作定义几何有效性的基础。这也是某些类型的空间数据模型的要求（例如，线性网络通常不允许线交叉）。使用 <xref linkend="ST_UnaryUnion"/> 可以使多点和线性几何变得简单。

note: Tag: title
en: Valid Geometry
zh_Hans: 有效的几何形状

note: Tag: para
en: Geometry validity primarily applies to 2-dimensional geometries (<varname>POLYGON</varname>s and <varname>MULTIPOLYGON</varname>s) . Validity is defined by rules that allow polygonal geometry to model planar areas unambiguously.
zh_Hans: 几何有效性主要适用于二维几何形状（<varname>POLYGON</varname>s和<varname>MULTIPOLYGON</varname>s）。有效性是由允许多边形几何形状明确地模拟平面区域的规则定义的。

note: Tag: para
en: A <varname>POLYGON</varname> is <emphasis>valid</emphasis> if:
zh_Hans:  <varname>POLYGON</varname>以下条件是<emphasis>有效</emphasis>的：

note: Tag: para
en: the polygon boundary rings (the exterior shell ring and interior hole rings) are <emphasis>simple</emphasis> (do not cross or self-touch). Because of this a polygon cannnot have cut lines, spikes or loops. This implies that polygon holes must be represented as interior rings, rather than by the exterior ring self-touching (a so-called "inverted hole").
zh_Hans: 多边形边界环（外壳环和内孔环）很<emphasis>简单</emphasis>（不交叉或自接触）。因此，多边形不能有切割线、尖峰或环。这意味着多边形孔必须表示为内环，而不是外环自接触（所谓的“倒孔”）

note: Tag: para
en: boundary rings do not cross
zh_Hans: 边界环不交叉

note: Tag: para
en: boundary rings may touch at points but only as a tangent (i.e. not in a line)
zh_Hans: 边界环可以在点上接触，但只能作为切线（即不在一条线上）

note: Tag: para
en: interior rings are contained in the exterior ring
zh_Hans: 内环包含在外环中

note: Tag: para
en: the polygon interior is simply connected (i.e. the rings must not touch in a way that splits the polygon into more than one part)
zh_Hans: 多边形内部连接简单（即环不得以将多边形分成多个部分的方式接触）

note: Tag: emphasis
en: <emphasis role="bold">(h)</emphasis> and <emphasis role="bold">(i)</emphasis> are valid <varname>POLYGON</varname>s. <emphasis role="bold">(j-m)</emphasis> are invalid. <emphasis role="bold">(j)</emphasis> can be represented as a valid <varname>MULTIPOLYGON</varname>.
zh_Hans: <emphasis role="bold">(h)</emphasis>和<emphasis role="bold">(i)</emphasis> 是有效的<varname>POLYGON</varname>s。<emphasis role="bold">(j-m)</emphasis> 是无效的。<emphasis role="bold">(j)</emphasis>可以表示为有效的<varname>MULTIPOLYGON</varname>。

note: Tag: para
en: A <varname>MULTIPOLYGON</varname> is <emphasis>valid</emphasis> if:
zh_Hans: <varname>MULTIPOLYGON</varname>以下条件是<emphasis>有效</emphasis>的：

note: Tag: para
en: its element <varname>POLYGON</varname>s are valid
zh_Hans: 其元素 <varname>POLYGON</varname>s有效

note: Tag: para
en: elements do not overlap (i.e. their interiors must not intersect)
zh_Hans: 元素不重叠（即其内部不得相交）

note: Tag: para
en: elements touch only at points (i.e. not along a line)
zh_Hans: 元素仅在点处接触（即不沿线接触）

note: Tag: emphasis
en: <emphasis role="bold">(n)</emphasis> is a valid <varname>MULTIPOLYGON</varname>. <emphasis role="bold">(o)</emphasis> and <emphasis role="bold">(p)</emphasis> are invalid.
zh_Hans: <emphasis role="bold">(n)</emphasis>是有效的<varname>MULTIPOLYGON</varname>。<emphasis role="bold">(o)</emphasis>和<emphasis role="bold">(p)</emphasis>无效。

note: Tag: para
en: These rules mean that valid polygonal geometry is also <emphasis>simple</emphasis>.
zh_Hans: 这些规则意味着有效的多边形几何也很<emphasis>简单</emphasis>。

note: Tag: para
en: For linear geometry the only validity rule is that <varname>LINESTRING</varname>s must have at least two points and have non-zero length (or equivalently, have at least two distinct points.) Note that non-simple (self-intersecting) lines are valid.
zh_Hans: 对于线性几何，唯一的有效性规则是<varname>LINESTRING</varname>s必须至少有两个点并且具有非零长度（或等效地，至少有两个不同的点。请注意，非简单（自相交）线是有效的。

note: Tag: para
en: <varname>POINT</varname> and <varname>MULTIPOINT</varname> geometries have no validity rules.
zh_Hans: <varname>POINT</varname>和<varname>MULTIPOINT</varname> 几何形状没有有效性规则。

note: Tag: title
en: Managing Validity
zh_Hans: 有效性管理

note: Tag: para
en: PostGIS allows creating and storing both valid and invalid Geometry. This allows invalid geometry to be detected and flagged or fixed. There are also situations where the OGC validity rules are stricter than desired (examples of this are zero-length linestrings and polygons with inverted holes.)
zh_Hans: PostGIS允许创建和存储有效和无效的几何图形。这允许检测并标记或修复无效的几何图形。在某些情况下，OGC有效性规则比预期更严格（例如零长度线串和带有倒孔的多边形。）

note: Tag: para
en: Many of the functions provided by PostGIS rely on the assumption that geometry arguments are valid. For example, it does not make sense to calculate the area of a polygon that has a hole defined outside of the polygon, or to construct a polygon from a non-simple boundary line. Assuming valid geometric inputs allows functions to operate more efficiently, since they do not need to check for topological correctness. (Notable exceptions are that zero-length lines and polygons with inversions are generally handled correctly.) Also, most PostGIS functions produce valid geometry output if the inputs are valid. This allows PostGIS functions to be chained together safely.
zh_Hans: PostGIS提供的许多功能都依赖于几何参数有效的假设。例如，计算在多边形外部定义有孔的多边形的面积，或者从非简单边界线构造多边形是没有意义的。假设有效的几何输入允许函数更有效地运行，因为它们不需要检查拓扑正确性。（值得注意的例外是零长度线和具有反转的多边形通常可以正确处理。）此外，如果输入有效，大多数 PostGIS 函数都会生成有效的几何输出。 这使得 PostGIS 功能可以安全地链接在一起。

note: Tag: para
en: If you encounter unexpected error messages when calling PostGIS functions (such as "GEOS Intersection() threw an error!"), you should first confirm that the function arguments are valid. If they are not, then consider using one of the techniques below to ensure the data you are processing is valid.
zh_Hans: 如果在调用 PostGIS 函数时遇到意外错误消息 （例如“GEOS Intersection（） 抛出了一个错误！),应首先确认函数参数是否有效。如果无效，请考虑使用以下技术之一来验证您正在处理的数据。

note: Tag: para
en: If a function reports an error with valid inputs, then you may have found an error in either PostGIS or one of the libraries it uses, and you should report this to the PostGIS project. The same is true if a PostGIS function returns an invalid geometry for valid input.
zh_Hans: 如果函数报告有效输入错误，那么您可能在 PostGIS 或其使用的库之一中发现错误，您应该将此报告给 PostGIS 项目。如果 PostGIS 函数为有效输入返回无效几何图形，情况也是如此。

note: Tag: para
en: To test if a geometry is valid use the <xref linkend="ST_IsValid"/> function:
zh_Hans: 要测试几何图形是否有效,请使用<xref linkend="ST_IsValid"/>函数。 执行以下操作：

note: Tag: para
en: Information about the nature and location of an geometry invalidity are provided by the <xref linkend="ST_IsValidDetail"/> function:
zh_Hans: 有关几何无效的性质和位置的信息由<xref linkend="ST_IsValidDetail"/>函数确定：

note: Tag: para
en: In some situations it is desirable to correct invalid geometry automatically. Use the <xref linkend="ST_MakeValid"/> function to do this. (<code>ST_MakeValid</code> is a case of a spatial function that <emphasis>does</emphasis> allow invalid input!)
zh_Hans: 在某些情况下，需要自动更正不正确的几何图形。 使用 <xref linkend="ST_MakeValid"/> 函数（<code>ST_MakeValid</code>是一个允许非法输入的特殊函数）。

note: Tag: para
en: By default, PostGIS does not check for validity when loading geometry, because validity testing can take a lot of CPU time for complex geometries. If you do not trust your data sources, you can enforce a validity check on your tables by adding a check constraint:
zh_Hans: 测试复杂几何的刚度需要花费大量CPU时间，因此默认情况下，PostGIS 在加载几何时不会验证几何。如果不信任数据源，则可以使用检查约束对表进行强制验证。执行以下操作：

note: Tag: title
en: Spatial Reference Systems
zh_Hans: 空间参考系统

note: Tag: para
en: A <ulink url="https://en.wikipedia.org/wiki/Spatial_reference_system">Spatial Reference System</ulink> (SRS) (also called a Coordinate Reference System (CRS)) defines how geometry is referenced to locations on the Earth's surface. There are three types of SRS:
zh_Hans: 空间参考系统（SRS），也称为坐标参考系（CRS）），定义几何图形如何参照地球表面上的位置。有三种类型的 SRS：

note: Tag: para
en: A <emphasis role="bold">geodetic</emphasis> SRS uses angular coordinates (longitude and latitude) which map directly to the surface of the earth.
zh_Hans:  <emphasis role="bold">地理</emphasis>（geodetic）SRS，使用角坐标（经度和纬度），直接映射到地球表面。

note: Tag: para
en: A <emphasis role="bold">projected</emphasis> SRS uses a mathematical projection transformation to "flatten" the surface of the spheroidal earth onto a plane. It assigns location coordinates in a way that allows direct measurement of quantities such as distance, area, and angle. The coordinate system is Cartesian, which means it has a defined origin point and two perpendicular axes (usually oriented North and East). Each projected SRS uses a stated length unit (usually metres or feet). A projected SRS may be limited in its area of applicability to avoid distortion and fit within the defined coordinate bounds.
zh_Hans: <emphasis role="bold">投影</emphasis>（projected）SRS使用数学投影变换将球形地球的表面“压平”到平面上。 它以允许直接测量距离、面积和角度等量的方式分配位置坐标。 坐标系是笛卡尔坐标系，这意味着它具有定义的原点和两个垂直轴（通常面向北和东）。 每个投影的 SRS 使用规定的长度单位（通常是米或英尺）。投影的 SRS 的适用范围可能会受到限制，以避免变形并适合定义的坐标范围。

note: Tag: para
en: A <emphasis role="bold">local</emphasis> SRS is a Cartesian coordinate system which is not referenced to the earth's surface. In PostGIS this is specified by a SRID value of 0.
zh_Hans: <emphasis role="bold">本地</emphasis>（local）SRS是不参考地球表面的笛卡尔坐标系。PostGIS 指定 SRID 值为 0。

note: Tag: para
en: There are many different spatial reference systems in use. Common SRSes are standardized in the European Petroleum Survey Group <ulink url="http://www.epsg.org/">EPSG database</ulink>. For convenience PostGIS (and many other spatial systems) refers to SRS definitions using an integer identifier called a SRID.
zh_Hans: 所使用的空间参考系统存在许多差异。一般空间参考系统在欧洲石油调查组的<ulink url="http://www.epsg.org/">EPSG database</ulink>中进行了标准化。为方便起见，PostGIS（和许多空间系统）使用称为SRID的整数来引用空间参考系统。

note: Tag: para
en: A geometry is associated with a Spatial Reference System by its SRID value, which is accessed by <xref linkend="ST_SRID"/>. The SRID for a geometry can be assigned using <xref linkend="ST_SetSRID"/>. Some geometry constructor functions allow supplying a SRID (such as <xref linkend="ST_Point"/> and <xref linkend="ST_MakeEnvelope"/>). The <link linkend="EWKB_EWKT">EWKT</link> format supports SRIDs with the <code>SRID=n;</code> prefix.
zh_Hans: 几何通过其SRID值与空间参考系相关联，可由<xref linkend="ST_SRID"/>访问。可以使用<xref linkend="ST_SetSRID"/>指定几何图形的 SRID 值。某些几何构造函数允许提供 SRID （如<xref linkend="ST_Point"/>和<xref linkend="ST_MakeEnvelope"/>）。<link linkend="EWKB_EWKT">EWKT</link>格式支持带有前缀<code>SRID=n;</code>的SRID。

note: Tag: para
en: Spatial functions processing pairs of geometries (such as <link linkend="Overlay_Functions">overlay</link> and <link linkend="Spatial_Relationships">relationship</link> functions) require that the input geometries are in the same spatial reference system (have the same SRID). Geometry data can be transformed into a different spatial reference system using <xref linkend="ST_Transform"/> and <xref linkend="ST_TransformPipeline"/>. Geometry returned from functions has the same SRS as the input geometries.
zh_Hans: 处理几何图形对（例如<link linkend="Overlay_Functions">叠加</link>和<link linkend="Spatial_Relationships">关系</link>函数）的空间函数要求输入几何图形位于同一空间参考系统中（具有相同的 SRID）。可以使用<xref linkend="ST_Transform"/> 和 <xref linkend="ST_TransformPipeline"/>将几何数据转换为不同的空间参考系统。从函数返回的几何图形具有与输入几何图形相同的SRS。

note: Tag: title
en: SPATIAL_REF_SYS Table
zh_Hans: SPATIAL_REF_SYS表

note: Tag: para
en: The <varname>SPATIAL_REF_SYS</varname> table used by PostGIS is an OGC-compliant database table that defines the available spatial reference systems. It holds the numeric SRIDs and textual descriptions of the coordinate systems.
zh_Hans: PostGIS使用的<varname>SPATIAL_REF_SYS</varname>表是一个符合 OGC 标准的数据库表，用于定义可用的空间参考系统。它包含数字 SRID 和坐标系的文本描述

note: Tag: para
en: The <varname>spatial_ref_sys</varname> table definition is:
zh_Hans:  <varname>spatial_ref_sys</varname>表定义为：

note: Tag: para
en: The columns are:
zh_Hans: 这些列是：

note: Tag: para
en: An integer code that uniquely identifies the <ulink url="http://en.wikipedia.org/wiki/SRID">Spatial Reference System</ulink> (SRS) within the database.
zh_Hans: 唯一标识数据库内<ulink url="http://en.wikipedia.org/wiki/SRID">空间参考系统</ulink>(SRS)的整数代码。

note: Tag: para
en: The name of the standard or standards body that is being cited for this reference system. For example, "EPSG" is a valid <varname>auth_name</varname>.
zh_Hans: 该参考系统引用的标准或标准机构的名称。例如，“EPSG”是有效的<varname>auth_name</varname>。

note: Tag: para
en: The ID of the Spatial Reference System as defined by the Authority cited in the <varname>auth_name</varname>. In the case of EPSG, this is the EPSG code.
zh_Hans: 由<varname>auth_name</varname>中引用的权威机构定义的空间参考系统的ID。对于EPSG，这是EPSG代码。

note: Tag: para
en: The Well-Known Text representation of the Spatial Reference System. An example of a WKT SRS representation is:
zh_Hans: 已知空间参考系统的文本表示形式。WKT SRS表示的一个示例是：

note: Tag: para
en: For a discussion of SRS WKT, see the OGC standard <ulink url="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">Well-known text representation of coordinate reference systems</ulink>.
zh_Hans: 有关SRS WKT的详细信息，请参阅 OGC 标准<ulink url="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">参考系的已知文本表示</ulink>

note: Tag: para
en: PostGIS uses the PROJ library to provide coordinate transformation capabilities. The <varname>proj4text</varname> column contains the PROJ coordinate definition string for a particular SRID. For example:
zh_Hans: PostGIS使用PROJ库提供坐标转换功能。<varname>proj4text</varname>列包含特定SRID的PROJ坐标定义字符串。例如：

note: Tag: para
en: For more information see the <ulink url="https://proj.org/">PROJ web site</ulink>. The <filename>spatial_ref_sys.sql</filename> file contains both <varname>srtext</varname> and <varname>proj4text</varname> definitions for all EPSG projections.
zh_Hans: 欲了解更多信息，请访问<ulink url="https://proj.org/">PROJ 网站</ulink>。<filename>spatial_ref_sys.sql</filename>文件包含所有 EPSG 投影的<varname>srtext</varname> 和<varname>proj4text</varname>定义

note: Tag: para
en: When retrieving spatial reference system definitions for use in transformations, PostGIS uses fhe following strategy:
zh_Hans: 检索用于变换的空间参考系统定义时，PostGIS使用以下策略：

note: Tag: para
en: If <varname>auth_name</varname> and <varname>auth_srid</varname> are present (non-NULL) use the PROJ SRS based on those entries (if one exists).
zh_Hans: 如果 <varname>auth_name</varname>和<varname>auth_srid</varname>存在（非空）,使用基于这些条目（如果存在）的 PROJ SRS。

note: Tag: para
en: If <varname>srtext</varname> is present create a SRS using it, if possible.
zh_Hans: 如果<varname>srtext</varname>存在，请使用它创建SRS（如果可能）。

note: Tag: para
en: If <varname>proj4text</varname> is present create a SRS using it, if possible.
zh_Hans: 如果<varname>proj4text</varname>存在，请使用它创建SRS（如果可能）

note: Tag: title
en: User-Defined Spatial Reference Systems
zh_Hans: 用户自定义空间参考系统

note: Tag: para
en: The PostGIS <varname>spatial_ref_sys</varname> table contains over 3000 of the most common spatial reference system definitions that are handled by the <ulink url="https://proj.org">PROJ</ulink> projection library. But there are many coordinate systems that it does not contain. You can add SRS definitions to the table if you have the required information about the spatial reference system. Or, you can define your own custom spatial reference system if you are familiar with PROJ constructs. Keep in mind that most spatial reference systems are regional and have no meaning when used outside of the bounds they were intended for.
zh_Hans: PostGIS<varname>spatial_ref_sys</varname>表包含由<ulink url="https://proj.org">PROJ</ulink>投影库处理的 3000 多个最常见的空间参考系统定义。但有很多坐标系它不包含。如果您具有有关空间参考系统的所需信息，则可以将 SRS 定义添加到表中。或者，如果您熟悉 PROJ 构造，则可以定义自己的自定义空间参考系统。请记住，大多数空间参考系统都是区域性的，在其预期范围之外使用时没有任何意义。

note: Tag: para
en: A resource for finding spatial reference systems not defined in the core set is <ulink url="http://spatialreference.org/">http://spatialreference.org/</ulink>
zh_Hans: <ulink url="http://spatialreference.org/">http://spatialreference.org/</ulink>可用于查找不在 PostGIS 核心集中的空间参考系统。

note: Tag: para
en: Some commonly used spatial reference systems are: <ulink url="http://spatialreference.org/ref/epsg/4326/">4326 - WGS 84 Long Lat</ulink>, <ulink url="http://spatialreference.org/ref/epsg/4269/">4269 - NAD 83 Long Lat</ulink>, <ulink url="http://spatialreference.org/ref/epsg/3395/">3395 - WGS 84 World Mercator</ulink>, <ulink url="http://spatialreference.org/ref/epsg/2163/">2163 - US National Atlas Equal Area</ulink>, and the 60 WGS84 UTM zones. UTM zones are one of the most ideal for measurement, but only cover 6-degree regions. (To determine which UTM zone to use for your area of interest, see the <ulink url="http://trac.osgeo.org/postgis/wiki/UsersWikiplpgsqlfunctionsDistance">utmzone PostGIS plpgsql helper function</ulink>.)
zh_Hans: 一些常用的空间参考系统包括：<ulink url="http://spatialreference.org/ref/epsg/4326/">4326 - WGS 84 经纬度</ulink>, <ulink url="http://spatialreference.org/ref/epsg/4269/">4269 - NAD 83 经纬度</ulink>, <ulink url="http://spatialreference.org/ref/epsg/3395/">3395 - WGS 84 世界墨卡托投影</ulink>, <ulink url="http://spatialreference.org/ref/epsg/2163/">2163 - 美国国家地图等面积投影</ulink>以及 60 个 WGS84 UTM 区域。UTM 区域是最理想的测量区域之一，但仅覆盖 6 度区域。（要确定您感兴趣的区域使用哪个UTM区域，请参阅 <ulink url="http://trac.osgeo.org/postgis/wiki/UsersWikiplpgsqlfunctionsDistance">utmzone PostGIS plpgsql帮助程序函数</ulink>。）。

note: Tag: para
en: US states use State Plane spatial reference systems (meter or feet based) - usually one or 2 exists per state. Most of the meter-based ones are in the core set, but many of the feet-based ones or ESRI-created ones will need to be copied from <ulink url="http://spatialreference.org">spatialreference.org</ulink>.
zh_Hans: 美国各州使用国家平面空间参考系统（基于米或英尺）- 通常每个州有一个或两个。 大多数基于米的数据都在核心集中，但许多基于英尺的数据或 ESRI 创建的数据需要从<ulink url="http://spatialreference.org">spatialreference.org</ulink>复制。

note: Tag: para
en: You can even define non-Earth-based coordinate systems, such as <ulink url="http://spatialreference.org/ref/iau2000/mars-2000/">Mars 2000</ulink> This Mars coordinate system is non-planar (it's in degrees spheroidal), but you can use it with the <varname>geography</varname> type to obtain length and proximity measurements in meters instead of degrees.
zh_Hans: 您甚至可以定义非基于地球的坐标系，比如 <ulink url="http://spatialreference.org/ref/iau2000/mars-2000/">火星2000</ulink>这个火星坐标系是非平面的（以球度为单位），但是您可以将其与 <varname>geography</varname>类型一起使用,以米而不是度为单位获得长度和邻近测量值。

note: Tag: para
en: Here is an example of loading a custom coordinate system using an unassigned SRID and the PROJ definition for a US-centric Lambert Conformal projection:
zh_Hans: 以下是使用未分配的SRID和以美国为中心的兰伯特等角投影的PROJ定义加载自定义坐标系的示例：

note: Tag: title
en: Spatial Tables
zh_Hans: 空间表

note: Tag: title
en: Creating a Spatial Table
zh_Hans: 创建空间表

note: Tag: para
en: You can create a table to store geometry data using the <ulink url="https://www.postgresql.org/docs/current/sql-createtable.html">CREATE TABLE</ulink> SQL statement with a column of type <varname>geometry</varname>. The following example creates a table with a geometry column storing 2D (XY) LineStrings in the BC-Albers coordinate system (SRID 3005):
zh_Hans: 您可以使用带有<varname>geometry</varname>类型列的<ulink url="https://www.postgresql.org/docs/current/sql-createtable.html">CREATE TABLE</ulink>SQL语句创建一个表来存储几何数据。以下示例创建一个表，其中的几何列存储 BC-Albers 坐标系(SRID 3005) 中的 2D (XY) LineString：

note: Tag: para
en: The <varname>geometry</varname> type supports two optional <emphasis role="bold">type modifiers</emphasis>:
zh_Hans: <varname>geometry</varname>类型对应于两个可选的类型修饰符：

note: Tag: para
en: the <emphasis role="bold">spatial type modifier</emphasis> restricts the kind of shapes and dimensions allowed in the column. The value can be any of the supported <link linkend="RefObject">geometry subtypes</link> (e.g. POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, etc). The modifier supports coordinate dimensionality restrictions by adding suffixes: Z, M and ZM. For example, a modifier of 'LINESTRINGM' allows only linestrings with three dimensions, and treats the third dimension as a measure. Similarly, 'POINTZM' requires four dimensional (XYZM) data.
zh_Hans: <emphasis role="bold">空间类型修饰符</emphasis>限制列中允许的形状和维度。该值可以是任何受支持的几何子类型（例如 POINT、LINESTRING、POLYGON、MULTIPOINT、MULTILINESTRING、MULTIPOLYGON、GEOMETRYCOLLECTION 等）。该修改器通过添加后缀支持坐标维数限制：Z、M 和 ZM。 例如，修饰符“LINESTRINGM”仅允许具有三个维度的线串，并将第三个维度视为度量。同样，“POINTZM”需要四维 (XYZM) 数据。

note: Tag: para
en: the <emphasis role="bold">SRID modifier</emphasis> restricts the <link linkend="spatial_ref_sys">spatial reference system</link> SRID to a particular number. If omitted, the SRID defaults to 0.
zh_Hans: <emphasis role="bold">SRID 修饰符</emphasis>将<link linkend="spatial_ref_sys">空间参考系统</link>的 SRID 限制为特定的数值。如果省略，则默认值为 0。

note: Tag: para
en: Examples of creating tables with geometry columns:
zh_Hans: 创建具有几何列的表的示例：

note: Tag: para
en: Create a table holding any kind of geometry with the default SRID:
zh_Hans: 创建一个表，其中包含具有默认 SRID 的任何类型的几何图形：

note: Tag: para
en: Create a table with 2D POINT geometry with the default SRID:
zh_Hans: 为 2D 点创建具有 SRID 默认值的表：

note: Tag: para
en: Create a table with 3D (XYZ) POINTs and an explicit SRID of 3005:
zh_Hans: 创建一个包含 3D （XYZ） 点和显式 SRID 3005 的表：

note: Tag: para
en: Create a table with 4D (XYZM) LINESTRING geometry with the default SRID:
zh_Hans: 使用默认 SRID 创建具有 4D （XYZM） LINESTRING 几何图形的表：

note: Tag: para
en: Create a table with 2D POLYGON geometry with the SRID 4267 (NAD 1927 long lat):
zh_Hans: 使用 SRID 4267（NAD 1927 长纬度）创建包含 2D POLYGON 几何图形的表：

note: Tag: para
en: It is possible to have more than one geometry column in a table. This can be specified when the table is created, or a column can be added using the <ulink url="https://www.postgresql.org/docs/current/sql-altertable.html">ALTER TABLE</ulink> SQL statement. This example adds a column that can hold 3D LineStrings:
zh_Hans: 一个表可以有多个几何列。这可以通过在创建表时指定它或使用<ulink url="https://www.postgresql.org/docs/current/sql-altertable.html">ALTER TABLE</ulink>语句添加它来实现。下面的示例演示如何添加列以存储 3D LineStrings。

note: Tag: title
en: GEOMETRY_COLUMNS View
zh_Hans: GEOMETRY_COLUMNS 视图

note: Tag: para
en: The OGC <emphasis>Simple Features Specification for SQL</emphasis> defines the <varname>GEOMETRY_COLUMNS</varname> metadata table to describe geometry table structure. In PostGIS <varname>geometry_columns</varname> is a view reading from database system catalog tables. This ensures that the spatial metadata information is always consistent with the currently defined tables and views. The view structure is:
zh_Hans: <emphasis>适用于SQL的OGC简单要素规范</emphasis>定义了用于描述<varname>几何列</varname>结构的元数据表。在 PostGIS 中，<varname>几何列</varname>是从数据库的系统目录表中读取的视图。这可确保空间元数据信息始终与当前定义的表或视图一致。视图结构为:

note: Tag: para
en: The fully qualified name of the feature table containing the geometry column. There is no PostgreSQL analogue of "catalog" so that column is left blank. For "schema" the PostgreSQL schema name is used (<varname>public</varname> is the default).
zh_Hans: 包含几何列的要素表的完全限定名称。PostgreSQL 中没有类似的“目录”，因此该列留空。对于“schema”，使用 PostgreSQL 模式名称（默认为<varname>public</varname>）。

note: Tag: para
en: The name of the geometry column in the feature table.
zh_Hans: 要素表中几何列的名称。

note: Tag: para
en: The coordinate dimension (2, 3 or 4) of the column.
zh_Hans: 列的坐标维度（2、3 或 4）。

note: Tag: para
en: The ID of the spatial reference system used for the coordinate geometry in this table. It is a foreign key reference to the <varname>spatial_ref_sys</varname> table (see <xref linkend="spatial_ref_sys_table"/>).
zh_Hans: 用于此表中的坐标几何的空间参考系的 ID。它是对引用<varname>spatial_ref_sys</varname>表的外键引用（请参见<xref linkend="spatial_ref_sys_table"/>）。

note: Tag: para
en: The type of the spatial object. To restrict the spatial column to a single type, use one of: POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION or corresponding XYM versions POINTM, LINESTRINGM, POLYGONM, MULTIPOINTM, MULTILINESTRINGM, MULTIPOLYGONM, GEOMETRYCOLLECTIONM. For heterogeneous (mixed-type) collections, you can use "GEOMETRY" as the type.
zh_Hans: 空间对象的类型。 要将空间列限制为单一类型，请使用以下之一：POINT、LINESTRING、POLYGON、MULTIPOINT、MULTILINESTRING、MULTIPOLYGON、GEOMETRYCOLLECTION或相应的 XYM 版本 POINTM、LINESTRINGM、POLYGONM、MULTIPOINTM、MULTILINESTRINGM、MULTIPOLYGONM、GEOMETRYCOLLECTIONM。 对于异构（混合类型）集合，您可以使用“GEOMETRY”作为类型。

note: Tag: title
en: Manually Registering Geometry Columns
zh_Hans: 手动注册几何列

note: Tag: para
en: Two of the cases where you may need this are the case of SQL Views and bulk inserts. For bulk insert case, you can correct the registration in the geometry_columns table by constraining the column or doing an alter table. For views, you could expose using a CAST operation. Note, if your column is typmod based, the creation process would register it correctly, so no need to do anything. Also views that have no spatial function applied to the geometry will register the same as the underlying table geometry column.
zh_Hans: 您可能需要这样做的两种情况是 SQL 视图和批量插入。对于批量插入情况，您可以通过约束列或执行更改表来更正 Geometry_columns 表中的注册。对于视图，您可以使用 CAST 操作来公开。 请注意，如果您的列是基于typmod的，创建过程将正确注册它，因此无需执行任何操作。 此外，未对几何应用空间函数的视图将与基础表几何列注册相同。

note: Tag: para
en: Although the old-constraint based method is still supported, a constraint-based geometry column used directly in a view, will not register correctly in geometry_columns, as will a typmod one. In this example we define a column using typmod and another using constraints.
zh_Hans: 尽管仍然支持旧的基于约束的方法，但直接在视图中使用的基于约束的几何列将无法在 Geometry_columns 中正确注册，typmod 也是如此。在此示例中，我们使用typmod定义一个列，使用约束定义另一个列。

note: Tag: para
en: If we run in psql
zh_Hans: 在 psql 中，运行：

note: Tag: para
en: We observe they are defined differently -- one is typmod, one is constraint
zh_Hans: 我们观察到它们的定义不同——一个是类型，一个是约束

note: Tag: para
en: In geometry_columns, they both register correctly
zh_Hans: 在geometry_columns中，两者都已正确注册。

note: Tag: para
en: However -- if we were to create a view like this
zh_Hans: 但是 - 如果我们要创建这样的视图。

note: Tag: para
en: The typmod based geom view column registers correctly, but the constraint based one does not.
zh_Hans: 基于typmod的几何视图列正确注册， 但基于约束的约束没有。

note: Tag: para
en: This may change in future versions of PostGIS, but for now to force the constraint-based view column to register correctly, you need to do this:
zh_Hans: 这可能会在未来版本的PostGIS中发生变化，但目前 要强制基于约束的视图列正确注册，您需要执行以下操作：

note: Tag: title
en: Loading Spatial Data
zh_Hans: 加载空间数据

note: Tag: para
en: Once you have created a spatial table, you are ready to upload spatial data to the database. There are two built-in ways to get spatial data into a PostGIS/PostgreSQL database: using formatted SQL statements or using the Shapefile loader.
zh_Hans: 创建空间表后，即可上传空间数据到数据库。有两种内置方法可以将空间数据放入PostGIS/PostgreSQL 数据库：使用格式化的 SQL 语句或使用 形状文件加载器。

note: Tag: title
en: Using SQL to Load Data
zh_Hans: 使用SOL加载数据

note: Tag: para
en: If spatial data can be converted to a text representation (as either WKT or WKB), then using SQL might be the easiest way to get data into PostGIS. Data can be bulk-loaded into PostGIS/PostgreSQL by loading a text file of SQL <code>INSERT</code> statements using the <code>psql</code> SQL utility.
zh_Hans: 如果空间数据可以转换为文本表示（如 WKT 或 WKB），那么使用SQL可能是将数据导入 PostGIS 的最简单方法。通过使用<code>psql</code> SQL 实用程序加载 SQL <code>INSERT</code>语句的文本文件，可以将数据批量加载到 PostGIS/PostgreSQL 中。

note: Tag: para
en: A SQL load file (<filename>roads.sql</filename> for example) might look like this:
zh_Hans: SQL加载文件（例如<filename>roads.sql</filename> ）可能看起来像这样：

note: Tag: para
en: The SQL file can be loaded into PostgreSQL using <code>psql</code>:
zh_Hans: SQL文件可以使用<code>psql</code>方法加载到PostgreSQL中:

note: Tag: title
en: Using the Shapefile Loader
zh_Hans: 使用Shapefile加载器

note: Tag: para
en: The <filename>shp2pgsql</filename> data loader converts Shapefiles into SQL suitable for insertion into a PostGIS/PostgreSQL database either in geometry or geography format. The loader has several operating modes selected by command line flags.
zh_Hans: <filename>shp2pgsql</filename>数据加载器将 Shapefile 转换为适合以几何或地理格式插入PostGIS/PostgreSQL 数据库的 SQL。加载程序有多种通过命令行标志选择的操作模式。

note: Tag: para
en: There is also a <filename>shp2pgsql-gui</filename> graphical interface with most of the options as the command-line loader. This may be easier to use for one-off non-scripted loading or if you are new to PostGIS. It can also be configured as a plugin to PgAdminIII.
zh_Hans: 还有一个<filename>shp2pgsql-gui</filename>图形界面，其中大多数选项作为命令行加载程序。对于一次性非脚本加载或者您是 PostGIS 新手，这可能更容易使用。它还可以配置为 PgAdminIII 的插件。

note: Tag: term
en: (c|a|d|p) These are mutually exclusive options:
zh_Hans: （c|a|d|p）这些是相互排斥的选项：

note: Tag: para
en: Creates a new table and populates it from the Shapefile. <emphasis>This is the default mode.</emphasis>
zh_Hans: 创建一个新表并从Shapefile文件填充它。<emphasis>这是默认模式</emphasis>。

note: Tag: para
en: Appends data from the Shapefile into the database table. Note that to use this option to load multiple files, the files must have the same attributes and same data types.
zh_Hans: 将数据从Shapefile文件添加到数据库表中。如果使用此选项加载多个文件，则这些文件必须具有相同的属性和相同的数据类型。

note: Tag: para
en: Drops the database table before creating a new table with the data in the Shapefile.
zh_Hans: 在创建包含 shapefile 中的数据的新表之前，请先删除数据库表。

note: Tag: para
en: Only produces the table creation SQL code, without adding any actual data. This can be used if you need to completely separate the table creation and data loading steps.
zh_Hans: 它只生成用于表创建的SQL代码，不添加任何实际数据。 如果要将表创建与数据加载完全分开，请使用此模式。

note: Tag: para
en: Display help screen.
zh_Hans: 显示帮助屏幕。

note: Tag: para
en: Use the PostgreSQL "dump" format for the output data. This can be combined with -a, -c and -d. It is much faster to load than the default "insert" SQL format. Use this for very large data sets.
zh_Hans: 对输出数据使用 PostgreSQL 转储格式。此模式与 -a、-c 和 -d 结合使用。 它的加载速度比默认的“插入”SQL格式快得多。通常将其用于大型数据集。

note: Tag: para
en: Creates and populates the geometry tables with the specified SRID. Optionally specifies that the input shapefile uses the given FROM_SRID, in which case the geometries will be reprojected to the target SRID.
zh_Hans: 使用指定的 SRID 创建并填充几何表。（可选）指定输入shapefile文件使用给定的 FROM_SRID，在这种情况下，几何图形将被重新投影到目标 SRID。

note: Tag: para
en: Keep identifiers' case (column, schema and attributes). Note that attributes in Shapefile are all UPPERCASE.
zh_Hans: 保留标识符的大小写（列、架构和属性）。请注意，Shapefile文件中的属性都是大写的。

note: Tag: para
en: Coerce all integers to standard 32-bit integers, do not create 64-bit bigints, even if the DBF header signature appears to warrant it.
zh_Hans: 将所有整数强制为标准 32 位整数，不要创建 64 位 bigint，即使DBF标头签名似乎可以保证这一点。

note: Tag: para
en: Create a GiST index on the geometry column.
zh_Hans: 在几何列上生成 GiST 索引。

note: Tag: para
en: -m <filename>a_file_name</filename> Specify a file containing a set of mappings of (long) column names to 10 character DBF column names. The content of the file is one or more lines of two names separated by white space and no trailing or leading space. For example:
zh_Hans: -m <filename>a_file_name</filename>指定一个文件，其中包含一组（长）列名到 10 个字符的 DBF 列名的映射。文件的内容是由空格分隔的两个名称的一行或多行，并且没有尾随或前导空格。 例如：

note: Tag: para
en: Generate simple geometries instead of MULTI geometries. Will only succeed if all the geometries are actually single (I.E. a MULTIPOLYGON with a single shell, or or a MULTIPOINT with a single vertex).
zh_Hans: 生成简单的几何图形而不是多个几何图形。仅当所有几何图形实际上都是单一的时才会成功（即具有单个壳的 MULTIPOLYGON，或具有单个顶点的 MULTIPOINT）。

note: Tag: term
en: -t &lt;dimensionality&gt;
zh_Hans: -t &lt;维度&gt;

note: Tag: para
en: Force the output geometry to have the specified dimensionality. Use the following strings to indicate the dimensionality: 2D, 3DZ, 3DM, 4D.
zh_Hans: 强制输出几何具有指定的维度。使用以下方法表示维度的字符串：2D、3DZ、3DM、4D。

note: Tag: para
en: If the input has fewer dimensions that specified, the output will have those dimensions filled in with zeroes. If the input has more dimensions that specified, the unwanted dimensions will be stripped.
zh_Hans: 如果输入的维度少于指定的维度，则输出将用零填充这些维度。 如果输入具有指定的更多维度，则不需要的维度将被删除。

note: Tag: para
en: Output WKT format, instead of WKB. Note that this can introduce coordinate drifts due to loss of precision.
zh_Hans: 使输出格式为 WKT 而不是 WKB。 重要的是要注意，精度可能会降低，并且可能会出现坐标波动。

note: Tag: para
en: Execute each statement on its own, without using a transaction. This allows loading of the majority of good data when there are some bad geometries that generate errors. Note that this cannot be used with the -D flag as the "dump" format always uses a transaction.
zh_Hans: 单独执行每个语句，而不使用事务。当存在一些产生错误的不良几何形状时，这允许加载大多数好的数据。请注意，这不能与 -D 标志一起使用，因为“转储”格式始终使用事务。

note: Tag: term
en: -W &lt;encoding&gt;
zh_Hans: -W &lt;编码&gt;

note: Tag: para
en: Specify encoding of the input data (dbf file). When used, all attributes of the dbf are converted from the specified encoding to UTF8. The resulting SQL output will contain a <code>SET CLIENT_ENCODING to UTF8</code> command, so that the backend will be able to reconvert from UTF8 to whatever encoding the database is configured to use internally.
zh_Hans: 指定输入数据（dbf 文件）的编码。 使用时，dbf 的所有属性都会从指定的编码转换为 UTF8。生成的 SQL 输出将包含<code>SET CLIENT_ENCODING to UTF8</code>命令，以便后端能够从 UTF8 重新转换为数据库配置为内部使用的任何编码。

note: Tag: term
en: -N &lt;policy&gt;
zh_Hans: -N &lt;策略&gt;

note: Tag: para
en: NULL geometries handling policy (insert*,skip,abort)
zh_Hans: 选择 NULL几何操作策略（插入*、跳过、中止）。

note: Tag: para
en: -n Only import DBF file. If your data has no corresponding shapefile, it will automatically switch to this mode and load just the dbf. So setting this flag is only needed if you have a full shapefile set, and you only want the attribute data and no geometry.
zh_Hans: -n 仅导入 DBF 文件。如果您的数据没有相应的shapefile文件，它将自动切换到此模式 并仅加载 DBF。因此，仅当您设置了完整的 shapefile 并且只需要属性数据而不需要几何图形时，才需要设置此标志。

note: Tag: para
en: Use geography type instead of geometry (requires lon/lat data) in WGS84 long lat (SRID=4326)
zh_Hans: 地理类型不使用几何类型，而是使用 WGS84 经度和纬度 （SRID=4326）（需要经度纬度数据）。

note: Tag: term
en: -T &lt;tablespace&gt;
zh_Hans: -T &lt;表空间&gt;

note: Tag: para
en: Specify the tablespace for the new table. Indexes will still use the default tablespace unless the -X parameter is also used. The PostgreSQL documentation has a good description on when to use custom tablespaces.
zh_Hans: 指定新表的表空间。索引仍将使用 默认表空间，除非还使用 -X 参数。The PostgreSQL 文档对何时使用自定义表空间有很好的描述。

note: Tag: term
en: -X &lt;tablespace&gt;
zh_Hans: -X &lt;表空间&gt;

note: Tag: para
en: Specify the tablespace for the new table's indexes. This applies to the primary key index, and the GIST spatial index if -I is also used.
zh_Hans: 指定新表上的索引要使用的表空间。 它适用于主键索引，如果 -I 一起使用，则也适用于 GiST 空间索引。

note: Tag: para
en: When used, this flag will prevent the generation of <code>ANALYZE</code> statements. Without the -Z flag (default behavior), the <code>ANALYZE</code> statements will be generated.
zh_Hans: 使用时，该标志将阻止生成<code>ANALYZE</code>语句。 如果没有-Z标志（默认行为），将生成<code>ANALYZE</code>语句。

note: Tag: para
en: An example session using the loader to create an input file and loading it might look like this:
zh_Hans: 使用加载程序创建输入文件并加载它的示例会话可能如下所示：

note: Tag: para
en: A conversion and load can be done in one step using UNIX pipes:
zh_Hans: 转换和加载可以使用 UNIX 通道一步完成：

note: Tag: title
en: Extracting Spatial Data
zh_Hans: 提取空间数据

note: Tag: para
en: Spatial data can be extracted from the database using either SQL or the Shapefile dumper. The section on SQL presents some of the functions available to do comparisons and queries on spatial tables.
zh_Hans: 可以使用 SQL 或 Shapefile 转储程序从数据库中提取空间数据。有关 SQL 的部分介绍了一些可用于对空间表进行比较和查询的函数。

note: Tag: title
en: Using SQL to Extract Data
zh_Hans: 使用SQL提取数据

note: Tag: para
en: The most straightforward way of extracting spatial data out of the database is to use a SQL <code>SELECT</code> query to define the data set to be extracted and dump the resulting columns into a parsable text file:
zh_Hans: 从数据库中提取空间数据的最直接方法是使用 SQL <code>SELECT</code> 查询来定义要提取的数据集并将结果列转储到可解析的文本文件中：

note: Tag: para
en: There will be times when some kind of restriction is necessary to cut down the number of records returned. In the case of attribute-based restrictions, use the same SQL syntax as used with a non-spatial table. In the case of spatial restrictions, the following functions are useful:
zh_Hans: 有时需要某种限制来减少返回的记录数量。对于基于属性的限制，请使用与非空间表相同的 SQL 语法。在空间限制的情况下，以下函数很有用：

note: Tag: para
en: This function tells whether two geometries share any space.
zh_Hans: 此函数指示两个几何图形是否共享任何空间。

note: Tag: para
en: This tests whether two geometries are geometrically identical. For example, if 'POLYGON((0 0,1 1,1 0,0 0))' is the same as 'POLYGON((0 0,1 1,1 0,0 0))' (it is).
zh_Hans: 它测试两个几何形状在几何上是否相同。例如，如果“POLYGON((0 0,1 1,1 0,0 0))”与“POLYGON((0 0,1 1,1 0,0 0))”相同（确实如此）。

note: Tag: para
en: Next, you can use these operators in queries. Note that when specifying geometries and boxes on the SQL command line, you must explicitly turn the string representations into geometries function. The 312 is a fictitious spatial reference system that matches our data. So, for example:
zh_Hans: 接下来，您可以在查询中使用这些运算符。请注意，在 SQL 命令行上指定几何图形和框时，必须显式将字符串表示形式转换为几何函数。312是一个虚构的空间参考系统，与我们的数据相匹配。例如：

note: Tag: para
en: The above query would return the single record from the "ROADS_GEOM" table in which the geometry was equal to that value.
zh_Hans: 上面的查询从“ROADS_GEOM”表中返回与该值等效的单个记录。

note: Tag: para
en: To check whether some of the roads passes in the area defined by a polygon:
zh_Hans: 要检查道路是否穿过由多边形定义的面，请执行以下操作：

note: Tag: para
en: The most common spatial query will probably be a "frame-based" query, used by client software, like data browsers and web mappers, to grab a "map frame" worth of data for display.
zh_Hans: 最常见的空间查询可能是“基于框架”的查询，由数据浏览器和网络制图器等客户端软件使用，以获取“地图框架”的数据进行显示。

note: Tag: para
en: When using the "&amp;&amp;" operator, you can specify either a BOX3D as the comparison feature or a GEOMETRY. When you specify a GEOMETRY, however, its bounding box will be used for the comparison.
zh_Hans: 使用“&amp;&amp;”运算符时，可以指定比较特征是 BOX3D 还是几何。 但是，如果指定几何图形，则其边界框用于比较。

note: Tag: para
en: Using a "BOX3D" object for the frame, such a query looks like this:
zh_Hans: 使用框架的“BOX3D”对象，查询如下所示：

note: Tag: para
en: Note the use of the SRID 312, to specify the projection of the envelope.
zh_Hans: 请注意使用 SRID 312 来指定包络的投影。

note: Tag: title
en: Using the Shapefile Dumper
zh_Hans: 使用Shapefile文件转储程序

note: Tag: para
en: The <filename>pgsql2shp</filename> table dumper connects to the database and converts a table (possibly defined by a query) into a shape file. The basic syntax is:
zh_Hans: <filename>pgsql2shp</filename>表转储器连接到数据库并将表（可能由查询定义）转换为形状文件。 基本语法是：

note: Tag: para
en: The commandline options are:
zh_Hans: 命令行选项包括：

note: Tag: term
en: -f &lt;filename&gt;
zh_Hans: -f &lt;文件名&gt;

note: Tag: para
en: Write the output to a particular filename.
zh_Hans: 将输出写入特定文件名。

note: Tag: term
en: -h &lt;host&gt;
zh_Hans: -h &lt;主机&gt;

note: Tag: para
en: The database host to connect to.
zh_Hans: 要连接到的数据库的主机名。

note: Tag: term
en: -p &lt;port&gt;
zh_Hans: -p &lt;端口&gt;

note: Tag: para
en: The port to connect to on the database host.
zh_Hans: 要连接到的数据库的端口。

note: Tag: term
en: -P &lt;password&gt;
zh_Hans: -P &lt;密码&gt;

note: Tag: para
en: The password to use when connecting to the database.
zh_Hans: 用于连接到数据库的密码。

note: Tag: term
en: -u &lt;user&gt;
zh_Hans: -u &lt;用户名&gt;

note: Tag: para
en: The username to use when connecting to the database.
zh_Hans: 要连接到数据库的用户名。

note: Tag: term
en: -g &lt;geometry column&gt;
zh_Hans: -g &lt;几何列&gt;

note: Tag: para
en: In the case of tables with multiple geometry columns, the geometry column to use when writing the shape file.
zh_Hans: 对于具有多个几何列的表，写入形状文件时要使用的几何列。

note: Tag: para
en: Use a binary cursor. This will make the operation faster, but will not work if any NON-geometry attribute in the table lacks a cast to text.
zh_Hans: 使用二进制游标。 这将使操作更快，但如果表中的任何非几何属性缺少文本转换，则该操作将不起作用。

note: Tag: para
en: Raw mode. Do not drop the <varname>gid</varname> field, or escape column names.
zh_Hans: 原始模式。不要删除<varname>gid</varname>字段或转义列名称。

note: Tag: term
en: -m <varname>filename</varname>
zh_Hans: -m <varname>文件名</varname>

note: Tag: para
en: Remap identifiers to ten character names. The content of the file is lines of two symbols separated by a single white space and no trailing or leading space: VERYLONGSYMBOL SHORTONE ANOTHERVERYLONGSYMBOL SHORTER etc.
zh_Hans: 将标识符重新映射为十个字符名称。文件的内容是由单个空格分隔的两个符号行，并且没有尾随或前导空格：VERYLONGSYMBOL SHORTONE ANOTHERVERYLONGSYMBOL SHORTER 等。

note: Tag: title
en: Spatial Indexes
zh_Hans: 空间索引

note: Tag: para
en: Spatial indexes make using a spatial database for large data sets possible. Without indexing, a search for features requires a sequential scan of every record in the database. Indexing speeds up searching by organizing the data into a structure which can be quickly traversed to find matching records.
zh_Hans: 空间索引使得使用空间数据库存储大型数据集成为可能。如果没有索引，搜索功能需要顺序扫描数据库中的每条记录。索引通过将数据组织成可快速遍历以查找匹配记录的结构来加快搜索速度。

note: Tag: para
en: The B-tree index method commonly used for attribute data is not very useful for spatial data, since it only supports storing and querying data in a single dimension. Data such as geometry (which has 2 or more dimensions) requires an index method that supports range query across all the data dimensions. One of the key advantages of PostgreSQL for spatial data handling is that it offers several kinds of index methods which work well for multi-dimensional data: GiST, BRIN and SP-GiST indexes.
zh_Hans: 通常用于属性数据的B树索引方法对于空间数据来说不是很有用，因为它只支持单个维度的数据存储和查询。诸如几何形状（具有 2 个或更多维度）之类的数据需要支持跨所有数据维度的范围查询的索引方法。PostgreSQL 在空间数据处理方面的主要优势之一是它提供了多种适用于多维数据的索引方法：GiST、BRIN 和 SP-GiST 索引。

note: Tag: para
en: <emphasis role="bold">GiST (Generalized Search Tree)</emphasis> indexes break up data into "things to one side", "things which overlap", "things which are inside" and can be used on a wide range of data-types, including GIS data. PostGIS uses an R-Tree index implemented on top of GiST to index spatial data. GiST is the most commonly-used and versatile spatial index method, and offers very good query performance.
zh_Hans: <emphasis role="bold">GiST (广义搜索树)</emphasis> 索引将数据分解为“一侧的事物”、“重叠的事物”、“内部的事物”，并且可用于多种数据类型，包括 GIS 数据。PostGIS 使用在 GiST 之上实现的 R-Tree 索引来索引空间数据。 GiST是最常用、最通用的空间索引方法，提供非常好的查询性能。

note: Tag: para
en: <emphasis role="bold">BRIN (Block Range Index)</emphasis> indexes operate by summarizing the spatial extent of ranges of table records. Search is done via a scan of the ranges. BRIN is only appropriate for use for some kinds of data (spatially sorted, with infrequent or no update). But it provides much faster index create time, and much smaller index size.
zh_Hans: <emphasis role="bold">BRIN (块范围索引)</emphasis>索引通过汇总表记录范围的空间范围进行操作。搜索是通过扫描范围来完成的。BRIN仅适用于某些类型的数据（空间排序、更新不频繁或不更新）。但它提供了更快的索引创建时间和更小的索引大小。

note: Tag: para
en: <emphasis role="bold">SP-GiST (Space-Partitioned Generalized Search Tree)</emphasis> is a generic index method that supports partitioned search trees such as quad-trees, k-d trees, and radix trees (tries).
zh_Hans: <emphasis role="bold">SP-GiST (空间分区广义搜索树)</emphasis>是一种通用索引方法，支持四叉树、k-d 树和基数树（tries）等分区搜索树。

note: Tag: para
en: Spatial indexes store only the bounding box of geometries. Spatial queries use the index as a <emphasis role="bold">primary filter</emphasis> to quickly determine a set of geometries potentially matching the query condition. Most spatial queries require a <emphasis role="bold">secondary filter</emphasis> that uses a spatial predicate function to test a more specific spatial condition. For more information on queying with spatial predicates see <xref linkend="using-query-indexes"/>.
zh_Hans: 空间索引仅存储几何图形的边界框。空间查询使用索引作为<emphasis role="bold">主要过滤器</emphasis>来快速确定一组可能与查询条件匹配的几何图形。大多数空间查询需要使用空间谓词函数的<emphasis role="bold">辅助过滤器</emphasis> 来测试更具体的空间条件。有关使用空间谓词进行查询的更多信息，请参阅<xref linkend="using-query-indexes"/> 。

note: Tag: para
en: See also the <ulink url="https://postgis.net/workshops/postgis-intro/indexing.html">PostGIS Workshop section on spatial indexes</ulink>, and the <ulink url="https://www.postgresql.org/docs/current/indexes.html">PostgreSQL manual</ulink>.
zh_Hans: 另请参阅 <ulink url="https://postgis.net/workshops/postgis-intro/indexing.html">PostGIS Workshop有关空间索引的部分</ulink>以及<ulink url="https://www.postgresql.org/docs/current/indexes.html">PostgreSQL手册</ulink>。

note: Tag: title
en: GiST Indexes
zh_Hans: GiST 索引

note: Tag: para
en: GiST stands for "Generalized Search Tree" and is a generic form of indexing for multi-dimensional data. PostGIS uses an R-Tree index implemented on top of GiST to index spatial data. GiST is the most commonly-used and versatile spatial index method, and offers very good query performance. Other implementations of GiST are used to speed up searches on all kinds of irregular data structures (integer arrays, spectral data, etc) which are not amenable to normal B-Tree indexing. For more information see the <ulink url="https://www.postgresql.org/docs/current/gist.html">PostgreSQL manual</ulink>.
zh_Hans: GiST 代表“广义搜索树”，是多维数据索引的通用形式。PostGIS 使用在 GiST 之上实现的 R-Tree 索引来索引空间数据。GiST是最常用、最通用的空间索引方法，提供非常好的查询性能。GiST 的其他实现用于加速对不适合普通 B 树索引的各种不规则数据结构（整数数组、光谱数据等）的搜索。有关详细信息，请参阅<ulink url="https://www.postgresql.org/docs/current/gist.html">PostgreSQL手册</ulink>。

note: Tag: para
en: Once a spatial data table exceeds a few thousand rows, you will want to build an index to speed up spatial searches of the data (unless all your searches are based on attributes, in which case you'll want to build a normal index on the attribute fields).
zh_Hans: 一旦空间数据表超过几千行，您将需要构建索引来加速数据的空间搜索（除非您的所有搜索都基于属性，在这种情况下，您将需要在空间数据表上构建普通索引） 属性字段）。

note: Tag: para
en: The syntax for building a GiST index on a "geometry" column is as follows:
zh_Hans: 在“几何”列上构建 GiST 索引的语法如下：

note: Tag: para
en: The above syntax will always build a 2D-index. To get the an n-dimensional index for the geometry type, you can create one using this syntax:
zh_Hans: 上述语法将始终构建 2D 索引。若要获取几何类型的 n 维索引，可以使用以下语法创建一个索引：

note: Tag: para
en: Building a spatial index is a computationally intensive exercise. It also blocks write access to your table for the time it creates, so on a production system you may want to do in in a slower CONCURRENTLY-aware way:
zh_Hans: 构建空间索引是一项计算密集型工作。它还会在创建表时阻止对表的写入访问，因此在生产系统上，您可能希望以较慢的并发感知方式执行：

note: Tag: para
en: After building an index, it is sometimes helpful to force PostgreSQL to collect table statistics, which are used to optimize query plans:
zh_Hans: 建立索引后，让 PostgreSQL 不时收集表上的统计信息会很有帮助。它用于优化查询计划。

note: Tag: title
en: BRIN Indexes
zh_Hans: BRIN 索引

note: Tag: para
en: BRIN stands for "Block Range Index". It is a general-purpose index method introduced in PostgreSQL 9.5. BRIN is a <emphasis>lossy</emphasis> index method, meaning that a secondary check is required to confirm that a record matches a given search condition (which is the case for all provided spatial indexes). It provides much faster index creation and much smaller index size, with reasonable read performance. Its primary purpose is to support indexing very large tables on columns which have a correlation with their physical location within the table. In addition to spatial indexing, BRIN can speed up searches on various kinds of attribute data structures (integer, arrays etc). For more information see the <ulink url="https://www.postgresql.org/docs/current/brin.html">PostgreSQL manual</ulink>.
zh_Hans: BRIN 代表“区块范围索引”。 它是 PostgreSQL 9.5 中引入的<emphasis>通用</emphasis>索引方法。BRIN 是一种有损索引方法，这意味着需要进行二次检查来确认记录与给定的搜索条件匹配（所有提供的空间索引都是这种情况）。它提供更快的索引创建速度和更小的索引大小，以及合理的读取性能。 其主要目的是支持在与其在表中的物理位置相关的列上对非常大的表建立索引。 除了空间索引之外，BRIN 还可以加快各种属性数据结构（整数、数组等）的搜索速度。有关详细信息，请参阅<ulink url="https://www.postgresql.org/docs/current/brin.html">PostgreSQL手册</ulink>。

note: Tag: para
en: Once a spatial table exceeds a few thousand rows, you will want to build an index to speed up spatial searches of the data. GiST indexes are very performant as long as their size doesn't exceed the amount of RAM available for the database, and as long as you can afford the index storage size, and the cost of index update on write. Otherwise, for very large tables BRIN index can be considered as an alternative.
zh_Hans: 一旦空间表超过几千行，您将需要构建索引来加速数据的空间搜索。只要 GiST 索引的大小不超过数据库可用的 RAM 量，并且只要您能够承受索引存储大小以及写入时更新索引的成本，GiST 索引的性能就非常好。 否则，对于非常大的表，可以考虑将 BRIN 索引作为替代方案。

note: Tag: para
en: A BRIN index stores the bounding box enclosing all the geometries contained in the rows in a contiguous set of table blocks, called a <emphasis>block range</emphasis>. When executing a query using the index the block ranges are scanned to find the ones that intersect the query extent. This is efficient only if the data is physically ordered so that the bounding boxes for block ranges have minimal overlap (and ideally are mutually exclusive). The resulting index is very small in size, but is typically less performant for read than a GiST index over the same data.
zh_Hans: BRIN 索引存储包围一组连续的表块（称为<emphasis>块范围</emphasis>）中的行中包含的所有几何图形的边界框。使用索引执行查询时，将扫描块范围以查找与查询范围相交的块范围。仅当数据经过物理排序以使块范围的边界框具有最小重叠（并且理想情况下是互斥的）时，这才是有效的。 生成的索引非常小，但读取相同数据时的性能通常低于 GiST 索引。

note: Tag: para
en: Building a BRIN index is much less CPU-intensive than building a GiST index. It's common to find that a BRIN index is ten times faster to build than a GiST index over the same data. And because a BRIN index stores only one bounding box for each range of table blocks, it's common to use up to a thousand times less disk space than a GiST index.
zh_Hans: 构建 BRIN 索引比构建 GiST 索引占用的 CPU 资源要少得多。我们经常发现，对于相同数据，BRIN 索引的构建速度比 GiST 索引快十倍。由于 BRIN 索引只为每个表块范围存储一个边界框，因此通常使用的磁盘空间比 GiST 索引少一千倍。

note: Tag: para
en: You can choose the number of blocks to summarize in a range. If you decrease this number, the index will be bigger but will probably provide better performance.
zh_Hans: 您可以选择要在某个范围内汇总的块数。 如果减少这个数字，索引会更大，但可能会提供更好的性能。

note: Tag: para
en: For BRIN to be effective, the table data should be stored in a physical order which minimizes the amount of block extent overlap. It may be that the data is already sorted appropriately (for instance, if it is loaded from another dataset that is already sorted in spatial order). Otherwise, this can be accomplished by sorting the data by a one-dimensional spatial key. One way to do this is to create a new table sorted by the geometry values (which in recent PostGIS versions uses an efficient Hilbert curve ordering):
zh_Hans: 为了使 BRIN 有效，表数据应按物理顺序存储，从而最大限度地减少块范围重叠量。数据可能已经适当排序（例如，如果它是从已按空间顺序排序的另一个数据集加载的）。否则，这可以通过按一维空间键对数据进行排序来完成。 一种方法是创建一个按几何值排序的新表（在最近的 PostGIS 版本中使用有效的希尔伯特曲线排序）：

note: Tag: para
en: Alternatively, data can be sorted in-place by using a GeoHash as a (temporary) index, and clustering on that index:
zh_Hans: 或者，可以通过使用 GeoHash 作为（临时）索引并对该索引进行聚类来对数据进行适当排序：

note: Tag: para
en: The syntax for building a BRIN index on a <code>geometry</code> column is:
zh_Hans: 在<code>geometry</code> 列上构建 BRIN 索引的语法为：

note: Tag: para
en: The above syntax builds a 2D index. To build a 3D-dimensional index, use this syntax:
zh_Hans: 上述语法构建二维索引。若要生成三维索引，请使用以下语法：

note: Tag: para
en: You can also get a 4D-dimensional index using the 4D operator class:
zh_Hans: 您还可以使用 4D 运算符类获取 4D 维度索引：

note: Tag: para
en: The above commands use the default number of blocks in a range, which is 128. To specify the number of blocks to summarise in a range, use this syntax
zh_Hans: 在上面的命令中，范围内的块数使用默认值 128。 此语句用于指定聚合中某个区域中的块数。

note: Tag: para
en: Keep in mind that a BRIN index only stores one index entry for a large number of rows. If your table stores geometries with a mixed number of dimensions, it's likely that the resulting index will have poor performance. You can avoid this performance penalty by choosing the operator class with the least number of dimensions of the stored geometries
zh_Hans: 请记住，BRIN 索引仅存储大量行的一个索引条目。如果您的表存储具有混合维数的几何图形，则生成的索引的性能可能会很差。您可以通过选择存储几何图形维数最少的运算符类来避免这种性能损失

note: Tag: para
en: The <code>geography</code> datatype is supported for BRIN indexing. The syntax for building a BRIN index on a geography column is:
zh_Hans: BRIN 索引支持<code>地理</code>数据类型。在地理列上构建 BRIN 索引的语法是：

note: Tag: para
en: The above syntax builds a 2D-index for geospatial objects on the spheroid.
zh_Hans: 上述语法为椭球体上的地理空间对象构建 2D 索引。

note: Tag: para
en: Currently, only "inclusion support" is provided, meaning that just the <varname>&amp;&amp;</varname>, <varname>~</varname> and <varname>@</varname> operators can be used for the 2D cases (for both <code>geometry</code> and <code>geography</code>), and just the <varname>&amp;&amp;&amp;</varname> operator for 3D geometries. There is currently no support for kNN searches.
zh_Hans: 目前，仅提供“包容性支持”，这意味着只有<varname>&amp;&amp;</varname>、<varname>~</varname>和 <varname>@</varname>运算符可用于 2D 情况（对于<code>几何</code>和<code>地理</code> ），而运算符 <varname>&amp;&amp;&amp;</varname>只能用于 3D 几何图形。目前不支持 kNN 搜索。

note: Tag: para
en: An important difference between BRIN and other index types is that the database does not maintain the index dynamically. Changes to spatial data in the table are simply appended to the end of the index. This will cause index search performance to degrade over time. The index can be updated by performing a <code>VACUUM</code>, or by using a special function <code>brin_summarize_new_values(regclass)</code>. For this reason BRIN may be most appropriate for use with data that is read-only, or only rarely changing. For more information refer to the <ulink url="https://www.postgresql.org/docs/current/brin-intro.html#BRIN-OPERATION">manual</ulink>.
zh_Hans: BRIN 与其他索引类型的一个重要区别是数据库不会动态维护索引。对表中空间数据的更改只需附加到索引的末尾。这将导致索引搜索性能随着时间的推移而降低。 可以通过执行 <code>VACUUM</code>或使用特殊函数<code>brin_summarize_new_values(regclass)</code>来更新索引。 因此，BRIN 可能最适合用于只读或很少更改的数据。有关更多信息，请参阅<ulink url="https://www.postgresql.org/docs/current/brin-intro.html#BRIN-OPERATION">手册</ulink>。

note: Tag: para
en: To summarize using BRIN for spatial data:
zh_Hans: 总结一下对空间数据使用 BRIN 的情况：

note: Tag: para
en: Index build time is very fast, and index size is very small.
zh_Hans: 索引构建时间非常快，索引大小非常小。

note: Tag: para
en: Index query time is slower than GiST, but can still be very acceptable.
zh_Hans: 索引查询时间比 GiST 慢，但完全可以接受。

note: Tag: para
en: Requires table data to be sorted in a spatial ordering.
zh_Hans: 要求按空间顺序对表数据进行排序。

note: Tag: para
en: Requires manual index maintenance.
zh_Hans: 需要手动维护索引。

note: Tag: para
en: Most appropriate for very large tables, with low or no overlap (e.g. points), which are static or change infrequently.
zh_Hans: 它最适合重叠很少或没有重叠（例如，点）且静态或不经常更改的大型表。

note: Tag: para
en: More effective for queries which return relatively large numbers of data records.
zh_Hans: 对于返回相对大量数据记录的查询更有效。

note: Tag: title
en: SP-GiST Indexes
zh_Hans: SP-GiST 索引

note: Tag: para
en: SP-GiST stands for "Space-Partitioned Generalized Search Tree" and is a generic form of indexing for multi-dimensional data types that supports partitioned search trees, such as quad-trees, k-d trees, and radix trees (tries). The common feature of these data structures is that they repeatedly divide the search space into partitions that need not be of equal size. In addition to spatial indexing, SP-GiST is used to speed up searches on many kinds of data, such as phone routing, ip routing, substring search, etc. For more information see the <ulink url="https://www.postgresql.org/docs/current/spgist.html">PostgreSQL manual</ulink>.
zh_Hans: SP-GiST代表“空间分区广义搜索树”，是多维数据类型索引的通用形式，支持分区搜索树，例如四叉树、k-d 树和基数树 (tries)。 这些数据结构的共同特征是它们将搜索空间重复划分为大小不必相等的分区。除了空间索引之外，SP-GiST 还用于加速多种数据的搜索，例如电话路由、ip 路由、子字符串搜索等。有关更多信息，请参阅<ulink url="https://www.postgresql.org/docs/current/spgist.html">PostgreSQL手册</ulink>。

note: Tag: para
en: As it is the case for GiST indexes, SP-GiST indexes are lossy, in the sense that they store the bounding box enclosing spatial objects. SP-GiST indexes can be considered as an alternative to GiST indexes.
zh_Hans: 与 GiST 索引的情况一样，SP-GiST索引是有损的，因为它们存储包围空间对象的边界框。SP-GiST 索引可以被视为 GiST 索引的替代方案。

note: Tag: para
en: Once a GIS data table exceeds a few thousand rows, an SP-GiST index may be used to speed up spatial searches of the data. The syntax for building an SP-GiST index on a "geometry" column is as follows:
zh_Hans: 一旦 GIS 数据表超过几千行，就可以使用 SP-GiST 索引来加速数据的空间搜索。 在“几何”列上构建 SP-GiST 索引的语法如下：

note: Tag: para
en: The above syntax will build a 2-dimensional index. A 3-dimensional index for the geometry type can be created using the 3D operator class:
zh_Hans: 上面的语句构建了一个二维索引。 几何类型的三维索引是使用三维运算符类生成的，如下所示：

note: Tag: para
en: Building a spatial index is a computationally intensive operation. It also blocks write access to your table for the time it creates, so on a production system you may want to do in in a slower CONCURRENTLY-aware way:
zh_Hans: 构建空间索引是一项计算密集型操作。它还会在创建表时阻止对表的写入访问，因此在生产系统上，您可能希望以较慢的并发感知方式执行操作：

note: Tag: para
en: An SP-GiST index can accelerate queries involving the following operators:
zh_Hans: SP-GiST 索引可以加速涉及以下运算符的查询：

note: Tag: para
en: &lt;&lt;, &amp;&lt;, &amp;&gt;, &gt;&gt;, &lt;&lt;|, &amp;&lt;|, |&amp;&gt;, |&gt;&gt;, &amp;&amp;, @&gt;, &lt;@, and ~=, for 2-dimensional indexes,
zh_Hans: 对于二维索引，&lt;&lt;, &amp;&lt;, &amp;&gt;, &gt;&gt;, &lt;&lt;|, &amp;&lt;|, |&amp;&gt;, |&gt;&gt;, &amp;&amp;, @&gt;, &lt;@, 和 ~=。

note: Tag: para
en: &amp;/&amp;, ~==, @&gt;&gt;, and &lt;&lt;@, for 3-dimensional indexes.
zh_Hans: 对于三维索引，&amp;/&amp;, ~==, @&gt;&gt;,和&lt;&lt;@,

note: Tag: para
en: There is no support for kNN searches at the moment.
zh_Hans: 目前不支持 kNN 搜索。

note: Tag: title
en: Tuning Index Usage
zh_Hans: 调优索引的使用

note: Tag: para
en: Ordinarily, indexes invisibly speed up data access: once an index is built, the PostgreSQL query planner automatically decides when to use it to improve query performance. But there are some situations where the planner does not choose to use existing indexes, so queries end up using slow sequential scans instead of a spatial index.
zh_Hans: 通常，索引会无形中加速数据访问：一旦建立索引，PostgreSQL查询规划器就会自动决定何时使用它来提高查询性能。但在某些情况下，规划器不会选择使用现有索引，因此查询最终会使用缓慢的顺序扫描而不是空间索引。

note: Tag: para
en: If you find your spatial indexes are not being used, there are a few things you can do:
zh_Hans: 如果发现空间索引未被使用， 您可以执行以下几项操作：

note: Tag: para
en: Examine the query plan and check your query actually computes the thing you need. An erroneous JOIN, either forgotten or to the wrong table, can unexpectedly retrieve table records multiple times. To get the query plan, execute with <code>EXPLAIN</code> in front of the query.
zh_Hans: 可以通过测试查询计划和查看查询来计算所需的内容。不正确的连接、忘记的表和不正确的表可能会导致多次意外的表记录查找。若要获取查询计划，请在查询开始时执行<code>EXPLAIN</code>。

note: Tag: para
en: Make sure statistics are gathered about the number and distributions of values in a table, to provide the query planner with better information to make decisions around index usage. <command>VACUUM ANALYZE</command> will compute both.
zh_Hans: 确保收集有关表中值的数量和分布的统计信息，以便为查询规划者提供更好的信息来做出有关索引使用的决策。<command>VACUUM ANALYZE</command>将计算两者。

note: Tag: para
en: You should regularly vacuum your databases anyways. Many PostgreSQL DBAs run <command>VACUUM</command> as an off-peak cron job on a regular basis.
zh_Hans: 无论如何，您应该定期清理数据库。许多 PostgreSQL DBA 定期将 <command>VACUUM</command> 作为非高峰 cron 作业运行。

note: Tag: para
en: If vacuuming does not help, you can temporarily force the planner to use the index information by using the command <command>SET ENABLE_SEQSCAN TO OFF;</command>. This way you can check whether the planner is at all able to generate an index-accelerated query plan for your query. You should only use this command for debugging; generally speaking, the planner knows better than you do about when to use indexes. Once you have run your query, do not forget to run <command>SET ENABLE_SEQSCAN TO ON;</command> so that the planner will operate normally for other queries.
zh_Hans: 如果清理没有帮助，您可以使用命令<command>SET ENABLE_SEQSCAN TO OFF;</command>; 暂时强制规划器使用索引信息。 通过这种方式，您可以检查规划器是否能够为您的查询生成索引加速查询计划。您应该仅使用此命令进行调试；一般来说，规划者比你更了解何时使用索引。运行查询后，不要忘记运行<command>SET ENABLE_SEQSCAN TO ON;</command>； 以便规划器能够正常运行其他查询。

note: Tag: para
en: If <command>SET ENABLE_SEQSCAN TO OFF;</command> helps your query to run faster, your Postgres is likely not tuned for your hardware. If you find the planner wrong about the cost of sequential versus index scans try reducing the value of <varname>RANDOM_PAGE_COST</varname> in <code>postgresql.conf</code>, or use <command>SET RANDOM_PAGE_COST TO 1.1;</command>. The default value for <varname>RANDOM_PAGE_COST</varname> is 4.0. Try setting it to 1.1 (for SSD) or 2.0 (for fast magnetic disks). Decreasing the value makes the planner more likely to use index scans.
zh_Hans: 如果<command>SET ENABLE_SEQSCAN TO OFF;</command>； 帮助你的查询运行得更快，你的 Postgres 可能没有针对你的硬件进行调整。 如果您发现规划器对顺序扫描与索引扫描的成本有误，请尝试减少 postgresql.conf 中 <varname>RANDOM_PAGE_COST</varname> 的值，或使用<command>SET RANDOM_PAGE_COST TO 1.1;</command>;。 <varname>RANDOM_PAGE_COST</varname> 的默认值为 4.0。尝试将其设置为 1.1（对于 SSD）或 2.0（对于快速磁盘）。 减小该值使规划器更有可能使用索引扫描。

note: Tag: para
en: If <command>SET ENABLE_SEQSCAN TO OFF;</command> does not help your query, the query may be using a SQL construct that the Postgres planner is not yet able to optimize. It may be possible to rewrite the query in a way that the planner is able to handle. For example, a subquery with an inline SELECT may not produce an efficient plan, but could possibly be rewritten using a LATERAL JOIN.
zh_Hans: 如果<command>SET ENABLE_SEQSCAN TO OFF;</command>对您的查询没有帮助，该查询可能使用 Postgres 规划器尚无法优化的 SQL 构造。 可以以规划器能够处理的方式重写查询。例如，具有内联 SELECT 的子查询可能不会产生有效的计划，但可能会使用 LATERAL JOIN 进行重写。

note: Tag: para
en: For more information see the Postgres manual section on <ulink url="https://www.postgresql.org/docs/current/runtime-config-query.html">Query Planning</ulink>.
zh_Hans: 有关更多信息，请参阅 PostgreSQL 手册的<ulink url="https://www.postgresql.org/docs/current/runtime-config-query.html">查询规划</ulink>部分。
