<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="spatial-reference-systems">
      </a>
      13.4.5 Spatial Reference System Support
     </h3>
    </div>
   </div>
  </div>
  <p>
   A spatial reference system (SRS) for spatial data is a
        coordinate-based system for geographic locations.
  </p>
  <p>
   There are different types of spatial reference systems:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      A projected SRS is a projection of a globe onto a flat
            surface; that is, a flat map. For example, a light bulb
            inside a globe that shines on a paper cylinder surrounding
            the globe projects a map onto the paper. The result is
            georeferenced: Each point maps to a place on the globe. The
            coordinate system on that plane is Cartesian using a length
            unit (meters, feet, and so forth), rather than degrees of
            longitude and latitude.
     </p>
     <p>
      The globes in this case are ellipsoids; that is, flattened
            spheres. Earth is a bit shorter in its North-South axis than
            its East-West axis, so a slightly flattened sphere is more
            correct, but perfect spheres permit faster calculations.
     </p>
    </li>
    <li class="listitem">
     <p>
      A geographic SRS is a nonprojected SRS representing
            longitude-latitude (or latitude-longitude) coordinates on an
            ellipsoid, in any angular unit.
     </p>
    </li>
    <li class="listitem">
     <p>
      The SRS denoted in MySQL by SRID 0 represents an infinite
            flat Cartesian plane with no units assigned to its axes.
            Unlike projected SRSs, it is not georeferenced and it does
            not necessarily represent Earth. It is an abstract plane
            that can be used for anything. SRID 0 is the default SRID
            for spatial data in MySQL.
     </p>
    </li>
   </ul>
  </div>
  <p>
   MySQL maintains information about available spatial reference
        systems for spatial data in the data dictionary
   <code class="literal">
    mysql.st_spatial_reference_systems
   </code>
   table,
        which can store entries for projected and geographic SRSs. This
        data dictionary table is invisible, but SRS entry contents are
        available through the
   <code class="literal">
    INFORMATION_SCHEMA
   </code>
   <a class="link" href="information-schema-st-spatial-reference-systems-table.html" title="28.3.36 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table">
    <code class="literal">
     ST_SPATIAL_REFERENCE_SYSTEMS
    </code>
   </a>
   table,
        implemented as a view on
   <code class="literal">
    mysql.st_spatial_reference_systems
   </code>
   (see
   <a class="xref" href="information-schema-st-spatial-reference-systems-table.html" title="28.3.36 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table">
    Section 28.3.36, “The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table”
   </a>
   ).
  </p>
  <p>
   The following example shows what an SRS entry looks like:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa37136740"><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">SELECT</span> <span class="token operator">*</span>
       <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>ST_SPATIAL_REFERENCE_SYSTEMS
       <span class="token keyword">WHERE</span> SRS_ID <span class="token operator">=</span> <span class="token number">4326</span>\G
<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> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
                SRS_NAME<span class="token punctuation">:</span> WGS 84
                  SRS_ID<span class="token punctuation">:</span> 4326
            ORGANIZATION<span class="token punctuation">:</span> EPSG
ORGANIZATION_COORDSYS_ID<span class="token punctuation">:</span> 4326
              DEFINITION<span class="token punctuation">:</span> GEOGCS["WGS 84",DATUM["World Geodetic System 1984",
                          SPHEROID["WGS 84",6378137,298.257223563,
                          AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],
                          PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
                          UNIT["degree",0.017453292519943278,
                          AUTHORITY["EPSG","9122"]],
                          AXIS["Lat",NORTH],AXIS["Long",EAST],
                          AUTHORITY["EPSG","4326"]]
             DESCRIPTION<span class="token punctuation">:</span></span></code></pre>
  </div>
  <p>
   This entry describes the SRS used for GPS systems. It has the
        name (
   <code class="literal">
    SRS_NAME
   </code>
   ) WGS 84 and the ID
        (
   <code class="literal">
    SRS_ID
   </code>
   ) 4326, which is the ID used by the
   <a class="ulink" href="http://epsg.org" target="_blank">
    European Petroleum Survey
        Group
   </a>
   (EPSG).
  </p>
  <p>
   SRS definitions in the
   <code class="literal">
    DEFINITION
   </code>
   column are
        WKT values, represented as specified in the
   <a class="ulink" href="http://www.opengeospatial.org" target="_blank">
    Open Geospatial
        Consortium
   </a>
   document
   <a class="ulink" href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html" target="_blank">
    OGC
        12-063r5
   </a>
   .
  </p>
  <p>
   <code class="literal">
    SRS_ID
   </code>
   values represent the same kind of
        values as the SRID of geometry values or passed as the SRID
        argument to spatial functions. SRID 0 (the unitless Cartesian
        plane) is special. It is always a legal spatial reference system
        ID and can be used in any computations on spatial data that
        depend on SRID values.
  </p>
  <p>
   For computations on multiple geometry values, all values must
        have the same SRID or an error occurs.
  </p>
  <p>
   SRS definition parsing occurs on demand when definitions are
        needed by GIS functions. Parsed definitions are stored in the
        data dictionary cache to enable reuse and avoid incurring
        parsing overhead for every statement that needs SRS information.
  </p>
  <p>
   To enable manipulation of SRS entries stored in the data
        dictionary, MySQL provides these SQL statements:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="create-spatial-reference-system.html" title="15.1.19 CREATE SPATIAL REFERENCE SYSTEM Statement">
       <code class="literal">
        CREATE SPATIAL REFERENCE
            SYSTEM
       </code>
      </a>
      : See
      <a class="xref" href="create-spatial-reference-system.html" title="15.1.19 CREATE SPATIAL REFERENCE SYSTEM Statement">
       Section 15.1.19, “CREATE SPATIAL REFERENCE SYSTEM Statement”
      </a>
      . The
            description for this statement includes additional
            information about SRS components.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="drop-spatial-reference-system.html" title="15.1.31 DROP SPATIAL REFERENCE SYSTEM Statement">
       <code class="literal">
        DROP SPATIAL REFERENCE
            SYSTEM
       </code>
      </a>
      : See
      <a class="xref" href="drop-spatial-reference-system.html" title="15.1.31 DROP SPATIAL REFERENCE SYSTEM Statement">
       Section 15.1.31, “DROP SPATIAL REFERENCE SYSTEM Statement”
      </a>
      .
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
