<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="spatial-relation-functions-object-shapes">
      </a>
      14.16.9.1 Spatial Relation Functions That Use Object Shapes
     </h4>
    </div>
   </div>
  </div>
  <p>
   The OpenGIS specification defines the following functions to
        test the relationship between two geometry values
   <em class="replaceable">
    <code>
     g1
    </code>
   </em>
   and
   <em class="replaceable">
    <code>
     g2
    </code>
   </em>
   ,
        using precise object shapes. The return values 1 and 0 indicate
        true and false, respectively, except that distance functions
        return distance values.
  </p>
  <p>
   Functions in this section detect arguments in either Cartesian
        or geographic spatial reference systems (SRSs), and return
        results appropriate to the SRS.
  </p>
  <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>
      or any geometry
            argument is an empty geometry, 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 is geometrically invalid, either
            the result is true or false (it is undefined which), or an
            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>
   Some functions in this section permit a unit argument that
        specifies the length unit for the return value. Unless otherwise
        specified, functions handle their unit argument as follows:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      A unit is supported if it is found in the
      <code class="literal">
       INFORMATION_SCHEMA
      </code>
      <a class="link" href="information-schema-st-units-of-measure-table.html" title="28.3.37 The INFORMATION_SCHEMA ST_UNITS_OF_MEASURE Table">
       <code class="literal">
        ST_UNITS_OF_MEASURE
       </code>
      </a>
      table. See
      <a class="xref" href="information-schema-st-units-of-measure-table.html" title="28.3.37 The INFORMATION_SCHEMA ST_UNITS_OF_MEASURE Table">
       Section 28.3.37, “The INFORMATION_SCHEMA ST_UNITS_OF_MEASURE Table”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      If a unit is specified but not supported by MySQL, an
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_unit_not_found" target="_top">
       <code class="literal">
        ER_UNIT_NOT_FOUND
       </code>
      </a>
      error
            occurs.
     </p>
    </li>
    <li class="listitem">
     <p>
      If a supported linear unit is specified and the SRID is 0,
            an
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_geometry_in_unknown_length_unit" target="_top">
       <code class="literal">
        ER_GEOMETRY_IN_UNKNOWN_LENGTH_UNIT
       </code>
      </a>
      error occurs.
     </p>
    </li>
    <li class="listitem">
     <p>
      If a supported linear unit is specified and the SRID is not
            0, the result is in that unit.
     </p>
    </li>
    <li class="listitem">
     <p>
      If a unit is not specified, the result is in the unit of the
            SRS of the geometries, whether Cartesian or geographic.
            Currently, all MySQL SRSs are expressed in meters.
     </p>
    </li>
   </ul>
  </div>
  <p>
   These object-shape functions are available for testing geometry
        relationships:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <a name="function_st-contains">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-contains">
       <code class="literal">
        ST_Contains(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196594192">
     </a>
     <p>
      Returns 1 or 0 to indicate whether
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      completely contains
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      . This tests the opposite
            relationship as
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-within">
       <code class="literal">
        ST_Within()
       </code>
      </a>
      .
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-contains">
       <code class="literal">
        ST_Contains()
       </code>
      </a>
      handles its
            arguments as described in the introduction to this section.
     </p>
    </li>
    <li class="listitem">
     <a name="function_st-crosses">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-crosses">
       <code class="literal">
        ST_Crosses(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196583088">
     </a>
     <p>
      Two geometries
      <span class="emphasis">
       <em>
        spatially cross
       </em>
      </span>
      if their
            spatial relation has the following properties:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Unless
         <em class="replaceable">
          <code>
           g1
          </code>
         </em>
         and
         <em class="replaceable">
          <code>
           g2
          </code>
         </em>
         are both of dimension 1:
         <em class="replaceable">
          <code>
           g1
          </code>
         </em>
         crosses
         <em class="replaceable">
          <code>
           g2
          </code>
         </em>
         if the interior of
         <em class="replaceable">
          <code>
           g2
          </code>
         </em>
         has points in common with
                the interior of
         <em class="replaceable">
          <code>
           g1
          </code>
         </em>
         , but
         <em class="replaceable">
          <code>
           g2
          </code>
         </em>
         does not cover the entire
                interior of
         <em class="replaceable">
          <code>
           g1
          </code>
         </em>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         If both
         <em class="replaceable">
          <code>
           g1
          </code>
         </em>
         and
         <em class="replaceable">
          <code>
           g2
          </code>
         </em>
         are of dimension 1: If the
                lines cross each other in a finite number of points
                (that is, no common line segments, only single points in
                common).
        </p>
       </li>
      </ul>
     </div>
     <p>
      This function returns 1 or 0 to indicate whether
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      spatially crosses
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      .
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-crosses">
       <code class="literal">
        ST_Crosses()
       </code>
      </a>
      handles its
            arguments as described in the introduction to this section
            except that the return value is
      <code class="literal">
       NULL
      </code>
      for
            these additional conditions:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <em class="replaceable">
          <code>
           g1
          </code>
         </em>
         is of dimension 2
                (
         <code class="literal">
          Polygon
         </code>
         or
         <code class="literal">
          MultiPolygon
         </code>
         ).
        </p>
       </li>
       <li class="listitem">
        <p>
         <em class="replaceable">
          <code>
           g2
          </code>
         </em>
         is of dimension 1
                (
         <code class="literal">
          Point
         </code>
         or
         <code class="literal">
          MultiPoint
         </code>
         ).
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-disjoint">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-disjoint">
       <code class="literal">
        ST_Disjoint(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196559312">
     </a>
     <p>
      Returns 1 or 0 to indicate whether
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      is spatially disjoint from
            (does not intersect)
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      .
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-disjoint">
       <code class="literal">
        ST_Disjoint()
       </code>
      </a>
      handles its
            arguments as described in the introduction to this section.
     </p>
    </li>
    <li class="listitem">
     <a name="function_st-distance">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-distance">
       <code class="literal">
        ST_Distance(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          unit
         </code>
        </em>
        ])
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196549056">
     </a>
     <p>
      Returns the distance between
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      and
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      , measured in the length
            unit of the spatial reference system (SRS) of the geometry
            arguments, or in the unit of the optional
      <em class="replaceable">
       <code>
        unit
       </code>
      </em>
      argument if that is
            specified.
     </p>
     <p>
      This function processes geometry collections by returning
            the shortest distance among all combinations of the
            components of the two geometry arguments.
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-distance">
       <code class="literal">
        ST_Distance()
       </code>
      </a>
      handles its
            geometry 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>
         <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-distance">
          <code class="literal">
           ST_Distance()
          </code>
         </a>
         detects
                arguments in a geographic (ellipsoidal) spatial
                reference system and returns the geodetic distance on
                the ellipsoid.
         <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-distance">
          <code class="literal">
           ST_Distance()
          </code>
         </a>
         supports
                distance calculations for geographic SRS arguments of
                all geometry types.
        </p>
       </li>
       <li class="listitem">
        <p>
         If any argument is geometrically invalid, either the
                result is an undefined distance (that is, it can be any
                number), or an error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If an intermediate or final result produces
         <code class="literal">
          NaN
         </code>
         or a negative number, 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>
      </ul>
     </div>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-distance">
       <code class="literal">
        ST_Distance()
       </code>
      </a>
      permits
            specifying the linear unit for the returned distance value
            with an optional
      <em class="replaceable">
       <code>
        unit
       </code>
      </em>
      argument
            which
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-distance">
       <code class="literal">
        ST_Distance()
       </code>
      </a>
      handles
            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="sa58944072"><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">'POINT(1 1)'</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">'POINT(2 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_Distance</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 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>
<span class="token output"><span class="token punctuation">|</span> ST_Distance(@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>
<span class="token output"><span class="token punctuation">|</span>    1.4142135623730951 <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>

<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">'POINT(1 1)'</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">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">'POINT(2 2)'</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_Distance</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 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>
<span class="token output"><span class="token punctuation">|</span> ST_Distance(@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>
<span class="token output"><span class="token punctuation">|</span>     156874.3859490455 <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>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_Distance</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 string">'metre'</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>
<span class="token output"><span class="token punctuation">|</span> ST_Distance(@g1, @g2, 'metre') <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>
<span class="token output"><span class="token punctuation">|</span>              156874.3859490455 <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>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_Distance</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 string">'foot'</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>
<span class="token output"><span class="token punctuation">|</span> ST_Distance(@g1, @g2, 'foot') <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>
<span class="token output"><span class="token punctuation">|</span>             514679.7439273146 <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></code></pre>
     </div>
     <p>
      For the special case of distance calculations on a sphere,
            see the
      <a class="link" href="spatial-convenience-functions.html#function_st-distance-sphere">
       <code class="literal">
        ST_Distance_Sphere()
       </code>
      </a>
      function.
     </p>
    </li>
    <li class="listitem">
     <a name="function_st-equals">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-equals">
       <code class="literal">
        ST_Equals(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196516064">
     </a>
     <p>
      Returns 1 or 0 to indicate whether
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      is spatially equal to
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      .
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-equals">
       <code class="literal">
        ST_Equals()
       </code>
      </a>
      handles its
            arguments as described in the introduction to this section,
            except that it does not return
      <code class="literal">
       NULL
      </code>
      for
            empty geometry arguments.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14875369"><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_Equals</span><span class="token punctuation">(</span><span class="token variable">@g1</span><span class="token punctuation">,</span> <span class="token variable">@g1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">ST_Equals</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 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>
<span class="token output"><span class="token punctuation">|</span> ST_Equals(@g1, @g1) <span class="token punctuation">|</span> ST_Equals(@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 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>                   1 <span class="token punctuation">|</span>                   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></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-frechetdistance">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-frechetdistance">
       <code class="literal">
        ST_FrechetDistance(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          unit
         </code>
        </em>
        ])
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196501184">
     </a>
     <p>
      Returns the discrete Fréchet distance between two
            geometries, reflecting how similar the geometries are. The
            result is a double-precision number measured in the length
            unit of the spatial reference system (SRS) of the geometry
            arguments, or in the length unit of the
      <em class="replaceable">
       <code>
        unit
       </code>
      </em>
      argument if that argument is
            given.
     </p>
     <p>
      This function implements the discrete Fréchet distance,
            which means it is restricted to distances between the points
            of the geometries. For example, given two
      <code class="literal">
       LineString
      </code>
      arguments, only the points
            explicitly mentioned in the geometries are considered.
            Points on the line segments between these points are not
            considered.
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-frechetdistance">
       <code class="literal">
        ST_FrechetDistance()
       </code>
      </a>
      handles
            its geometry 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>
         The geometries may have a Cartesian or geographic SRS,
                but only
         <code class="literal">
          LineString
         </code>
         values are
                supported. If the arguments are in the same Cartesian or
                geographic SRS, but either 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_not_implemented_for_cartesian_srs" target="_top">
          <code class="literal">
           ER_NOT_IMPLEMENTED_FOR_CARTESIAN_SRS
          </code>
         </a>
         or
         <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, depending on the SRS type.
        </p>
       </li>
      </ul>
     </div>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-frechetdistance">
       <code class="literal">
        ST_FrechetDistance()
       </code>
      </a>
      handles
            its optional
      <em class="replaceable">
       <code>
        unit
       </code>
      </em>
      argument 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="sa92131178"><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">SET</span> <span class="token variable">@ls2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 1,0 6,3 3,5 6)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> ST_FrechetDistance<span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">,</span> <span class="token variable">@ls2</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>
<span class="token output"><span class="token punctuation">|</span> ST_FrechetDistance(@ls1, @ls2) <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>
<span class="token output"><span class="token punctuation">|</span>             2.8284271247461903 <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>

<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 number">4326</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">@ls2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 1,0 6,3 3,5 6)'</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> ST_FrechetDistance<span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">,</span> <span class="token variable">@ls2</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>
<span class="token output"><span class="token punctuation">|</span> ST_FrechetDistance(@ls1, @ls2) <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>
<span class="token output"><span class="token punctuation">|</span>              313421.1999416798 <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>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> ST_FrechetDistance<span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">,</span> <span class="token variable">@ls2</span><span class="token punctuation">,</span> <span class="token string">'foot'</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>
<span class="token output"><span class="token punctuation">|</span> ST_FrechetDistance(@ls1, @ls2, 'foot') <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>
<span class="token output"><span class="token punctuation">|</span>                     1028284.7767115477 <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></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-hausdorffdistance">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-hausdorffdistance">
       <code class="literal">
        ST_HausdorffDistance(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          unit
         </code>
        </em>
        ])
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196473024">
     </a>
     <p>
      Returns the discrete Hausdorff distance between two
            geometries, reflecting how similar the geometries are. The
            result is a double-precision number measured in the length
            unit of the spatial reference system (SRS) of the geometry
            arguments, or in the length unit of the
      <em class="replaceable">
       <code>
        unit
       </code>
      </em>
      argument if that argument is
            given.
     </p>
     <p>
      This function implements the discrete Hausdorff distance,
            which means it is restricted to distances between the points
            of the geometries. For example, given two
      <code class="literal">
       LineString
      </code>
      arguments, only the points
            explicitly mentioned in the geometries are considered.
            Points on the line segments between these points are not
            considered.
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-hausdorffdistance">
       <code class="literal">
        ST_HausdorffDistance()
       </code>
      </a>
      handles its geometry 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 arguments are in the same Cartesian or
                geographic SRS, but are not in a supported combination,
                an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_implemented_for_cartesian_srs" target="_top">
          <code class="literal">
           ER_NOT_IMPLEMENTED_FOR_CARTESIAN_SRS
          </code>
         </a>
         or
         <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, depending on the SRS type. These
                combinations are supported:
        </p>
        <div class="itemizedlist">
         <ul class="itemizedlist" style="list-style-type: square; ">
          <li class="listitem">
           <p>
            <code class="literal">
             LineString
            </code>
            and
            <code class="literal">
             LineString
            </code>
           </p>
          </li>
          <li class="listitem">
           <p>
            <code class="literal">
             Point
            </code>
            and
            <code class="literal">
             MultiPoint
            </code>
           </p>
          </li>
          <li class="listitem">
           <p>
            <code class="literal">
             LineString
            </code>
            and
            <code class="literal">
             MultiLineString
            </code>
           </p>
          </li>
          <li class="listitem">
           <p>
            <code class="literal">
             MultiPoint
            </code>
            and
            <code class="literal">
             MultiPoint
            </code>
           </p>
          </li>
          <li class="listitem">
           <p>
            <code class="literal">
             MultiLineString
            </code>
            and
            <code class="literal">
             MultiLineString
            </code>
           </p>
          </li>
         </ul>
        </div>
       </li>
      </ul>
     </div>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-hausdorffdistance">
       <code class="literal">
        ST_HausdorffDistance()
       </code>
      </a>
      handles its optional
      <em class="replaceable">
       <code>
        unit
       </code>
      </em>
      argument 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="sa26894135"><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">SET</span> <span class="token variable">@ls2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 1,0 6,3 3,5 6)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> ST_HausdorffDistance<span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">,</span> <span class="token variable">@ls2</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>
<span class="token output"><span class="token punctuation">|</span> ST_HausdorffDistance(@ls1, @ls2) <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>
<span class="token output"><span class="token punctuation">|</span>                                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>

<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 number">4326</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">@ls2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 1,0 6,3 3,5 6)'</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> ST_HausdorffDistance<span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">,</span> <span class="token variable">@ls2</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>
<span class="token output"><span class="token punctuation">|</span> ST_HausdorffDistance(@ls1, @ls2) <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>
<span class="token output"><span class="token punctuation">|</span>               111319.49079326246 <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>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> ST_HausdorffDistance<span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">,</span> <span class="token variable">@ls2</span><span class="token punctuation">,</span> <span class="token string">'foot'</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>
<span class="token output"><span class="token punctuation">|</span> ST_HausdorffDistance(@ls1, @ls2, 'foot') <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>
<span class="token output"><span class="token punctuation">|</span>                        365221.4264870815 <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></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-intersects">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-intersects">
       <code class="literal">
        ST_Intersects(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196436032">
     </a>
     <p>
      Returns 1 or 0 to indicate whether
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      spatially intersects
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      .
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-intersects">
       <code class="literal">
        ST_Intersects()
       </code>
      </a>
      handles its
            arguments as described in the introduction to this section.
     </p>
    </li>
    <li class="listitem">
     <a name="function_st-overlaps">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-overlaps">
       <code class="literal">
        ST_Overlaps(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196426192">
     </a>
     <p>
      Two geometries
      <span class="emphasis">
       <em>
        spatially overlap
       </em>
      </span>
      if
            they intersect and their intersection results in a geometry
            of the same dimension but not equal to either of the given
            geometries.
     </p>
     <p>
      This function returns 1 or 0 to indicate whether
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      spatially overlaps
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      .
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-overlaps">
       <code class="literal">
        ST_Overlaps()
       </code>
      </a>
      handles its
            arguments as described in the introduction to this section
            except that the return value is
      <code class="literal">
       NULL
      </code>
      for
            the additional condition that the dimensions of the two
            geometries are not equal.
     </p>
    </li>
    <li class="listitem">
     <a name="function_st-touches">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-touches">
       <code class="literal">
        ST_Touches(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196414432">
     </a>
     <p>
      Two geometries
      <span class="emphasis">
       <em>
        spatially touch
       </em>
      </span>
      if their
            interiors do not intersect, but the boundary of one of the
            geometries intersects either the boundary or the interior of
            the other.
     </p>
     <p>
      This function returns 1 or 0 to indicate whether
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      spatially touches
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      .
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-touches">
       <code class="literal">
        ST_Touches()
       </code>
      </a>
      handles its
            arguments as described in the introduction to this section
            except that the return value is
      <code class="literal">
       NULL
      </code>
      for
            the additional condition that both geometries are of
            dimension 0 (
      <code class="literal">
       Point
      </code>
      or
      <code class="literal">
       MultiPoint
      </code>
      ).
     </p>
    </li>
    <li class="listitem">
     <a name="function_st-within">
     </a>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-within">
       <code class="literal">
        ST_Within(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045196401248">
     </a>
     <p>
      Returns 1 or 0 to indicate whether
      <em class="replaceable">
       <code>
        g1
       </code>
      </em>
      is spatially within
      <em class="replaceable">
       <code>
        g2
       </code>
      </em>
      . This tests the opposite
            relationship as
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-contains">
       <code class="literal">
        ST_Contains()
       </code>
      </a>
      .
     </p>
     <p>
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-within">
       <code class="literal">
        ST_Within()
       </code>
      </a>
      handles its
            arguments as described in the introduction to this section.
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
