<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h2 class="title">
      <a name="spatial-types">
      </a>
      13.4 Spatial Data Types
     </h2>
    </div>
   </div>
  </div>
  <div class="toc">
   <dl class="toc">
    <dt>
     <span class="section">
      <a href="spatial-type-overview.html">
       13.4.1 Spatial Data Types
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="opengis-geometry-model.html">
       13.4.2 The OpenGIS Geometry Model
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="gis-data-formats.html">
       13.4.3 Supported Spatial Data Formats
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="geometry-well-formedness-validity.html">
       13.4.4 Geometry Well-Formedness and Validity
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="spatial-reference-systems.html">
       13.4.5 Spatial Reference System Support
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="creating-spatial-columns.html">
       13.4.6 Creating Spatial Columns
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="populating-spatial-columns.html">
       13.4.7 Populating Spatial Columns
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="fetching-spatial-data.html">
       13.4.8 Fetching Spatial Data
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="optimizing-spatial-analysis.html">
       13.4.9 Optimizing Spatial Analysis
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="creating-spatial-indexes.html">
       13.4.10 Creating Spatial Indexes
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="using-spatial-indexes.html">
       13.4.11 Using Spatial Indexes
      </a>
     </span>
    </dt>
   </dl>
  </div>
  <a class="indexterm" name="idm46045212236240">
  </a>
  <a class="indexterm" name="idm46045212235168">
  </a>
  <a class="indexterm" name="idm46045212234080">
  </a>
  <a class="indexterm" name="idm46045212232992">
  </a>
  <a class="indexterm" name="idm46045212231920">
  </a>
  <a class="indexterm" name="idm46045212230832">
  </a>
  <p>
   The
   <a class="ulink" href="http://www.opengeospatial.org" target="_blank">
    Open Geospatial
      Consortium
   </a>
   (OGC) is an international consortium of more
      than 250 companies, agencies, and universities participating in
      the development of publicly available conceptual solutions that
      can be useful with all kinds of applications that manage spatial
      data.
  </p>
  <p>
   The Open Geospatial Consortium publishes the
   <em class="citetitle">
    OpenGIS® Implementation Standard for Geographic
      information - Simple feature access - Part 2: SQL
      option
   </em>
   , a document that proposes several conceptual
      ways for extending an SQL RDBMS to support spatial data. This
      specification is available from the OGC website at
   <a class="ulink" href="http://www.opengeospatial.org/standards/sfs" target="_blank">
    http://www.opengeospatial.org/standards/sfs
   </a>
   .
  </p>
  <p>
   Following the OGC specification, MySQL implements spatial
      extensions as a subset of the
   <span class="bold">
    <strong>
     SQL with
      Geometry Types
    </strong>
   </span>
   environment. This term refers to an SQL
      environment that has been extended with a set of geometry types. A
      geometry-valued SQL column is implemented as a column that has a
      geometry type. The specification describes a set of SQL geometry
      types, as well as functions on those types to create and analyze
      geometry values.
  </p>
  <p>
   MySQL spatial extensions enable the generation, storage, and
      analysis of geographic features:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Data types for representing spatial values
     </p>
    </li>
    <li class="listitem">
     <p>
      Functions for manipulating spatial values
     </p>
    </li>
    <li class="listitem">
     <p>
      Spatial indexing for improved access times to spatial columns
     </p>
    </li>
   </ul>
  </div>
  <p>
   The spatial data types and functions are available for
   <a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
    <code class="literal">
     MyISAM
    </code>
   </a>
   ,
   <a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
    <code class="literal">
     InnoDB
    </code>
   </a>
   ,
   <a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
    <code class="literal">
     NDB
    </code>
   </a>
   , and
   <a class="link" href="archive-storage-engine.html" title="18.5 The ARCHIVE Storage Engine">
    <code class="literal">
     ARCHIVE
    </code>
   </a>
   tables. For indexing spatial
      columns,
   <code class="literal">
    MyISAM
   </code>
   and
   <code class="literal">
    InnoDB
   </code>
   support both
   <code class="literal">
    SPATIAL
   </code>
   and
      non-
   <code class="literal">
    SPATIAL
   </code>
   indexes. The other storage engines
      support non-
   <code class="literal">
    SPATIAL
   </code>
   indexes, as described in
   <a class="xref" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
    Section 15.1.15, “CREATE INDEX Statement”
   </a>
   .
  </p>
  <a class="indexterm" name="idm46045212210464">
  </a>
  <p>
   A
   <span class="bold">
    <strong>
     geographic feature
    </strong>
   </span>
   is anything
      in the world that has a location. A feature can be:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      An entity. For example, a mountain, a pond, a city.
     </p>
    </li>
    <li class="listitem">
     <p>
      A space. For example, town district, the tropics.
     </p>
    </li>
    <li class="listitem">
     <p>
      A definable location. For example, a crossroad, as a
          particular place where two streets intersect.
     </p>
    </li>
   </ul>
  </div>
  <a class="indexterm" name="idm46045212205200">
  </a>
  <p>
   Some documents use the term
   <span class="bold">
    <strong>
     geospatial
      feature
    </strong>
   </span>
   to refer to geographic features.
  </p>
  <a class="indexterm" name="idm46045212202944">
  </a>
  <p>
   <span class="bold">
    <strong>
     Geometry
    </strong>
   </span>
   is another word that
      denotes a geographic feature. Originally the word
   <span class="bold">
    <strong>
     geometry
    </strong>
   </span>
   meant measurement of the
      earth. Another meaning comes from cartography, referring to the
      geometric features that cartographers use to map the world.
  </p>
  <p>
   The discussion here considers these terms synonymous:
   <span class="bold">
    <strong>
     geographic feature
    </strong>
   </span>
   ,
   <span class="bold">
    <strong>
     geospatial feature
    </strong>
   </span>
   ,
   <span class="bold">
    <strong>
     feature
    </strong>
   </span>
   , or
   <span class="bold">
    <strong>
     geometry
    </strong>
   </span>
   . The term most commonly
      used is
   <span class="bold">
    <strong>
     geometry
    </strong>
   </span>
   , defined as
   <span class="emphasis">
    <em>
     a point or an aggregate of points representing anything
      in the world that has a location
    </em>
   </span>
   .
  </p>
  <p>
   The following material covers these topics:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      The spatial data types implemented in MySQL model
     </p>
    </li>
    <li class="listitem">
     <p>
      The basis of the spatial extensions in the OpenGIS geometry
          model
     </p>
    </li>
    <li class="listitem">
     <p>
      Data formats for representing spatial data
     </p>
    </li>
    <li class="listitem">
     <p>
      How to use spatial data in MySQL
     </p>
    </li>
    <li class="listitem">
     <p>
      Use of indexing for spatial data
     </p>
    </li>
    <li class="listitem">
     <p>
      MySQL differences from the OpenGIS specification
     </p>
    </li>
   </ul>
  </div>
  <p>
   For information about functions that operate on spatial data, see
   <a class="xref" href="spatial-analysis-functions.html" title="14.16 Spatial Analysis Functions">
    Section 14.16, “Spatial Analysis Functions”
   </a>
   .
  </p>
  <h3>
   <a name="idm46045212187904">
   </a>
   Additional Resources
  </h3>
  <p>
   These standards are important for the MySQL implementation of
      spatial operations:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      SQL/MM Part 3: Spatial.
     </p>
    </li>
    <li class="listitem">
     <p>
      The
      <a class="ulink" href="http://www.opengeospatial.org" target="_blank">
       Open Geospatial
          Consortium
      </a>
      publishes the
      <em class="citetitle">
       OpenGIS®
          Implementation Standard for Geographic
          information
      </em>
      , a document that proposes several
          conceptual ways for extending an SQL RDBMS to support spatial
          data. See in particular Simple Feature Access - Part 1: Common
          Architecture, and Simple Feature Access - Part 2: SQL Option.
          The Open Geospatial Consortium (OGC) maintains a website at
      <a class="ulink" href="http://www.opengeospatial.org/" target="_blank">
       http://www.opengeospatial.org/
      </a>
      . The
          specification is available there at
      <a class="ulink" href="http://www.opengeospatial.org/standards/sfs" target="_blank">
       http://www.opengeospatial.org/standards/sfs
      </a>
      . It
          contains additional information relevant to the material here.
     </p>
    </li>
    <li class="listitem">
     <p>
      The grammar for
      <a class="link" href="spatial-reference-systems.html" title="13.4.5 Spatial Reference System Support">
       spatial reference
          system
      </a>
      (SRS) definitions is based on the grammar
          defined in
      <em class="citetitle">
       OpenGIS Implementation Specification:
          Coordinate Transformation Services
      </em>
      , Revision 1.00,
          OGC 01-009, January 12, 2001, Section 7.2. This specification
          is available at
      <a class="ulink" href="http://www.opengeospatial.org/standards/ct" target="_blank">
       http://www.opengeospatial.org/standards/ct
      </a>
      . For
          differences from that specification in SRS definitions as
          implemented in MySQL, 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>
      .
     </p>
    </li>
   </ul>
  </div>
  <p>
   If you have questions or concerns about the use of the spatial
      extensions to MySQL, you can discuss them in the GIS forum:
   <a class="ulink" href="https://forums.mysql.com/list.php?23" target="_blank">
    https://forums.mysql.com/list.php?23
   </a>
   .
  </p>
 </div>
 <br/>
</div>
