<?xml version="1.0" encoding="UTF-8"?>
<!-- Created by Tyler Bell (Oxford ArchDigital Ltd.) -->
<!-- Changelog: 06-03-02 TB Entity URI attribute changed to optional. -->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" id="midas_spatial"
    targetNamespace="http://www.heritage-standards.org/midas/schema/1.0" version="1.0"
    xmlns:midas="http://www.heritage-standards.org/midas/schema/1.0"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:include schemaLocation="midas_common.xsd" />
    <xs:annotation>
        <xs:documentation>This is the Spatial Schema for the MIDAS standard, part of the FISH suite
            of XML schemas for the historic environment . The three primary elements are: (1) Place:
            address and attribute information; (2) Geometry: geometric (coordinate-based) data; and
            (3) Representations: where representations of that place are represented, usually on a
            map.</xs:documentation>
    </xs:annotation>
    <!-- Type definition for valid spatial geometry types, used within the 'spatial/geometry' element -->
    <xs:simpleType name="spatialtypes">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Geometry" />
            <xs:enumeration value="Geometry Collection" />
            <xs:enumeration value="Point" />
            <xs:enumeration value="MultiPoint" />
            <xs:enumeration value="Curve" />
            <xs:enumeration value="Linestring" />
            <xs:enumeration value="Line" />
            <xs:enumeration value="LinearRing" />
            <xs:enumeration value="MultiCurve" />
            <xs:enumeration value="MultiLineString" />
            <xs:enumeration value="Surface" />
            <xs:enumeration value="Polygon" />
            <xs:enumeration value="MultiSurface" />
            <xs:enumeration value="MultiPolygon" />
        </xs:restriction>
    </xs:simpleType>
    <!-- Begin element "spatial" -->
    <xs:element name="spatial">
        <xs:annotation>
            <xs:documentation>Node for recording place and space information.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <!-- Begin /spatial/place -->
                <xs:element minOccurs="0" name="place">
                    <xs:annotation>
                        <xs:documentation>Primary MIDAS spatial element used to record attribute
                            information about a spatial entity.</xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <!-- Begin /spatial/place/address -->
                            <xs:group maxOccurs="unbounded" minOccurs="0" ref="midas:address" />
                            <!-- Begin /spatial/place/namedplace -->
                            <xs:element minOccurs="0" name="namedplace">
                                <xs:annotation>
                                    <xs:documentation>Empty element for recording custom or country
                                        specific representations that are neither postal nor
                                        cadastral. This has been left intentionally broad so as to
                                        accommodate all possible UK and international variants. The
                                        element itself is empty, and is comprised of repeatable
                                        'location' nodes. Use the 'type' attribute to qualify the
                                        type of location, such as "country" or "parish", and use the
                                        'namespace' attribute to provide a context for the value,
                                        such as a specific database or gazetteer.</xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:sequence>
                                        <!-- Begin /spatial/place/namedplace/location -->
                                        <xs:element maxOccurs="unbounded" minOccurs="0"
                                            name="location">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                  <xs:extension base="xs:string">
                                                  <xs:attribute name="namespace" />
                                                  <xs:attribute name="type" use="required" />
                                                  </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <!-- Begin /spatial/place/gridref -->
                            <xs:element maxOccurs="unbounded" minOccurs="0" name="gridref">
                                <xs:annotation>
                                    <xs:documentation>Grid reference(s): string representations of
                                        place, e.g. "SU123456". The 'namespace' parameter provides
                                        context to the gridref: for example, "OSGB36" for the
                                        British grid.</xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute default="OSGB36" name="namespace" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                            <!-- Begin /spatial/place/geopolitical -->
                            <xs:element maxOccurs="unbounded" minOccurs="0" name="geopolitical">
                                <xs:annotation>
                                    <xs:documentation>Used to represent a geopolitical unit that
                                        does not fall within the 'address' element. In the UK,
                                        values would be "Scotland", "England", "Wales", and
                                        "Northern Ireland", while the 'type' attribute for these
                                        values would be "Country".</xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute name="type" use="required" />
                                            <xs:attribute name="namespace" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                            <!-- Begin /spatial/place/cadastral -->
                            <xs:element maxOccurs="unbounded" minOccurs="0" name="cadastral">
                                <xs:annotation>
                                    <xs:documentation>Used to identify place within the context of a
                                        specified cadastral namespace. In the UK, field numbers
                                        would be referenced as cadastral units. UK users are
                                        recommended to use the map title and year for the namespace
                                        when referring to field numbers taken from OS map
                                    sheets.</xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute name="namespace" use="required" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                            <!-- Begin /spatial/place/directions -->
                            <xs:element minOccurs="0" name="directions">
                                <xs:annotation>
                                    <xs:documentation>A 'free text' node included to accommodate
                                        directions to a place whose absolute position is
                                    unknown.</xs:documentation>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <!-- Begin /spatial/geometry -->
                <xs:element minOccurs="0" name="geometry">
                    <xs:annotation>
                        <xs:documentation>Used to record coordinate representations of spatial
                            entities. For SRS use EPSG (http://www.epsg.org/) identifiers. Note that
                            this element records a spatial entity using co-ordinate data, not an
                            assigned name for that place, for which see
                        'appellation'.</xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <!-- Begin /spatial/geometry/boundingBox -->
                            <xs:element maxOccurs="unbounded" minOccurs="0" name="boundingBox">
                                <xs:annotation>
                                    <xs:documentation>Records the bounding polygon; repeatable for
                                        multiple SRS (spatial reference systems). Also sometimes
                                        called the MBR (Minimum Bounding Rectangle). The EPSG code
                                        shall be employed where available. This shall take the form
                                        of "EPSG:XXX", where "XXX" is the EPSG code for the
                                        referenced coordinate system; "none" shall be provided if
                                        the coordinate system is unreferenced.</xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:attribute name="srs" use="required" />
                                    <xs:attribute name="minx" use="required" />
                                    <xs:attribute name="miny" use="required" />
                                    <xs:attribute name="maxx" use="required" />
                                    <xs:attribute name="maxy" use="required" />
                                </xs:complexType>
                            </xs:element>
                            <!-- Begin /spatial/geometry/spatialappellation -->
                            <xs:element maxOccurs="unbounded" minOccurs="0"
                                name="spatialappellation">
                                <xs:annotation>
                                    <xs:documentation>Defines a single conceptual representation of
                                        the monument. An appellation can be represented by one or
                                        more spatial entities, such as a number of lines, a point
                                        cluster, one or more polygons, etc. For example, the same
                                        site can be represented by two entities: a point and a
                                        polygon.</xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:sequence>
                                        <!-- Begin /spatial/geometry/spatialappellation/quickpoint -->
                                        <xs:element minOccurs="0" name="quickpoint">
                                            <xs:annotation>
                                                <xs:documentation>The element is designed to provide
                                                  a convenient to record the centroid of the
                                                  spatial appellation, or a coarse approximation
                                                  of its location. While use of the entity/wkt
                                                  element is encouraged, it is recognised that not
                                                  all systems will be able to easily parse wkt
                                                  notation. This element therefore acts as a
                                                  'shortcut', designed to hold a single coordinate
                                                  pair representing all spatial entities within an
                                                  appellation.</xs:documentation>
                                            </xs:annotation>
                                            <xs:complexType>
                                                <xs:sequence>
                                                  <xs:element minOccurs="0" name="srs" />
                                                  <xs:element minOccurs="0" name="x" />
                                                  <xs:element minOccurs="0" name="y" />
                                                </xs:sequence>
                                            </xs:complexType>
                                        </xs:element>
                                        <!-- Begin /spatial/geometry/spatialappellation/entity -->
                                        <xs:element maxOccurs="unbounded" minOccurs="0"
                                            name="entity">
                                            <xs:annotation>
                                                <xs:documentation>This element stores the actual
                                                  coordinate information, the precision of the
                                                  data, and the precision at which it is delivered
                                                  (if it differs from above). An appellation will
                                                  often consist of multiple entities. Entities are
                                                  repeatable and used to record various spatial
                                                  representations of a single
                                                appellation.</xs:documentation>
                                            </xs:annotation>
                                            <xs:complexType>
                                                <xs:sequence>
                                                  <!-- Begin /spatial/geometry/spatialappellation/entity/wkt -->
                                                  <xs:element minOccurs="0" name="wkt">
                                                  <xs:annotation>
                                                  <xs:documentation>Well Known Text (wkt)
                                                  representation of entity. The wkt
                                                  format is a common standard for the
                                                  textual description of simple
                                                  feature
                                                  geometries.</xs:documentation>
                                                  </xs:annotation>
                                                  <xs:complexType>
                                                  <xs:simpleContent>
                                                  <xs:extension base="xs:string">
                                                  <xs:attribute name="srs"
                                                  use="required" />
                                                  </xs:extension>
                                                  </xs:simpleContent>
                                                  </xs:complexType>
                                                  </xs:element>
                                                  <!-- Begin /spatial/geometry/entity/spatialappellation/storedprecision -->
                                                  <xs:element minOccurs="0" name="storedprecision">
                                                  <xs:annotation>
                                                  <xs:documentation>The precision at which
                                                  the spatial data is stored. This is
                                                  not to be confused with the
                                                  precision of the data capture means
                                                  or mechanism. The value shall be a
                                                  number.</xs:documentation>
                                                  </xs:annotation>
                                                  <xs:complexType>
                                                  <xs:simpleContent>
                                                  <xs:extension base="xs:string">
                                                  <xs:attribute name="units"
                                                  use="required" />
                                                  </xs:extension>
                                                  </xs:simpleContent>
                                                  </xs:complexType>
                                                  </xs:element>
                                                  <!-- Begin /spatial/geometry/entity/spatialappellation/deliveryprecision -->
                                                  <xs:element minOccurs="0"
                                                  name="deliveryprecision">
                                                  <xs:annotation>
                                                  <xs:documentation>The precision of
                                                  delivered data, if different from
                                                  stored precision. This node is
                                                  included so that the end user can be
                                                  informed of any spatial obfuscations
                                                  that have been performed on the data
                                                  before delivery.</xs:documentation>
                                                  </xs:annotation>
                                                  <xs:complexType>
                                                  <xs:simpleContent>
                                                  <xs:extension base="xs:string">
                                                  <xs:attribute name="units"
                                                  use="required" />
                                                  </xs:extension>
                                                  </xs:simpleContent>
                                                  </xs:complexType>
                                                  </xs:element>
                                                </xs:sequence>
                                                <xs:attribute name="spatialtype"
                                                  type="midas:spatialtypes" use="required">
                                                  <xs:annotation>
                                                  <xs:documentation> This value shall be one
                                                  of Geometry Object Classes specified in
                                                  the OGIS Simple Feature Specification:
                                                  Geometry; Geometry Collection; Point;
                                                  MultiPoint; Curve; Linestring, Line,
                                                  LinearRing; MultiCurve; MultiLineString;
                                                  Surface; Polygon; MultiSurface; or
                                                  MultiPolygon.</xs:documentation>
                                                  </xs:annotation>
                                                </xs:attribute>
                                                <xs:attribute name="uri" use="optional">
                                                  <xs:annotation>
                                                  <xs:documentation> The unique identifier of
                                                  the spatial entity, usually a TOID or a
                                                  record identifier from a spatial
                                                  database. This is not to be confused
                                                  with the identifier for the monument or
                                                  event being
                                                  described.</xs:documentation>
                                                  </xs:annotation>
                                                </xs:attribute>
                                                <xs:attribute name="namespace" use="required">
                                                  <xs:annotation>
                                                  <xs:documentation> The namespace in which
                                                  the uri is unique.</xs:documentation>
                                                  </xs:annotation>
                                                </xs:attribute>
                                            </xs:complexType>
                                        </xs:element>
                                        <!-- Begin /spatial/geometry/spatialappelation/height -->
                                        <xs:element minOccurs="0" name="height">
                                            <xs:annotation>
                                                <xs:documentation>Height of entity above
                                                datum.</xs:documentation>
                                            </xs:annotation>
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                  <xs:extension base="xs:string">
                                                  <xs:attribute name="datum" use="required" />
                                                  <xs:attribute name="units" use="required" />
                                                  </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                        <!-- Begin /spatial/geometry/spatialappelation/area -->
                                        <xs:element maxOccurs="unbounded" minOccurs="0" name="area">
                                            <xs:annotation>
                                                <xs:documentation>Area of spatial appellation. The
                                                  'units' attribute is
                                                required.</xs:documentation>
                                            </xs:annotation>
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                  <xs:extension base="xs:string">
                                                  <xs:attribute name="units" use="required" />
                                                  </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                        <!-- Begin /spatial/geometry/spatialappelation/capturemethod -->
                                        <xs:element minOccurs="0" name="capturemethod">
                                            <xs:annotation>
                                                <xs:documentation>Spatial data capture method: GPS,
                                                  map, etc.</xs:documentation>
                                            </xs:annotation>
                                        </xs:element>
                                        <!-- Begin /spatial/geometry/spatialappellation/source -->
                                        <xs:element minOccurs="0" name="source">
                                            <xs:annotation>
                                                <xs:documentation>The spatial data
                                                source.</xs:documentation>
                                            </xs:annotation>
                                        </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="type" type="xs:string" use="optional" />
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <!-- Begin /spatial/representations -->
                <xs:element minOccurs="0" name="representations">
                    <xs:annotation>
                        <xs:documentation>Visual representations of this place, usually a map tile
                            reference or identifier of an areial photograph.</xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element maxOccurs="unbounded" minOccurs="0" name="representation">
                                <xs:annotation>
                                    <xs:documentation>A single representation of this place, usch as
                                        a map tile, i.e. 'SU1245'</xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute name="namespace" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

