Web Cartography 10
GML
- XML based language
- designed for spatial data
- human readable
XML primer
<?xml version="1.0" encoding="utf-8"?>
<classroom id="Z1"> <!-- main element -->
<equipment> <!-- subelement - complex type -->
<desks>
<desk color="brown" width="90" length="90" height="90"> <!-- attributes -->
</desk>
</desks>
<chairs>
<chair color="blue" hasWheels="true">
</chair>
</chairs>
<computers>
<computer>
<os>Windows 7</os><!-- subelement simple types -->
<hdd>
<size>500</size>
<type>ssd</type>
</hdd>
</computer>
</computers>
</equipment>
</classroom>
XML primer
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Classroom schema for web cartography.
@author Michal Zimmermann
</xsd:documentation>
</xsd:annotation>
<xsd:element name="classroom" type="ClassroomType"/>
<xsd:element name="equipment" type="EquipmentType"/>
<xsd:element name="desks" type="DesksType"/>
<xsd:element name="chairs" type="ChairsType"/>
<xsd:element name="computers" type="ComputersType"/>
<xsd:complexType name="ClassroomType">
<xsd:sequence>
<xsd:element name="equipment" type="EquipmentType"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="EquipmentType">
<xsd:sequence>
<xsd:element name="desks" minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="chairs" minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="computers" minOccurs="1" maxOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DesksType">
<xsd:sequence>
<xsd:element name="desk" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="color" type="xsd:string"/>
<xsd:attribute name="width" type="xsd:integer"/>
<xsd:attribute name="length" type="xsd:integer"/>
<xsd:attribute name="height" type="xsd:integer"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ChairsType">
<xsd:sequence>
<xsd:element name="chair" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="color" type="xsd:string"/>
<xsd:attribute name="hasWheels" type="xsd:boolean"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ComputersType">
<xsd:sequence>
<xsd:element name="computer" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="os" minOccurs="1" maxOccurs="1" type="xsd:string"/>
<xsd:element name="hdd" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="size" minOccurs="1" maxOccurs="1" type="xsd:positiveInteger"/>
<xsd:element name="type" minOccurs="1" maxOccurs="1" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
XML primer
<?xml version="1.0" encoding="utf-8"?>
<cr:classroom id="Z1" xmlns:cr="http://www.example.com/CR"> <!-- main element -->
<equipment> <!-- subelement - complex type -->
<desks>
<desk color="brown" width="90" length="90" height="90"> <!-- attributes -->
</desk>
</desks>
<chairs>
<chair color="blue" hasWheels="true">
</chair>
</chairs>
<computers>
<computer>
<os>Windows 7</os><!-- subelement simple types -->
<hdd>
<size>500</size>
<type>ssd</type>
</hdd>
</computer>
</computers>
</equipment>
</cr:classroom>
XML primer
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cr="http://www.example.com/CR"
targetNamespace="http://www.example.com/CR"
>
<annotation>
<documentation xml:lang="en">
Classroom schema for web cartography.
@author Michal Zimmermann
</documentation>
</annotation>
<element name="classroom" type="cr:ClassroomType"/>
<element name="equipment" type="cr:EquipmentType"/>
<element name="desks" type="cr:DesksType"/>
<element name="chairs" type="cr:ChairsType"/>
<element name="computers" type="cr:ComputersType"/>
<complexType name="ClassroomType">
<sequence>
<element name="equipment" type="cr:EquipmentType"/>
</sequence>
<attribute name="id" type="string"/>
</complexType>
<complexType name="EquipmentType">
<sequence>
<element name="desks" minOccurs="1" maxOccurs="1">
</element>
<element name="chairs" minOccurs="1" maxOccurs="1">
</element>
<element name="computers" minOccurs="1" maxOccurs="1">
</element>
</sequence>
</complexType>
<complexType name="DesksType">
<sequence>
<element name="desk" minOccurs="0" maxOccurs="unbounded">
<complexType>
<attribute name="color" type="string"/>
<attribute name="width" type="integer"/>
<attribute name="length" type="integer"/>
<attribute name="height" type="integer"/>
</complexType>
</element>
</sequence>
</complexType>
<complexType name="ChairsType">
<sequence>
<element name="chair" minOccurs="0" maxOccurs="unbounded">
<complexType>
<attribute name="color" type="string"/>
<attribute name="hasWheels" type="boolean"/>
</complexType>
</element>
</sequence>
</complexType>
<complexType name="ComputersType">
<sequence>
<element name="computer" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="os" minOccurs="1" maxOccurs="1" type="string"/>
<element name="hdd" minOccurs="1" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="size" minOccurs="1" maxOccurs="1" type="positiveInteger"/>
<element name="type" minOccurs="1" maxOccurs="1" type="string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</schema>
GML primer
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-25.00405092592593</gml:X><gml:Y>10.90234375</gml:Y></gml:coord>
<gml:coord><gml:X>-25.00405092592593</gml:X><gml:Y>10.90234375</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:test fid="test.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-25.004050925925931,10.90234375</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>1</ogr:id>
</ogr:test>
</gml:featureMember>
<gml:featureMember>
<ogr:test fid="test.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-26.004050925925931,10.90234375</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>1</ogr:id>
</ogr:test>
</gml:featureMember>
<gml:featureMember>
<ogr:test fid="test.2">
<ogr:geometryProperty>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>0,0 100,0 100,100 0,100 0,0</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogr:geometryProperty>
<ogr:id>1</ogr:id>
</ogr:test>
</gml:featureMember>
</ogr:FeatureCollection>
Web Cartography 10: GML
By Michal Zimmermann
Web Cartography 10: GML
- 1,430