<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="spatial-convenience-functions">
      </a>
      14.16.13 Spatial Convenience Functions
     </h3>
    </div>
   </div>
  </div>
  <p>
   The functions in this section provide convenience operations on
      geometry values.
  </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>
      , 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>
      Otherwise, the return value is non-
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
   </ul>
  </div>
  <p>
   These convenience functions are available:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <a name="function_st-distance-sphere">
     </a>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-distance-sphere">
       <code class="literal">
        ST_Distance_Sphere(
        <em class="replaceable">
         <code>
          g1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          g2
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          radius
         </code>
        </em>
        ])
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045195989344">
     </a>
     <p>
      Returns the minimum spherical distance between
      <code class="literal">
       Point
      </code>
      or
      <code class="literal">
       MultiPoint
      </code>
      arguments on a sphere, in meters. (For general-purpose
          distance calculations, see the
      <a class="link" href="spatial-relation-functions-object-shapes.html#function_st-distance">
       <code class="literal">
        ST_Distance()
       </code>
      </a>
      function.) The
          optional
      <em class="replaceable">
       <code>
        radius
       </code>
      </em>
      argument should be
          given in meters.
     </p>
     <p>
      If both geometry parameters are valid Cartesian
      <code class="literal">
       Point
      </code>
      or
      <code class="literal">
       MultiPoint
      </code>
      values in SRID 0, the return value is shortest distance
          between the two geometries on a sphere with the provided
          radius. If omitted, the default radius is 6,370,986 meters,
          Point X and Y coordinates are interpreted as longitude and
          latitude, respectively, in degrees.
     </p>
     <p>
      If both geometry parameters are valid
      <code class="literal">
       Point
      </code>
      or
      <code class="literal">
       MultiPoint
      </code>
      values in a geographic
          spatial reference system (SRS), the return value is the
          shortest distance between the two geometries on a sphere with
          the provided radius. If omitted, the default radius is equal
          to the mean radius, defined as (2a+b)/3, where a is the
          semi-major axis and b is the semi-minor axis of the SRS.
     </p>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-distance-sphere">
       <code class="literal">
        ST_Distance_Sphere()
       </code>
      </a>
      handles
          its arguments as described in the introduction to this
          section, with these exceptions:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Supported geometry argument combinations are
         <code class="literal">
          Point
         </code>
         and
         <code class="literal">
          Point
         </code>
         , or
         <code class="literal">
          Point
         </code>
         and
         <code class="literal">
          MultiPoint
         </code>
         (in any argument order). If at least one of the geometries
              is neither
         <code class="literal">
          Point
         </code>
         nor
         <code class="literal">
          MultiPoint
         </code>
         , and its SRID is 0, 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>
         error occurs. If at least one of the geometries is neither
         <code class="literal">
          Point
         </code>
         nor
         <code class="literal">
          MultiPoint
         </code>
         , and its SRID refers to a
              geographic SRS, an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_implemented_for_geographic_srs" target="_top">
          <code class="literal">
           ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS
          </code>
         </a>
         error occurs. If any geometry refers to a projected SRS,
              an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_implemented_for_projected_srs" target="_top">
          <code class="literal">
           ER_NOT_IMPLEMENTED_FOR_PROJECTED_SRS
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         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: square; ">
          <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>
         If the
         <em class="replaceable">
          <code>
           radius
          </code>
         </em>
         argument is
              present but not positive, an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_nonpositive_radius" target="_top">
          <code class="literal">
           ER_NONPOSITIVE_RADIUS
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         If the distance exceeds the range of a double-precision
              number, an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_std_overflow_error" target="_top">
          <code class="literal">
           ER_STD_OVERFLOW_ERROR
          </code>
         </a>
         error occurs.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74263015"><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">@pt1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(0 0)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@pt2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(180 0)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_Distance_Sphere</span><span class="token punctuation">(</span><span class="token variable">@pt1</span><span class="token punctuation">,</span> <span class="token variable">@pt2</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_Sphere(@pt1, @pt2) <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>             20015042.813723423 <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></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-isvalid">
     </a>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-isvalid">
       <code class="literal">
        ST_IsValid(
        <em class="replaceable">
         <code>
          g
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045195946416">
     </a>
     <p>
      Returns 1 if the argument is geometrically valid, 0 if the
          argument is not geometrically valid. Geometry validity is
          defined by the OGC specification.
     </p>
     <p>
      The only valid empty geometry is represented in the form of an
          empty geometry collection value.
      <a class="link" href="spatial-convenience-functions.html#function_st-isvalid">
       <code class="literal">
        ST_IsValid()
       </code>
      </a>
      returns 1 in this
          case. MySQL does not support GIS
      <code class="literal">
       EMPTY
      </code>
      values such as
      <code class="literal">
       POINT EMPTY
      </code>
      .
     </p>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-isvalid">
       <code class="literal">
        ST_IsValid()
       </code>
      </a>
      handles its
          arguments as described in the introduction to this section,
          with this exception:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If the geometry has a geographic SRS with a longitude or
              latitude that is out of range, an error occurs:
        </p>
        <div class="itemizedlist">
         <ul class="itemizedlist" style="list-style-type: square; ">
          <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>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4390175"><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.00 0,0.0 0)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@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 0, 1 1)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_IsValid</span><span class="token punctuation">(</span><span class="token variable">@ls1</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>
<span class="token output"><span class="token punctuation">|</span> ST_IsValid(@ls1) <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>
<span class="token output"><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>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_IsValid</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>
<span class="token output"><span class="token punctuation">|</span> ST_IsValid(@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>
<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></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-makeenvelope">
     </a>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-makeenvelope">
       <code class="literal">
        ST_MakeEnvelope(
        <em class="replaceable">
         <code>
          pt1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pt2
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045195921680">
     </a>
     <p>
      Returns the rectangle that forms the envelope around two
          points, as a
      <code class="literal">
       Point
      </code>
      ,
      <code class="literal">
       LineString
      </code>
      , or
      <code class="literal">
       Polygon
      </code>
      .
     </p>
     <p>
      Calculations are done using the Cartesian coordinate system
          rather than on a sphere, spheroid, or on earth.
     </p>
     <p>
      Given two points
      <em class="replaceable">
       <code>
        pt1
       </code>
      </em>
      and
      <em class="replaceable">
       <code>
        pt2
       </code>
      </em>
      ,
      <a class="link" href="spatial-convenience-functions.html#function_st-makeenvelope">
       <code class="literal">
        ST_MakeEnvelope()
       </code>
      </a>
      creates the
          result geometry on an abstract plane like this:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If
         <em class="replaceable">
          <code>
           pt1
          </code>
         </em>
         and
         <em class="replaceable">
          <code>
           pt2
          </code>
         </em>
         are equal, the result is
              the point
         <em class="replaceable">
          <code>
           pt1
          </code>
         </em>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         Otherwise, if
         <code class="literal">
          (
          <em class="replaceable">
           <code>
            pt1
           </code>
          </em>
          ,
          <em class="replaceable">
           <code>
            pt2
           </code>
          </em>
          )
         </code>
         is a vertical or
              horizontal line segment, the result is the line segment
         <code class="literal">
          (
          <em class="replaceable">
           <code>
            pt1
           </code>
          </em>
          ,
          <em class="replaceable">
           <code>
            pt2
           </code>
          </em>
          )
         </code>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         Otherwise, the result is a polygon using
         <em class="replaceable">
          <code>
           pt1
          </code>
         </em>
         and
         <em class="replaceable">
          <code>
           pt2
          </code>
         </em>
         as diagonal points.
        </p>
       </li>
      </ul>
     </div>
     <p>
      The result geometry has an SRID of 0.
     </p>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-makeenvelope">
       <code class="literal">
        ST_MakeEnvelope()
       </code>
      </a>
      handles its
          arguments as described in the introduction to this section,
          with these exceptions:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If the arguments are not
         <code class="literal">
          Point
         </code>
         values,
              an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_arguments" target="_top">
          <code class="literal">
           ER_WRONG_ARGUMENTS
          </code>
         </a>
         error occurs.
        </p>
       </li>
       <li class="listitem">
        <p>
         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 for the additional condition that any
              coordinate value of the two points is infinite or
         <code class="literal">
          NaN
         </code>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         If any geometry has an SRID value for a geographic spatial
              reference system (SRS), an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_implemented_for_geographic_srs" target="_top">
          <code class="literal">
           ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS
          </code>
         </a>
         error occurs.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33408951"><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">@pt1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(0 0)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@pt2</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">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_MakeEnvelope</span><span class="token punctuation">(</span><span class="token variable">@pt1</span><span class="token punctuation">,</span> <span class="token variable">@pt2</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_MakeEnvelope(@pt1, @pt2)) <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> POLYGON((0 0,1 0,1 1,0 1,0 0))         <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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-simplify">
     </a>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-simplify">
       <code class="literal">
        ST_Simplify(
        <em class="replaceable">
         <code>
          g
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          max_distance
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045195886192">
     </a>
     <p>
      Simplifies a geometry using the Douglas-Peucker algorithm and
          returns a simplified value of the same type.
     </p>
     <p>
      The geometry may be any geometry type, although the
          Douglas-Peucker algorithm may not actually process every type.
          A geometry collection is processed by giving its components
          one by one to the simplification algorithm, and the returned
          geometries are put into a geometry collection as result.
     </p>
     <p>
      The
      <em class="replaceable">
       <code>
        max_distance
       </code>
      </em>
      argument is the
          distance (in units of the input coordinates) of a vertex to
          other segments to be removed. Vertices within this distance of
          the simplified linestring are removed.
     </p>
     <p>
      According to Boost.Geometry, geometries might become invalid
          as a result of the simplification process, and the process
          might create self-intersections. To check the validity of the
          result, pass it to
      <a class="link" href="spatial-convenience-functions.html#function_st-isvalid">
       <code class="literal">
        ST_IsValid()
       </code>
      </a>
      .
     </p>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-simplify">
       <code class="literal">
        ST_Simplify()
       </code>
      </a>
      handles its
          arguments as described in the introduction to this section,
          with this exception:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If the
         <em class="replaceable">
          <code>
           max_distance
          </code>
         </em>
         argument is
              not positive, or is
         <code class="literal">
          NaN
         </code>
         , an
         <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_arguments" target="_top">
          <code class="literal">
           ER_WRONG_ARGUMENTS
          </code>
         </a>
         error
              occurs.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84233553"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@g</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 0,0 1,1 1,1 2,2 2,2 3,3 3)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Simplify</span><span class="token punctuation">(</span><span class="token variable">@g</span><span class="token punctuation">,</span> <span class="token number">0.5</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Simplify(@g, 0.5)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> LINESTRING(0 0,0 1,1 1,2 3,3 3) <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>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Simplify</span><span class="token punctuation">(</span><span class="token variable">@g</span><span class="token punctuation">,</span> <span class="token number">1.0</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Simplify(@g, 1.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>
<span class="token output"><span class="token punctuation">|</span> LINESTRING(0 0,3 3)             <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></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_st-validate">
     </a>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-validate">
       <code class="literal">
        ST_Validate(
        <em class="replaceable">
         <code>
          g
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045195865536">
     </a>
     <p>
      Validates a geometry according to the OGC specification. A
          geometry can be syntactically well-formed (WKB value plus
          SRID) but geometrically invalid. For example, this polygon is
          geometrically invalid:
      <code class="literal">
       POLYGON((0 0, 0 0, 0 0, 0 0, 0
          0))
      </code>
     </p>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-validate">
       <code class="literal">
        ST_Validate()
       </code>
      </a>
      returns the
          geometry if it is syntactically well-formed and is
          geometrically valid,
      <code class="literal">
       NULL
      </code>
      if the argument
          is not syntactically well-formed or is not geometrically valid
          or is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-validate">
       <code class="literal">
        ST_Validate()
       </code>
      </a>
      can be used to
          filter out invalid geometry data, although at a cost. For
          applications that require more precise results not tainted by
          invalid data, this penalty may be worthwhile.
     </p>
     <p>
      If the geometry argument is valid, it is returned as is,
          except that if an input
      <code class="literal">
       Polygon
      </code>
      or
      <code class="literal">
       MultiPolygon
      </code>
      has clockwise rings, those
          rings are reversed before checking for validity. If the
          geometry is valid, the value with the reversed rings is
          returned.
     </p>
     <p>
      The only valid empty geometry is represented in the form of an
          empty geometry collection value.
      <a class="link" href="spatial-convenience-functions.html#function_st-validate">
       <code class="literal">
        ST_Validate()
       </code>
      </a>
      returns it
          directly without further checks in this case.
     </p>
     <p>
      <a class="link" href="spatial-convenience-functions.html#function_st-validate">
       <code class="literal">
        ST_Validate()
       </code>
      </a>
      handles its
          arguments as described in the introduction to this section,
          with the exceptions listed here:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If the geometry has a geographic SRS with a longitude or
              latitude that is out of range, an error occurs:
        </p>
        <div class="itemizedlist">
         <ul class="itemizedlist" style="list-style-type: square; ">
          <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. The exact range limits
              deviate slightly due to floating-point arithmetic.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46860898"><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)'</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 0, 1 1)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Validate</span><span class="token punctuation">(</span><span class="token variable">@ls1</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Validate(@ls1)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL                         <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Validate</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 punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Validate(@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>
<span class="token output"><span class="token punctuation">|</span> LINESTRING(0 0,1 1)          <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
