<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="spatial-operator-functions">
      </a>
      14.16.8 Spatial Operator Functions
     </h3>
    </div>
   </div>
  </div>
  <p>
   OpenGIS proposes a number of functions that can produce
      geometries. They are designed to implement spatial operators.
      These functions support all argument type combinations except
      those that are inapplicable according to the
   <a class="ulink" href="http://www.opengeospatial.org" target="_blank">
    Open Geospatial
      Consortium
   </a>
   specification.
  </p>
  <p>
   MySQL also implements certain functions that are extensions to
      OpenGIS, as noted in the function descriptions. In addition,
   <a class="xref" href="gis-property-functions.html" title="14.16.7 Geometry Property Functions">
    Section 14.16.7, “Geometry Property Functions”
   </a>
   , discusses several
      functions that construct new geometries from existing ones. See
      that section for descriptions of these functions:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="gis-general-property-functions.html#function_st-envelope">
       <code class="literal">
        ST_Envelope(
        <em class="replaceable">
         <code>
          g
         </code>
        </em>
        )
       </code>
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="gis-linestring-property-functions.html#function_st-startpoint">
       <code class="literal">
        ST_StartPoint(
        <em class="replaceable">
         <code>
          ls
         </code>
        </em>
        )
       </code>
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="gis-linestring-property-functions.html#function_st-endpoint">
       <code class="literal">
        ST_EndPoint(
        <em class="replaceable">
         <code>
          ls
         </code>
        </em>
        )
       </code>
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="gis-linestring-property-functions.html#function_st-pointn">
       <code class="literal">
        ST_PointN(
        <em class="replaceable">
         <code>
          ls
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        )
       </code>
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="gis-polygon-property-functions.html#function_st-exteriorring">
       <code class="literal">
        ST_ExteriorRing(
        <em class="replaceable">
         <code>
          poly
         </code>
        </em>
        )
       </code>
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="gis-polygon-property-functions.html#function_st-interiorringn">
       <code class="literal">
        ST_InteriorRingN(
        <em class="replaceable">
         <code>
          poly
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        )
       </code>
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="gis-geometrycollection-property-functions.html#function_st-geometryn">
       <code class="literal">
        ST_GeometryN(
        <em class="replaceable">
         <code>
          gc
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        )
       </code>
      </a>
     </p>
    </li>
   </ul>
  </div>
  <p>
   Unless otherwise specified, functions in this section handle their
      geometry arguments as follows:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      If any argument is
      <code class="literal">
       NULL
      </code>
      , the return value
          is
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      If any geometry argument is not a syntactically well-formed
          geometry, an
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_gis_invalid_data" target="_top">
       <code class="literal">
        ER_GIS_INVALID_DATA
       </code>
      </a>
      error
          occurs.
     </p>
    </li>
    <li class="listitem">
     <p>
      If any geometry argument is a syntactically well-formed
          geometry in an undefined spatial reference system (SRS), an
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_srs_not_found" target="_top">
       <code class="literal">
        ER_SRS_NOT_FOUND
       </code>
      </a>
      error occurs.
     </p>
    </li>
    <li class="listitem">
     <p>
      For functions that take multiple geometry arguments, if those
          arguments are not in the same SRS, an
      <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>
      error
          occurs.
     </p>
    </li>
    <li class="listitem">
     <p>
      If any geometry argument has an SRID value for a geographic
          SRS and the function does not handle geographic geometries, an
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_implemented_for_geographic_srs" target="_top">
       <code class="literal">
        ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS
       </code>
      </a>
      error occurs.
     </p>
    </li>
    <li class="listitem">
     <p>
      For geographic SRS geometry arguments, if any argument has a
          longitude or latitude that is out of range, an error occurs:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If a longitude value is not in the range (−180,
              180], an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_geometry_param_longitude_out_of_range" target="_top">
          <code class="literal">
           ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If a latitude value is not in the range [−90, 90],
              an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_geometry_param_latitude_out_of_range" target="_top">
          <code class="literal">
           ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE
          </code>
         </a>
         error occurs.
        </p>
       </li>
      </ul>
     </div>
     <p>
      Ranges shown are in degrees. If an SRS uses another unit, the
          range uses the corresponding values in its unit. The exact
          range limits deviate slightly due to floating-point
          arithmetic.
     </p>
    </li>
    <li class="listitem">
     <p>
      Otherwise, the return value is non-
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
   </ul>
  </div>
  <p>
   These spatial operator functions are available:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <a name="function_st-buffer">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-buffer">
       <code class="literal">
        ST_Buffer(
        <em class="replaceable">
         <code>
          g
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          d
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          strategy1
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          strategy2
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          strategy3
         </code>
        </em>
        ]]])
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196949904">
     </a>
     <p>
      Returns a geometry that represents all points whose distance
          from the geometry value
      <em class="replaceable">
       <code>
        g
       </code>
      </em>
      is less
          than or equal to a distance of
      <em class="replaceable">
       <code>
        d
       </code>
      </em>
      .
          The result is in the same SRS as the geometry argument.
     </p>
     <p>
      If the geometry argument is empty,
      <a class="link" href="spatial-operator-functions.html#function_st-buffer">
       <code class="literal">
        ST_Buffer()
       </code>
      </a>
      returns an empty
          geometry.
     </p>
     <p>
      If the distance is 0,
      <a class="link" href="spatial-operator-functions.html#function_st-buffer">
       <code class="literal">
        ST_Buffer()
       </code>
      </a>
      returns the
          geometry argument unchanged:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa39700893"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@pt</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(0 0)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Buffer</span><span class="token punctuation">(</span><span class="token variable">@pt</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Buffer(@pt, 0)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POINT(0 0)                   <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
     <p>
      If the geometry argument is in a Cartesian SRS:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <a class="link" href="spatial-operator-functions.html#function_st-buffer">
          <code class="literal">
           ST_Buffer()
          </code>
         </a>
         supports
              negative distances for
         <code class="literal">
          Polygon
         </code>
         and
         <code class="literal">
          MultiPolygon
         </code>
         values, and for geometry
              collections containing
         <code class="literal">
          Polygon
         </code>
         or
         <code class="literal">
          MultiPolygon
         </code>
         values.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the result is reduced so much that it disappears, the
              result is an empty geometry.
        </p>
       </li>
       <li class="listitem">
        <p>
         An
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_arguments" target="_top">
          <code class="literal">
           ER_WRONG_ARGUMENTS
          </code>
         </a>
         error occurs for
         <a class="link" href="spatial-operator-functions.html#function_st-buffer">
          <code class="literal">
           ST_Buffer()
          </code>
         </a>
         with a negative
              distance for
         <code class="literal">
          Point
         </code>
         ,
         <code class="literal">
          MultiPoint
         </code>
         ,
         <code class="literal">
          LineString
         </code>
         , and
         <code class="literal">
          MultiLineString
         </code>
         values, and for
              geometry collections not containing any
         <code class="literal">
          Polygon
         </code>
         or
         <code class="literal">
          MultiPolygon
         </code>
         values.
        </p>
       </li>
      </ul>
     </div>
     <p>
      <code class="literal">
       Point
      </code>
      geometries in a geographic SRS are
          permitted, subject to the following conditions:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If the distance is not negative and no strategies are
              specified, the function returns the geographic buffer of
              the
         <code class="literal">
          Point
         </code>
         in its SRS. The distance
              argument must be in the SRS distance unit (currently
              always meters).
        </p>
       </li>
       <li class="listitem">
        <p>
         If the distance is negative or any strategy (except
         <code class="literal">
          NULL
         </code>
         ) is specified, an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_arguments" target="_top">
          <code class="literal">
           ER_WRONG_ARGUMENTS
          </code>
         </a>
         error
              occurs.
        </p>
       </li>
      </ul>
     </div>
     <p>
      For non-
      <code class="literal">
       Point
      </code>
      geometries, an
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_implemented_for_geographic_srs" target="_top">
       <code class="literal">
        ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS
       </code>
      </a>
      error occurs.
     </p>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-buffer">
       <code class="literal">
        ST_Buffer()
       </code>
      </a>
      permits up to three
          optional strategy arguments following the distance argument.
          Strategies influence buffer computation. These arguments are
          byte string values produced by the
      <a class="link" href="spatial-operator-functions.html#function_st-buffer-strategy">
       <code class="literal">
        ST_Buffer_Strategy()
       </code>
      </a>
      function,
          to be used for point, join, and end strategies:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Point strategies apply to
         <code class="literal">
          Point
         </code>
         and
         <code class="literal">
          MultiPoint
         </code>
         geometries. If no point
              strategy is specified, the default is
         <a class="link" href="spatial-operator-functions.html#function_st-buffer-strategy">
          <code class="literal">
           ST_Buffer_Strategy('point_circle',
              32)
          </code>
         </a>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         Join strategies apply to
         <code class="literal">
          LineString
         </code>
         ,
         <code class="literal">
          MultiLineString
         </code>
         ,
         <code class="literal">
          Polygon
         </code>
         , and
         <code class="literal">
          MultiPolygon
         </code>
         geometries. If no join
              strategy is specified, the default is
         <a class="link" href="spatial-operator-functions.html#function_st-buffer-strategy">
          <code class="literal">
           ST_Buffer_Strategy('join_round',
              32)
          </code>
         </a>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         End strategies apply to
         <code class="literal">
          LineString
         </code>
         and
         <code class="literal">
          MultiLineString
         </code>
         geometries. If no end
              strategy is specified, the default is
         <a class="link" href="spatial-operator-functions.html#function_st-buffer-strategy">
          <code class="literal">
           ST_Buffer_Strategy('end_round',
              32)
          </code>
         </a>
         .
        </p>
       </li>
      </ul>
     </div>
     <p>
      Up to one strategy of each type may be specified, and they may
          be given in any order.
     </p>
     <p>
      If the buffer strategies are invalid, an
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_arguments" target="_top">
       <code class="literal">
        ER_WRONG_ARGUMENTS
       </code>
      </a>
      error
          occurs. Strategies are invalid under any of these
          circumstances:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Multiple strategies of a given type (point, join, or end)
              are specified.
        </p>
       </li>
       <li class="listitem">
        <p>
         A value that is not a strategy (such as an arbitrary
              binary string or a number) is passed as a strategy.
        </p>
       </li>
       <li class="listitem">
        <p>
         A
         <code class="literal">
          Point
         </code>
         strategy is passed and the
              geometry contains no
         <code class="literal">
          Point
         </code>
         or
         <code class="literal">
          MultiPoint
         </code>
         values.
        </p>
       </li>
       <li class="listitem">
        <p>
         An end or join strategy is passed and the geometry
              contains no
         <code class="literal">
          LineString
         </code>
         ,
         <code class="literal">
          Polygon
         </code>
         ,
         <code class="literal">
          MultiLinestring
         </code>
         or
         <code class="literal">
          MultiPolygon
         </code>
         values.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42430992"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@pt</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(0 0)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@pt_strategy</span> <span class="token operator">=</span> <span class="token function">ST_Buffer_Strategy</span><span class="token punctuation">(</span><span class="token string">'point_square'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Buffer</span><span class="token punctuation">(</span><span class="token variable">@pt</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token variable">@pt_strategy</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Buffer(@pt, 2, @pt_strategy)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POLYGON((<span class="token punctuation">-</span>2 <span class="token punctuation">-</span>2,2 <span class="token punctuation">-</span>2,2 2,<span class="token punctuation">-</span>2 2,<span class="token punctuation">-</span>2 <span class="token punctuation">-</span>2))       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa80736909"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@ls</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 0,0 5,5 5)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@end_strategy</span> <span class="token operator">=</span> <span class="token function">ST_Buffer_Strategy</span><span class="token punctuation">(</span><span class="token string">'end_flat'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@join_strategy</span> <span class="token operator">=</span> <span class="token function">ST_Buffer_Strategy</span><span class="token punctuation">(</span><span class="token string">'join_round'</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Buffer</span><span class="token punctuation">(</span><span class="token variable">@ls</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token variable">@end_strategy</span><span class="token punctuation">,</span> <span class="token variable">@join_strategy</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Buffer(@ls, 5, @end_strategy, @join_strategy))   <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POLYGON((5 5,5 10,0 10,<span class="token punctuation">-</span>3.5355339059327373 8.535533905932738, <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> <span class="token punctuation">-</span>5 5,<span class="token punctuation">-</span>5 0,0 0,5 0,5 5))                                       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-buffer-strategy">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-buffer-strategy">
       <code class="literal">
        ST_Buffer_Strategy(
        <em class="replaceable">
         <code>
          strategy
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          points_per_circle
         </code>
        </em>
        ])
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196875776">
     </a>
     <p>
      This function returns a strategy byte string for use with
      <a class="link" href="spatial-operator-functions.html#function_st-buffer">
       <code class="literal">
        ST_Buffer()
       </code>
      </a>
      to influence buffer
          computation.
     </p>
     <p>
      Information about strategies is available at
      <a class="ulink" href="http://www.boost.org" target="_blank">
       Boost.org
      </a>
      .
     </p>
     <p>
      The first argument must be a string indicating a strategy
          option:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         For point strategies, permitted values are
         <code class="literal">
          'point_circle'
         </code>
         and
         <code class="literal">
          'point_square'
         </code>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         For join strategies, permitted values are
         <code class="literal">
          'join_round'
         </code>
         and
         <code class="literal">
          'join_miter'
         </code>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         For end strategies, permitted values are
         <code class="literal">
          'end_round'
         </code>
         and
         <code class="literal">
          'end_flat'
         </code>
         .
        </p>
       </li>
      </ul>
     </div>
     <p>
      If the first argument is
      <code class="literal">
       'point_circle'
      </code>
      ,
      <code class="literal">
       'join_round'
      </code>
      ,
      <code class="literal">
       'join_miter'
      </code>
      , or
      <code class="literal">
       'end_round'
      </code>
      , the
      <em class="replaceable">
       <code>
        points_per_circle
       </code>
      </em>
      argument must be
          given as a positive numeric value. The maximum
      <em class="replaceable">
       <code>
        points_per_circle
       </code>
      </em>
      value is the
          value of the
      <a class="link" href="server-system-variables.html#sysvar_max_points_in_geometry">
       <code class="literal">
        max_points_in_geometry
       </code>
      </a>
      system
          variable.
     </p>
     <p>
      For examples, see the description of
      <a class="link" href="spatial-operator-functions.html#function_st-buffer">
       <code class="literal">
        ST_Buffer()
       </code>
      </a>
      .
     </p>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-buffer-strategy">
       <code class="literal">
        ST_Buffer_Strategy()
       </code>
      </a>
      handles
          its arguments as described in the introduction to this
          section, with these exceptions:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If any argument is invalid, an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_arguments" target="_top">
          <code class="literal">
           ER_WRONG_ARGUMENTS
          </code>
         </a>
         error
              occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the first argument is
         <code class="literal">
          'point_square'
         </code>
         or
         <code class="literal">
          'end_flat'
         </code>
         , the
         <em class="replaceable">
          <code>
           points_per_circle
          </code>
         </em>
         argument must
              not be given or an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_arguments" target="_top">
          <code class="literal">
           ER_WRONG_ARGUMENTS
          </code>
         </a>
         error
              occurs.
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-convexhull">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-convexhull">
       <code class="literal">
        ST_ConvexHull(
        <em class="replaceable">
         <code>
          g
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196843216">
     </a>
     <p>
      Returns a geometry that represents the convex hull of the
          geometry value
      <em class="replaceable">
       <code>
        g
       </code>
      </em>
      .
     </p>
     <p>
      This function computes a geometry's convex hull by first
          checking whether its vertex points are colinear. The function
          returns a linear hull if so, a polygon hull otherwise. This
          function processes geometry collections by extracting all
          vertex points of all components of the collection, creating a
      <code class="literal">
       MultiPoint
      </code>
      value from them, and computing
          its convex hull.
     </p>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-convexhull">
       <code class="literal">
        ST_ConvexHull()
       </code>
      </a>
      handles its
          arguments as described in the introduction to this section,
          with this exception:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         The return value is
         <code class="literal">
          NULL
         </code>
         for the
              additional condition that the argument is an empty
              geometry collection.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa77755492"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@g</span> <span class="token operator">=</span> <span class="token string">'MULTIPOINT(5 0,25 0,15 10,15 25)'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_ConvexHull</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token variable">@g</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_ConvexHull(ST_GeomFromText(@g))) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POLYGON((5 0,25 0,15 25,5 0))                 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-difference">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-difference">
       <code class="literal">
        ST_Difference(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196826352">
     </a>
     <p>
      Returns a geometry that represents the point set difference of
          the geometry values
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      and
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      . The result is in the same SRS
          as the geometry arguments.
     </p>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-difference">
       <code class="literal">
        ST_Difference()
       </code>
      </a>
      permits
          arguments in either a Cartesian or a geographic SRS, and
          handles its arguments as described in the introduction to this
          section.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51870913"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@g1</span> <span class="token operator">=</span> <span class="token function">Point</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token variable">@g2</span> <span class="token operator">=</span> <span class="token function">Point</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Difference</span><span class="token punctuation">(</span><span class="token variable">@g1</span><span class="token punctuation">,</span> <span class="token variable">@g2</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Difference(@g1, @g2)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POINT(1 1)                         <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-intersection">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-intersection">
       <code class="literal">
        ST_Intersection(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196812576">
     </a>
     <p>
      Returns a geometry that represents the point set intersection
          of the geometry values
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      and
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      . The result is in the same SRS
          as the geometry arguments.
     </p>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-intersection">
       <code class="literal">
        ST_Intersection()
       </code>
      </a>
      permits
          arguments in either a Cartesian or a geographic SRS, and
          handles its arguments as described in the introduction to this
          section.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11054557"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@g1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LineString(1 1, 3 3)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@g2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LineString(1 3, 3 1)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Intersection</span><span class="token punctuation">(</span><span class="token variable">@g1</span><span class="token punctuation">,</span> <span class="token variable">@g2</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Intersection(@g1, @g2)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POINT(2 2)                           <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-lineinterpolatepoint">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoint">
       <code class="literal">
        ST_LineInterpolatePoint(
        <em class="replaceable">
         <code>
          ls
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          fractional_distance
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196798016">
     </a>
     <p>
      This function takes a
      <code class="literal">
       LineString
      </code>
      geometry
          and a fractional distance in the range [0.0, 1.0] and returns
          the
      <code class="literal">
       Point
      </code>
      along the
      <code class="literal">
       LineString
      </code>
      at the given fraction of the
          distance from its start point to its endpoint. It can be used
          to answer questions such as which
      <code class="literal">
       Point
      </code>
      lies halfway along the road described by the geometry
          argument.
     </p>
     <p>
      The function is implemented for
      <code class="literal">
       LineString
      </code>
      geometries in all spatial reference systems, both Cartesian
          and geographic.
     </p>
     <p>
      If the
      <em class="replaceable">
       <code>
        fractional_distance
       </code>
      </em>
      argument
          is 1.0, the result may not be exactly the last point of the
      <code class="literal">
       LineString
      </code>
      argument but a point close to it
          due to numerical inaccuracies in approximate-value
          computations.
     </p>
     <p>
      A related function,
      <a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoints">
       <code class="literal">
        ST_LineInterpolatePoints()
       </code>
      </a>
      ,
          takes similar arguments but returns a
      <code class="literal">
       MultiPoint
      </code>
      consisting of
      <code class="literal">
       Point
      </code>
      values along the
      <code class="literal">
       LineString
      </code>
      at each fraction of the distance
          from its start point to its endpoint. For examples of both
          functions, see the
      <a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoints">
       <code class="literal">
        ST_LineInterpolatePoints()
       </code>
      </a>
      description.
     </p>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoint">
       <code class="literal">
        ST_LineInterpolatePoint()
       </code>
      </a>
      handles its arguments as described in the introduction to this
          section, with these exceptions:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If the geometry argument is not a
         <code class="literal">
          LineString
         </code>
         , an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_unexpected_geometry_type" target="_top">
          <code class="literal">
           ER_UNEXPECTED_GEOMETRY_TYPE
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the fractional distance argument is outside the range
              [0.0, 1.0], an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_data_out_of_range" target="_top">
          <code class="literal">
           ER_DATA_OUT_OF_RANGE
          </code>
         </a>
         error
              occurs.
        </p>
       </li>
      </ul>
     </div>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoint">
       <code class="literal">
        ST_LineInterpolatePoint()
       </code>
      </a>
      is a
          MySQL extension to OpenGIS.
     </p>
    </li>
    <li class="listitem">
     <a name="function_st-lineinterpolatepoints">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoints">
       <code class="literal">
        ST_LineInterpolatePoints(
        <em class="replaceable">
         <code>
          ls
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          fractional_distance
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196769456">
     </a>
     <p>
      This function takes a
      <code class="literal">
       LineString
      </code>
      geometry
          and a fractional distance in the range (0.0, 1.0] and returns
          the
      <code class="literal">
       MultiPoint
      </code>
      consisting of the
      <code class="literal">
       LineString
      </code>
      start point, plus
      <code class="literal">
       Point
      </code>
      values along the
      <code class="literal">
       LineString
      </code>
      at each fraction of the distance
          from its start point to its endpoint. It can be used to answer
          questions such as which
      <code class="literal">
       Point
      </code>
      values lie
          every 10% of the way along the road described by the geometry
          argument.
     </p>
     <p>
      The function is implemented for
      <code class="literal">
       LineString
      </code>
      geometries in all spatial reference systems, both Cartesian
          and geographic.
     </p>
     <p>
      If the
      <em class="replaceable">
       <code>
        fractional_distance
       </code>
      </em>
      argument
          divides 1.0 with zero remainder the result may not contain the
          last point of the
      <code class="literal">
       LineString
      </code>
      argument but a
          point close to it due to numerical inaccuracies in
          approximate-value computations.
     </p>
     <p>
      A related function,
      <a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoint">
       <code class="literal">
        ST_LineInterpolatePoint()
       </code>
      </a>
      ,
          takes similar arguments but returns the
      <code class="literal">
       Point
      </code>
      along the
      <code class="literal">
       LineString
      </code>
      at the given fraction of the
          distance from its start point to its endpoint.
     </p>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoints">
       <code class="literal">
        ST_LineInterpolatePoints()
       </code>
      </a>
      handles its arguments as described in the introduction to this
          section, with these exceptions:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If the geometry argument is not a
         <code class="literal">
          LineString
         </code>
         , an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_unexpected_geometry_type" target="_top">
          <code class="literal">
           ER_UNEXPECTED_GEOMETRY_TYPE
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the fractional distance argument is outside the range
              [0.0, 1.0], an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_data_out_of_range" target="_top">
          <code class="literal">
           ER_DATA_OUT_OF_RANGE
          </code>
         </a>
         error
              occurs.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24347528"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@ls1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 0,0 5,5 5)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span>ST_LineInterpolatePoint<span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_LineInterpolatePoint(@ls1, .5)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POINT(0 5)                                   <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span>ST_LineInterpolatePoint<span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token number">75</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_LineInterpolatePoint(@ls1, .75)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POINT(2.5 5)                                  <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span>ST_LineInterpolatePoint<span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_LineInterpolatePoint(@ls1, 1)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POINT(5 5)                                  <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span>ST_LineInterpolatePoints<span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token number">25</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_LineInterpolatePoints(@ls1, .25)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> MULTIPOINT((0 2.5),(0 5),(2.5 5),(5 5))        <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoints">
       <code class="literal">
        ST_LineInterpolatePoints()
       </code>
      </a>
      is a
          MySQL extension to OpenGIS.
     </p>
    </li>
    <li class="listitem">
     <a name="function_st-pointatdistance">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-pointatdistance">
       <code class="literal">
        ST_PointAtDistance(
        <em class="replaceable">
         <code>
          ls
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          distance
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196734736">
     </a>
     <p>
      This function takes a
      <code class="literal">
       LineString
      </code>
      geometry
          and a distance in the range [0.0,
      <a class="link" href="gis-linestring-property-functions.html#function_st-length">
       <code class="literal">
        ST_Length(
        <em class="replaceable">
         <code>
          ls
         </code>
        </em>
        )
       </code>
      </a>
      ]
          measured in the unit of the spatial reference system (SRS) of
          the
      <code class="literal">
       LineString
      </code>
      , and returns the
      <code class="literal">
       Point
      </code>
      along the
      <code class="literal">
       LineString
      </code>
      at that distance from its start
          point. It can be used to answer questions such as which
      <code class="literal">
       Point
      </code>
      value is 400 meters from the start of
          the road described by the geometry argument.
     </p>
     <p>
      The function is implemented for
      <code class="literal">
       LineString
      </code>
      geometries in all spatial reference systems, both Cartesian
          and geographic.
     </p>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-pointatdistance">
       <code class="literal">
        ST_PointAtDistance()
       </code>
      </a>
      handles
          its arguments as described in the introduction to this
          section, with these exceptions:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If the geometry argument is not a
         <code class="literal">
          LineString
         </code>
         , an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_unexpected_geometry_type" target="_top">
          <code class="literal">
           ER_UNEXPECTED_GEOMETRY_TYPE
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the fractional distance argument is outside the range
              [0.0,
         <a class="link" href="gis-linestring-property-functions.html#function_st-length">
          <code class="literal">
           ST_Length(
           <em class="replaceable">
            <code>
             ls
            </code>
           </em>
           )
          </code>
         </a>
         ],
              an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_data_out_of_range" target="_top">
          <code class="literal">
           ER_DATA_OUT_OF_RANGE
          </code>
         </a>
         error occurs.
        </p>
       </li>
      </ul>
     </div>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-pointatdistance">
       <code class="literal">
        ST_PointAtDistance()
       </code>
      </a>
      is a MySQL
          extension to OpenGIS.
     </p>
    </li>
    <li class="listitem">
     <a name="function_st-symdifference">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-symdifference">
       <code class="literal">
        ST_SymDifference(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196710256">
     </a>
     <p>
      Returns a geometry that represents the point set symmetric
          difference of the geometry values
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      and
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      , which is defined as:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa14902378"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike"><em class="replaceable">g1</em> symdifference <em class="replaceable">g2</em> <span class="token punctuation">:</span><span class="token operator">=</span> <span class="token punctuation">(</span><em class="replaceable">g1</em> union <em class="replaceable">g2</em><span class="token punctuation">)</span> difference <span class="token punctuation">(</span><em class="replaceable">g1</em> intersection <em class="replaceable">g2</em><span class="token punctuation">)</span></code></pre>
     </div>
     <p>
      Or, in function call notation:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa88549781"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike"><span class="token function">ST_SymDifference</span><span class="token punctuation">(</span><em class="replaceable">g1</em><span class="token punctuation">,</span> <em class="replaceable">g2</em><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token function">ST_Difference</span><span class="token punctuation">(</span><span class="token function">ST_Union</span><span class="token punctuation">(</span><em class="replaceable">g1</em><span class="token punctuation">,</span> <em class="replaceable">g2</em><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">ST_Intersection</span><span class="token punctuation">(</span><em class="replaceable">g1</em><span class="token punctuation">,</span> <em class="replaceable">g2</em><span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
     </div>
     <p>
      The result is in the same SRS as the geometry arguments.
     </p>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-symdifference">
       <code class="literal">
        ST_SymDifference()
       </code>
      </a>
      permits
          arguments in either a Cartesian or a geographic SRS, and
          handles its arguments as described in the introduction to this
          section.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70708436"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@g1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'MULTIPOINT(5 0,15 10,15 25)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@g2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'MULTIPOINT(1 1,15 10,15 25)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_SymDifference</span><span class="token punctuation">(</span><span class="token variable">@g1</span><span class="token punctuation">,</span> <span class="token variable">@g2</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_SymDifference(@g1, @g2)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> MULTIPOINT((1 1),(5 0))               <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-transform">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-transform">
       <code class="literal">
        ST_Transform(
        <em class="replaceable">
         <code>
          g
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          target_srid
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196688256">
     </a>
     <p>
      Transforms a geometry from one spatial reference system (SRS)
          to another. The return value is a geometry of the same type as
          the input geometry with all coordinates transformed to the
          target SRID,
      <em class="replaceable">
       <code>
        target_srid
       </code>
      </em>
      . MySQL
          supports all SRSs defined by EPSG except for those listed
          here:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         EPSG 1042 Krovak Modified
        </p>
       </li>
       <li class="listitem">
        <p>
         EPSG 1043 Krovak Modified (North Orientated)
        </p>
       </li>
       <li class="listitem">
        <p>
         EPSG 9816 Tunisia Mining Grid
        </p>
       </li>
       <li class="listitem">
        <p>
         EPSG 9826 Lambert Conic Conformal (West Orientated)
        </p>
       </li>
      </ul>
     </div>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-transform">
       <code class="literal">
        ST_Transform()
       </code>
      </a>
      handles its
          arguments as described in the introduction to this section,
          with these exceptions:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Geometry arguments that have an SRID value for a
              geographic SRS do not produce an error.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the geometry or target SRID argument has an SRID value
              that refers to an undefined spatial reference system
              (SRS), an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_srs_not_found" target="_top">
          <code class="literal">
           ER_SRS_NOT_FOUND
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the geometry is in an SRS that
         <a class="link" href="spatial-operator-functions.html#function_st-transform">
          <code class="literal">
           ST_Transform()
          </code>
         </a>
         cannot
              transform from, an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_transform_source_srs_not_supported" target="_top">
          <code class="literal">
           ER_TRANSFORM_SOURCE_SRS_NOT_SUPPORTED
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the target SRID is in an SRS that
         <a class="link" href="spatial-operator-functions.html#function_st-transform">
          <code class="literal">
           ST_Transform()
          </code>
         </a>
         cannot
              transform to, an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_transform_target_srs_not_supported" target="_top">
          <code class="literal">
           ER_TRANSFORM_TARGET_SRS_NOT_SUPPORTED
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the geometry is in an SRS that is not WGS 84 and has no
              TOWGS84 clause, an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_transform_source_srs_missing_towgs84" target="_top">
          <code class="literal">
           ER_TRANSFORM_SOURCE_SRS_MISSING_TOWGS84
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the target SRID is in an SRS that is not WGS 84 and has
              no TOWGS84 clause, an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_transform_target_srs_missing_towgs84" target="_top">
          <code class="literal">
           ER_TRANSFORM_TARGET_SRS_MISSING_TOWGS84
          </code>
         </a>
         error occurs.
        </p>
       </li>
      </ul>
     </div>
     <p>
      <a class="link" href="gis-general-property-functions.html#function_st-srid">
       <code class="literal">
        ST_SRID(
        <em class="replaceable">
         <code>
          g
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          target_srid
         </code>
        </em>
        )
       </code>
      </a>
      and
      <a class="link" href="spatial-operator-functions.html#function_st-transform">
       <code class="literal">
        ST_Transform(
        <em class="replaceable">
         <code>
          g
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          target_srid
         </code>
        </em>
        )
       </code>
      </a>
      differ as
          follows:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <a class="link" href="gis-general-property-functions.html#function_st-srid">
          <code class="literal">
           ST_SRID()
          </code>
         </a>
         changes the
              geometry SRID value without transforming its coordinates.
        </p>
       </li>
       <li class="listitem">
        <p>
         <a class="link" href="spatial-operator-functions.html#function_st-transform">
          <code class="literal">
           ST_Transform()
          </code>
         </a>
         transforms
              the geometry coordinates in addition to changing its SRID
              value.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa78558441"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@p</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(52.381389 13.064444)'</span><span class="token punctuation">,</span> <span class="token number">4326</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token variable">@p</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(@p)              <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POINT(52.381389 13.064444) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@p</span> <span class="token operator">=</span> ST_Transform<span class="token punctuation">(</span><span class="token variable">@p</span><span class="token punctuation">,</span> <span class="token number">4230</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token variable">@p</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(@p)                               <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POINT(52.38208611407426 13.065520672345304) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-union">
     </a>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-union">
       <code class="literal">
        ST_Union(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196645616">
     </a>
     <p>
      Returns a geometry that represents the point set union of the
          geometry values
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      and
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      . The result is in the same SRS
          as the geometry arguments.
     </p>
     <p>
      <a class="link" href="spatial-operator-functions.html#function_st-union">
       <code class="literal">
        ST_Union()
       </code>
      </a>
      permits arguments in
          either a Cartesian or a geographic SRS, and handles its
          arguments as described in the introduction to this section.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33585503"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@g1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LineString(1 1, 3 3)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@g2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LineString(1 3, 3 1)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Union</span><span class="token punctuation">(</span><span class="token variable">@g1</span><span class="token punctuation">,</span> <span class="token variable">@g2</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Union(@g1, @g2))        <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> MULTILINESTRING((1 1,3 3),(1 3,3 1)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
