<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="spatial-function-argument-handling">
      </a>
      14.16.2 Argument Handling by Spatial Functions
     </h3>
    </div>
   </div>
  </div>
  <p>
   Spatial values, or geometries, have the properties described in
   <a class="xref" href="gis-class-geometry.html" title="13.4.2.2 Geometry Class">
    Section 13.4.2.2, “Geometry Class”
   </a>
   . The following discussion
      lists general spatial function argument-handling characteristics.
      Specific functions or groups of functions may have additional or
      different argument-handling characteristics, as discussed in the
      sections where those function descriptions occur. Where that is
      true, those descriptions take precedence over the general
      discussion here.
  </p>
  <p>
   Spatial functions are defined only for valid geometry values. See
   <a class="xref" href="geometry-well-formedness-validity.html" title="13.4.4 Geometry Well-Formedness and Validity">
    Section 13.4.4, “Geometry Well-Formedness and Validity”
   </a>
   .
  </p>
  <p>
   Each geometry value is associated with a spatial reference system
      (SRS), which is a coordinate-based system for geographic
      locations. See
   <a class="xref" href="spatial-reference-systems.html" title="13.4.5 Spatial Reference System Support">
    Section 13.4.5, “Spatial Reference System Support”
   </a>
   .
  </p>
  <a class="indexterm" name="idm46045198057408">
  </a>
  <p>
   The spatial reference identifier (SRID) of a geometry identifies
      the SRS in which the geometry is defined. In MySQL, the SRID value
      is an integer associated with the geometry value. The maximum
      usable SRID value is 2
   <sup>
    32
   </sup>
   −1. If a
      larger value is given, only the lower 32 bits are used.
  </p>
  <p>
   SRID 0 represents an infinite flat Cartesian plane with no units
      assigned to its axes. To ensure SRID 0 behavior, create geometry
      values using SRID 0. SRID 0 is the default for new geometry values
      if no SRID is specified.
  </p>
  <p>
   For computations on multiple geometry values, all values must be
      in the same SRS or an error occurs. Thus, spatial functions that
      take multiple geometry arguments require those arguments to be in
      the same SRS. If a spatial function returns
   <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_gis_different_srids" target="_top">
    <code class="literal">
     ER_GIS_DIFFERENT_SRIDS
    </code>
   </a>
   , it means
      that the geometry arguments were not all in the same SRS. You must
      modify them to have the same SRS.
  </p>
  <p>
   A geometry returned by a spatial function is in the SRS of the
      geometry arguments because geometry values produced by any spatial
      function inherit the SRID of the geometry arguments.
  </p>
  <p>
   The
   <a class="ulink" href="http://www.opengeospatial.org" target="_blank">
    Open Geospatial
      Consortium
   </a>
   guidelines require that input polygons already
      be closed, so unclosed polygons are rejected as invalid rather
      than being closed.
  </p>
  <p>
   In MySQL, the only valid empty geometry is represented in the form
      of an empty geometry collection. Empty geometry collection
      handling is as follows: An empty WKT input geometry collection may
      be specified as
   <code class="literal">
    'GEOMETRYCOLLECTION()'
   </code>
   . This is
      also the output WKT resulting from a spatial operation that
      produces an empty geometry collection.
  </p>
  <p>
   During parsing of a nested geometry collection, the collection is
      flattened and its basic components are used in various GIS
      operations to compute results. This provides additional
      flexibility to users because it is unnecessary to be concerned
      about the uniqueness of geometry data. Nested geometry collections
      may be produced from nested GIS function calls without having to
      be explicitly flattened first.
  </p>
 </div>
 <br/>
</div>
