6.1 Standards 6.2 XML
6.3 GML 6.4 XSLT
6 Spatial Data and XML
6.4 XSLT 6.5 SVG
6.6 Summary
• Collection of spatial data is particularly expensive
• Spatial data is durable, must be updated nevertheless
• Geoservices are increasingly offered by the internet
• Spatial data should be capable of being
6 Spatial Data and XML
• Spatial data should be capable of being integrated and easily interchangeable
• Unified visualization of spatial data is desirable
• Preferably do not use individual formats but common standards
http://picture.yatego.com/
• De facto standards emerge over time through frequent use
• De facto standards are standardized by institutions
• In the area of standards for spatial data the following institutions are important
6.1 Standards
institutions are important
– International Organization for Standardization (ISO) – Open Geospatial Consortium (OGC)
– Working Committee of the Surveying Authorities of the States of the Federal Republic of Germany
(Arbeitsgemeinschaft der Vermessungsverwaltungen der Länder der Bundesrepublik Deutschland (AdV))
• International Organization for Standardization (ISO)
– International association of
standardization bodies from approx. 150 countries – Develops international standards in many technical
6.1 Standards
– Develops international standards in many technical areas
– Serves the exchange of goods and services and the mutual cooperation
– In the area of spatial information 5 working groups (in ISO/TC 211)
• National standardization bodies and ISO
6.1 Standards
http://www.geoinformation.net/
• ISO/TC 211 geographic information/geomatics
– Approx. 60 members
– Edits the standard series ISO 19100
6.1 Standards
• ISO 19107 Spatial Schema
6.1 Standards
http://www.geoinformation.net/
• Geometry classes in the spatial schema
6.1 Standards
• Open Geospatial Consortium (OGC)
– International consortium of approx. 350 members (industry, administration, research)
– Develops fundamentals for standardized access methods for spatial information
6.1 Standards
– Products of the OGC are specifications
• Basic models, abstract specifications, implementation specifications
– Overview of abstract specifications
6.1 Standards
http://www.geoinformation.net/
– Particularly important: Simple Features
• Standard for modeling the geometry of spatial objects
• 0-, 1-, 2-dimensional, straight lines, no topology
6.1 Standards
• SQL/MM spatial vs.
Simple Features geometry
6.1 Standards
• Cooperation between ISO/TC 211 and OGC
6.1 Standards
http://www.geoinformation.net/
• Example: OpenGIS Catalog Service Implementation Specification
• Supports publishing and searching of geospatial metadata
6.1 Standards
metadata
– Approx. 200 printed pages – Includes syntax
of the catalog query language
http://www.opengeospatial.org/standards/cat
• Working Committee of the Surveying Authorities of the States of the Federal Republic
of Germany (Arbeitsgemeinschaft der
Vermessungsverwaltungen der Länder der Bundesrepublik Deutschland (AdV))
6.1 Standards
Bundesrepublik Deutschland (AdV))
– Coordination of the German cadastral surveying – Development of recommendations for
• Authoritative topographic cartographic information system
(amtliches topographisch-kartographisches Informationssystem (ATKIS))
• Authoritative real estate cadastre information system (amtliches Liegenschafts-Kataster-Informationssystem (ALKIS))
– Representation of the official German surveying in international institutions (see section 2.5 AAA-
Project)
– Provide ISO/OGC-compliant components for spatial data infrastructure
6.1 Standards
data infrastructure
– Example: AFIS-ALKIS-ATKIS specialized technical schema with 226 object types, including
• Buildings, including
• Groups of object types: information concerning buildings, including
• Object class: AX_Gebaeude with definition:
• A permanent building, whose documentation is required because of its importance as a property and which serves the purpose of the basic information of real estate cadastre
• With 20 attributes, including:
6.1 Standards
• Function of building with approx. 200 values, including:
• 2000 (business/industry), 2056 (pharmacy), 2081 (restaurant), 3071 (police)
– Provide the technical schemas (and all object copies) in ISO/OGC-compliant formats
• Example: a single building
<AX_Gebaeude gml:id="DEHHSERV00001FN1">
...
<position>
<gml:Polygon>
<gml:exterior>
<gml:Ring>
...
<gml:pos>3567807.047 5930017.550</gml:pos>
<gml:pos>3567810.850 5930024.755</gml:pos>
...
6.1 Standards
<gml:pos>3567810.850 5930024.755</gml:pos>
...
<gml:pos>3567807.047 5930017.550</gml:pos>
...
</gml:Ring>
</gml:exterior>
</gml:Polygon>
</position>
<gebaeudefunktion>2000</gebaeudefunktion>
<weitereGebaeudefunktion>1170</weitereGebaeudefunktion>
<bauweise>2100</bauweise>
<anzahlDerOberirdischenGeschosse>1</anzahlDerOberirdischenGeschosse>
<anzahlDerUnterirdischenGeschosse>1</anzahlDerUnterirdischenGeschosse>
<dachform>3100</dachform>
</AX_Gebaeude>
• Extensible Markup Language
• Representation of hierarchically structured data in the format of text files
6.2 XML
of text files
• Metalanguage for the description
and generation of markup languages
• "Special context-free grammar for defining specific context-free grammars"
• "Standard for exchanging data on the web"
• Markup language: language (words over an alphabet) with special symbols (tags) in the character strings
• HTML example:
6.2 XML
• HTML example:
[EE04]
<ul>
<li>
<p>Geotopographische Basisinformationen in digitaler Form
</li>
<li>
<p> Geodä tische Referenznetze
</li>
</ul>
• A (concrete) class of XML-based applications is also called document class
• An extension of such a class is called a document (or an application)
• The structure of
6.2 XML
• The structure of document classes can be specified by means of a
document type definition (DTD)
• Main components of the DTDs are
– Elements – Attributes – Entities
• Elements are the basic modules of XML
6.2 XML
• Elements are the basic modules of XML documents
– Consist of a start and an end tag – May be empty
– May be nested (hierarchical structure of XML documents)
• Example: a DTD of a city
6.2 XML
<!ELEMENT city(name, inhabitants?, area)>
<!ELEMENT city(name, inhabitants?, area)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT inhabitants(#PCDATA)>
<!ELEMENT area(polygon+)>
<!ELEMENT polygon (point, point, point, point, point*)>
<!ELEMENT point(x, y)>
<!ELEMENT x (#PCDATA)>
<!ELEMENT y (#PCDATA)>
– A well-formed instance:
6.2 XML
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE city SYSTEM "city.dtd">
<city><name>Braunschweig</name>
<inhabitants>248000</inhabitants>
<area>
<polygon>
<polygon>
<point><x>10323</x><y>2294</y></point>
<point><x>10708</x><y>2429</y></point>
<point><x>11148</x><y>2594</y></point>
...
<point><x>10353</x><y>2484</y></point>
</polygon>
</area>
</city>
– Another well-formed instance:
6.2 XML
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE city SYSTEM "city.dtd">
<city><name>Ausschnitt</name>
<inhabitants>aus</inhabitants>
<area>
<polygon>
<polygon>
<point><x>welchem</x><y>Text</y></point>
<point><x>Du</x><y>gleichst</y></point>
<point><x>dem</x><y>Geist</y></point>
...
<point><x>nicht</x><y>mir</y></point>
</polygon>
</area>
</city>
• Attributes specify additional properties of elements
6.2 XML
– Example: [EE04]
<text font-family= "Arial" font-weight= "bold" font-size= "350"
stroke= "#FFFFFF" fill= "#FFFFFF" x= "-130.0" y="115.0"> U
</text>
• Entities
– Placeholder for content
– Will be declared once and can be used repeatedly
– At each place of use the parser replaces reference by
6.2 XML
At each place of use the parser replaces reference by appropriate value
– Example:
<!ENTITY baumgrün "#00ff00">
<!ENTITY grenzviolett "#9900ff">
<path id="SN4100_einzelsignaturNadelholz"
d="M 130 0 L -50 0 0 -180 50 0"
fill="none" stroke-miterlimit="20"
stroke-linejoin="miter"
stroke-width="12" stroke="&baumgrün;"/>
• A central XML concept is integration of data and meta-data (XML documents include complete
self-descriptions)
• Therefore, removal of DTDs is obvious (for
6.2 XML
• Therefore, removal of DTDs is obvious (for reuse)
• Large-scale projects may have several DTDs (possible name conflicts)
• For combining XML documents multiple concepts exist
– Namespaces – XPath
6.2 XML
– XPointer – XLink
http://www.jeckle.de/
• Namespaces
– Are declared as attribute (of an element) and apply to all sub-trees of that element
– Include a Uniform Resource Identifier (URI) as address
6.2 XML
address
[EE04]
<AX_Bestandsdatenauszug
xmlns:gml="http://www.opengis.net/gml"...>
...<gml:featureMember>...
...</gml:featureMember>...
</AX_Bestandsdatenauszug>
• XML Path Language (XPath)
– Addressing within XML documents
– Basis of XSL Transformations (XSLT) and XPointer
– Navigation in XML documents (trees) with address paths
6.2 XML
• Address paths
– Absolute (begin with '/' for root node) or – Relative (to the current context node)
– Contain axis information, node tests, predicates
[EE04]
• XML Pointer Language (XPointer)
– Addressing parts of XML documents – Extension of XPath
– Simple references refer to XML elements which are identified by an ID
6.2 XML
identified by an ID
– Complex references with specifications of blocks (start-point, end-point, range)
<g id="SN3316SymbolKirche">
<path fill="none" stroke= "#000000" ... d="M0.0 -500.0 L 0.0 500.0"/>
<path fill="none" stroke= "#000000" ... d="M-275.0 -200.0 L 275.0 -200.0"/>
</g>
<use transform="translate(120515.9,152201.3) rotate(136)"
xlink:href="#SN3316SymbolKirche"/>
• XML Linking Language (XLink)
– Syntax for defining links within XML documents
– XLinks are linking XML elements with other XML elements
– Declaration by xlink:href="URI"
6.2 XML
– Declaration by xlink:href="URI"
– URI information may contain XPointer expressions
– There are simple (xlink: type = "simple") and extended (xlink: type = "extended") XLinks
– Extended XLinks are linking more than two sources
• Structure of XML documents can be defined by DTDs
• However, expressiveness of DTDs is restricted
– No specific data <!ELEMENT city(name, inhabitants?, area)>
6.2 XML
– No specific data
types (only CDATA) – Only few structuring
options by sub-elements
– Integrity constraints hardly definable
<!ELEMENT city(name, inhabitants?, area)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT inhabitants(#PCDATA)>
<!ELEMENT area(polygon+)>
<!ELEMENT polygon
(point, point, point, point, point*)>
<!ELEMENT point(x, y)>
<!ELEMENT x (#PCDATA)>
<!ELEMENT y (#PCDATA)>
• XML-Schema
– Language for modeling structured information – Describes by schema language
• Data types
6.2 XML-Schema
<simpleType name="PriorityType">
<restriction base="positiveInteger">
• Documents
• Document Groups
– Alternative to DTDs
– Element contents can be typed and reused
– Allows limitations of value ranges and specifications of cardinalities
<restriction base="positiveInteger">
<minInclusive value="100"/>
<maxInclusive value="999"/>
</restriction>
</simpleType>
• Numerous data types are provided, including
– xsd:string, xsd:boolean, xsd:decimal, xsd:float, xsd:time, xsd:date, xsd:integer (xsd: namespace of XML-Schema)
• Construction of data types with
6.2 XML-Schema
– Base type with restrictions
• Length specifications, patterns, ranges, enumerations
• List types and
union types <!-- names of some ALKIS object classes -->
<!-- may only contain certain characters -->
<xsd:simpleType name="ObjektartName">
<xsd:restriction base="xsd:string">
<xsd:pattern value="A[XP]_[a-zA-Z0-9_]+"/>
</xsd:restriction>
</xsd:simpleType>
• Complex element declarations are possible
6.2 XML-Schema
• Example of a complex element declaration
6.2 XML-Schema
<element name="Signaturen">
<complexType>
<sequence>
<element name="Signatur" minOccurs="1" maxOccurs="unbounded">
<complexType>
<choice>
<element name="FlaechenSignatur" type="loc:SigFlaeche"/>
<element name="LinienSignatur" type="loc:SigLinie"/>
<element name="Signaturen">
<complexType>
<sequence>
<element name="Signatur" minOccurs="1" maxOccurs="unbounded">
<complexType>
<choice>
<element name="FlaechenSignatur" type="loc:SigFlaeche"/>
<element name="LinienSignatur" type="loc:SigLinie"/>
<element name="LinienSignatur" type="loc:SigLinie"/>
<element name="SymbolSignatur" type="loc:SigSymbol"/>
<element name="SchriftSignatur" type="loc:SigSchrift"/>
</choice>
<attribute name="Nr" type="loc:SigNrType" use="required"/>
<attribute name="Typ" type="loc:SigTypType" use="required"/>
<attribute name="Darstellungsprioritaet" type="loc:PrioType"use="required"/>
<unique name="uniqueSigNr"><selector xpath="."/><field xpath="@Nr"/></unique>
</complexType>
</element>
</sequence>
</complexType>
</element>
<element name="LinienSignatur" type="loc:SigLinie"/>
<element name="SymbolSignatur" type="loc:SigSymbol"/>
<element name="SchriftSignatur" type="loc:SigSchrift"/>
</choice>
<attribute name="Nr" type="loc:SigNrType" use="required"/>
<attribute name="Typ" type="loc:SigTypType" use="required"/>
<attribute name="Darstellungsprioritaet" type="loc:PrioType"use="required"/>
<unique name="uniqueSigNr"><selector xpath="."/>
<field xpath="@Nr"/></unique>
</complexType>
</element>
</sequence>
</complexType>
</element>
• Example of an element instance
6.2 XML-Schema
<Signaturen>
...
<Signatur Nr="4286" Typ="Schrift" Darstellungsprioritaet="380">
<SchriftSignatur>
<Bezeichnung>Schriftformat F K 28 blau</Bezeichnung>
<SchriftStyle>
<Schriftart>Arial</Schriftart>
<Schriftart>Arial</Schriftart>
<Schriftstil>Fett, Kursiv</Schriftstil>
<Schriftgrad>28 pt</Schriftgrad>
<Schriftfarbe><Farbgrundton>Blau</Farbgrundton>
<Cyan>100</Cyan> <Magenta>0</Magenta>
<Yellow>0</Yellow><Black>20</Black>
</Schriftfarbe>
</SchriftStyle>
<Effekt>Grossbuchstaben</Effekt>
</SchriftSignatur>
</Signatur>
...
</Signaturen>
• Definition of keys and foreign keys
6.2 XML-Schema
[EE04]
• Geography Markup Language
• Markup Language generated by the use of XML (and XML-Schema); XML application
• To exchange spatial objects (in the OGC context:
"features")
6.3 GML
"features")
• Defined by the Open Geospatial Consortium with the ISO TC 211
• Defines numerous constructs for modelling own spatial applications, including
– Objects (features) and geometries
• The current GML specification of the OGC (version 3.0)
consists of approx.
550 pages
6.3 GML
550 pages
• The basic elements and data types are defined in 33 XML-Schema documents (base schemas)
• A concrete application has to be derived from the given schemas
6.3 GML
• The central class is the abstract feature type
• “All specific feature types defined in application
schemas must be derived from AbstractFeatureType”
6.3 GML
<complexType name="AbstractFeatureType" abstract="true">
<complexContent>
<complexType name="AbstractFeatureType" abstract="true">
<complexContent>
<extension base="gml:AbstractGMLType">
<sequence>
<element ref="gml:boundedBy" minOccurs="0"/>
<element ref="gml:location" minOccurs="0"/>
<!-- additional properties must be specified in an application schema -->
</sequence>
<attribute name="fid" type="string"></attribute>
</extension>
</complexContent>
</complexType>
• Among others the geometries of the “Simple Features” are provided
– Typically 2-dimensional geometries with straight lines – Including points, lines, polygons
6.3 GML
• Definition of the polygon type
6.3 GML
<complexType name="PolygonType">
<complexContent>
<extension base="gml:AbstractGeometryType">
<sequence>
<element name="outerBoundaryIs">
<complexType>
<sequence><element ref="gml:LinearRing"/></sequence>
<sequence><element ref="gml:LinearRing"/></sequence>
</complexType>
</element>
<element name="innerBoundaryIs" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence><element ref="gml:LinearRing"/></sequence>
</complexType>
</element>
</sequence>
</extension>
</complexContent>
</complexType>
• Definition of an own feature type
6.3 GML
<complexType name="lakeTyp">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<sequence>
<element name="lakeName" type="string"/>
<element name="maxDepth" type="integer"/>
<element name="area" type="decimal"/>
</sequence>
</extension>
</complexContent>
</complexType>
• AFIS ALKIS ATKIS schema of the AdV is a (very large) example of a GML-
compliant modeling of a spatial application
• Consists of a base schema (contains common base classes for spatial objects)
6.3 GML
http://www.adv-online.de/
base classes for spatial objects)
• And of technical schemas (containing all object classes needed for representing the information occurring in cadastral surveying)
• For ALKIS there exist more than 220 object types including numerous types of relationships
• Here only a very small example is presented:
the schema of a single object class
"AX_Gebaeude" (simplified)
6.3 GML
<element name="AX_Gebaeude"/>
<complexType name="AX_GebaeudeType">
<complexType name="AX_GebaeudeType">
<complexContent>
<extension base="adv:AG_ObjektType">
<sequence>
<element name="gebaeudefunktion"
type="adv:AX_GebaeudefunktionType"/>
<element maxOccurs="unbounded" minOccurs="0"
name="weitereGebaeudefunktion"
type="adv:AX_Weitere_GebaeudefunktionType"/>
<element maxOccurs="unbounded" minOccurs="0"
name="name" type="string"/>
<element maxOccurs="unbounded" minOccurs="0" name="nutzung"
6.3 GML
<element minOccurs="0" name="bauweise"
type="adv:AX_Bauweise_GebaeudeType"/>
<element minOccurs="0" name="anzahlDerOberirdischenGeschosse"
type="integer"/>
<element minOccurs="0" name="anzahlDerUnterirdischenGeschosse"
type="integer"/>
<element minOccurs="0" name="hochhaus" type="boolean"/>
<element minOccurs="0" name="objekthoehe" type="gml:LengthType"/>
<element minOccurs="0" name="objekthoehe" type="gml:LengthType"/>
<element minOccurs="0" name="dachform"
type="adv:AX_DachformType"/>
<element minOccurs="0" name="zustand"
type="adv: AX_Zustand_GebaeudeType"/>
<element minOccurs="0" name="geschossflaeche" type="gml:AreaType"/>
<element minOccurs="0" name="grundflaeche" type="gml:AreaType"/>
<element minOccurs="0" name="umbauterRaum" type="gml:VolumeType"/>
<element maxOccurs="unbounded" minOccurs="0"
name="baujahr" type="integer"/>
<element minOccurs="0" name="lageZurErdoberflaeche"
type="adv:AX_LageZurErdoberflaeche_GebaeudeType"/>
<element minOccurs="0" name="dachart" type="string"/>
<element minOccurs="0" name="dachgeschossausbau"
type="adv:AX_Dachgeschossausbau_GebaeudeType"/>
<element minOccurs="0" name="gebaeudekennzeichen" type="string"/>
<element maxOccurs="unbounded" minOccurs="0"
name="zeigtAuf" type="gml:ReferenceType">
</element>
<element maxOccurs="unbounded" minOccurs="0"
6.3 GML
<element maxOccurs="unbounded" minOccurs="0"
name="gehoert" type="gml:ReferenceType">
</element>
<element minOccurs="0" name="gehoertZu“ type="gml:ReferenceType">
</element>
<element maxOccurs="unbounded" minOccurs="0"
name="haengtZusammenMit" type="gml:ReferenceType">
</element>
</sequence>
</extension>
</complexContent>
</complexType>
<AX_Gebaeude gml:id="DEHHSERV00001FN1">
...
<position>
<gml:Polygon>
<gml:exterior>
<gml:Ring>
<gml:pos>3567807.047 5930017.550</gml:pos>
– An instance of "AX_Gebaeude" (simplified)
6.3 GML
"position":
inherited
<gml:pos>3567807.047 5930017.550</gml:pos>
<gml:pos>3567810.850 5930024.755</gml:pos>
...
<gml:pos>3567807.047 5930017.550</gml:pos>
</gml:Ring>
</gml:exterior>
</gml:Polygon>
</position>
<gebaeudefunktion>2000</gebaeudefunktion>
<weitereGebaeudefunktion>1170</weitereGebaeudefunktion>
<bauweise>2100</bauweise>
<anzahlDerOberirdischenGeschosse>1</anzahlDerOberirdischenGeschosse>
<dachform>3100</dachform>
</AX_Gebaeude>
inherited of class
AG_ObjektType
• GML serves (also) for the exchange of spatial objects
• Therefor the Web Feature Service (WFS) was defined
6.3 GML
defined
– Web-based access to data "of a distributed GIS"
– Only vector data are exchanged
– Requests are sent as a HTTP request from a client to the WFS
– WFS offers the following operations
• GetCapabilities
• GetFeature
• DescribeFeatureType
• Transaction
6.3 GML
• LockFeature
• GetCapabilities
– Describes which WFS services are available – Gives the names of the
available feature types
• DescribeFeatureType
– Describes the schema of a feature type
• GetFeature
– Delivers an instance of a feature
6.3 GML
– Delivers an instance of a feature
– Supports spatial and non-spatial selections
<wfs:Query typeName="AX_Gebaeude">
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>weitereGebaeudefunktion</ogc:PropertyName>
<ogc:Literal>1170</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</wfs:Query>
• Extensible Stylesheet Language for Transformation
• Programming language to
transform XML documents
6.4 XSLT
transform XML documents
• Computational complete
• Based on tree structure of XML documents
• Used to define transformation rules
• Is a declarative and functional programming language
• XSLT programs (XSLT stylesheets) are XML documents themselves
• Stylesheets are read by XSLT processors; based on the stylesheets' rules the XSLT processors then transforms input documents into output
6.4 XSLT
then transforms input documents into output documents
• A transformation consists of transformation rules (templates) with the following structure
– An XPath-based pattern
– Instructions for constructing the target tree
• Patterns select nodes of the source tree
6.4 XSLT
• Patterns select nodes of the source tree
• From these nodes the instructions generate parts of the target tree
• Frame of a transformation (XSLT stylesheet):
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform version="1.0">
<xsl:output method="xml" />
<!– rules -->
</xsl:stylesheet>
• Main construct is the template
6.4 XSLT
<xsl:template match="...">
...instructions...
</ xsl: template>
– If several transformation rules are applicable, the most specific one is
applied
– Within a template
numerous instructions may occur
• <xsl:apply-templates
select = ... mode = ...>
... parameters may occur... </xsl:apply-templates>
– Explicit call of templates
– In the select attribute specification of an XPath
6.4 XSLT
– In the select attribute specification of an XPath expression
– With it selection of the nodes to be processed
– If no select element is present, all direct child nodes are processed
– With the mode parameters further node selection can be performed
• <xsl:value-of select = .../>
– Generates a string at the current position in the output tree
– String can be the value of a node or of a defined variable
6.4 XSLT
variable
– Select attribute selects node, variable, or parameter whose value is to be used
• <xsl:for-each select = ...> ...instructions...
</xsl:for-each>
– Iteration instructions within a template definition – All instructions within this statement are applied to
all specified nodes
6.4 XSLT
all specified nodes
– Select attribute selects nodes
• <xsl:text>
– Generates static text in the result tree
• <xsl:choose>
– Frame for sequence of queries – <xsl:when test = ...>
...instructions... </xsl:when>
– Queries are finished with <xsl:otherwise>
6.4 XSLT
– Queries are finished with <xsl:otherwise>
– Those query is selected whose condition as first yields true
• <xsl:if test = ...> ...instructions... </xsl:if>
– Conditional execution of instructions – Test attribute contains condition
• For illustration: excerpt from "xslt.xsd" to describe "choose"
6.4 XSLT
<complexType name="choose" content="elementOnly">
<element name="when" type="xsl:conditional-template"
maxOccurs="unbounded"/>
<element name="otherwise" type="xsl:template-with-space"
minOccurs="0"/>
minOccurs="0"/>
</complexType>
<complexType name="conditional-template" base="xsl:template-with-space"
derivedBy="extension">
<attribute name="test" type="xsl:expr"/>
</complexType>
<complexType name="template-with-space" base="xsl:template"
derivedBy="extension">
<attribute ref="xml:space"/>
</complexType>
• Example for the use of XSLT
– Transformation of XML-compliant extracts of the digital landscape model (DLM25)
into TK25-like graphics (see section 3.2) – Here: derivation rule for local roads
6.4 XSLT Example
– Here: derivation rule for local roads
(are drawn as white lines with a narrow purple boundary)
– Template scans data for local roads and generates drawing commands
• A (fairly short) road in the given landscape dataset
6.4 XSLT Example
<AtkisMember>
<Strasse>
<gml:name>Badstrasse</gml:name>
<AtkisOID>86118065</AtkisOID>
<gml:centerLineOf>
<gml:coord>
<gml:coord>
<gml:X>4437952.980</gml:X>
<gml:Y>5331812.550</gml:Y>
</gml:coord>
<gml:coord>
<gml:X>4437960.070</gml:X>
<gml:Y>5331818.450</gml:Y>
</gml:coord>
<gml:coord>
<gml:X>4437967.200</gml:X>
<gml:Y>5331825.410</gml:Y>
</gml:coord>
</gml:centerLineOf>
6.4 XSLT Example
<Attribute>
<Zustand>in Betrieb</Zustand>
<AnzahlDerFahrstreifen
Bedeutung="tatsaechliche Anzahl"> 2
</AnzahlDerFahrstreifen>
<Funktion>Strassenverkehr</Funktion>
<VerkehrsbedeutungInneroertlich>
Anliegerverkehr
</VerkehrsbedeutungInneroertlich>
</VerkehrsbedeutungInneroertlich>
<BreiteDerFahrbahn>Keine Zuweisung
</BreiteDerFahrbahn>
<Widmung>Gemeindestrasse</Widmung>
<InternationaleBedeutung>
Attribut trifft nicht zu
</InternationaleBedeutung>
<VerkehrsbedeutungUeberoertlich>
Attribut trifft nicht zu
</VerkehrsbedeutungUeberuertlich>
</Attribute>
</Strasse>
</AtkisMember>
• Search for local roads
6.4 XSLT Example
<xsl:template
match="/dlm:AtkisModell/dlm:AtkisMember/dlm:Strasse">
<xsl:if test="contains(dlm:Attribute/dlm:Widmung,’Gemeindestrasse’) or contains(dlm:Attribute/dlm:Widmung,’Sonstiges’)">
<xsl:call-template name="DrawPath">
<xsl:with-param name="styleclass"
<xsl:with-param name="styleclass"
select="linieNebenstrasseNahverkehrVordergrund">
</xsl:call-template>
</xsl:if>
</xsl:template> <AtkisMember>
<Strasse>
<gml:name>Badstrasse</gml:name>
<AtkisOID>86118065</AtkisOID>
<gml:centerLineOf>
<gml:coord>
<gml:X>4437952.980</gml:X>
<gml:Y>5331812.550</gml:Y>
</gml:coord>
• Generating line signatures
6.4 XSLT Example
<xsl:template name="DrawPath">
<xsl:param name="styleclass"/>
<svg:path>
<xsl:attribute name="class"><xsl:value-of select="$styleclass"/></xsl:attribute>
<xsl:attribute name="d">
<xsl:for-each select="gml:centerLineOf/gml:coord">
<xsl:choose>
<xsl:when test="position() = 1">
<xsl:when test="position() = 1">
<xsl:text>M </xsl:text><xsl:call-template name="getX"/>
<xsl:text> </xsl:text><xsl:call-template name="getY"/>
<xsl:text> L </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="getX"/>
<xsl:text> </xsl:text><xsl:call-template name="getY"/>
<xsl:if test="position() != last()"><xsl:text> </xsl:text></xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:attribute>
</svg:path>
• Templates "getX" and "getY" read x and y
coordinates, transform the coordinates into map coordinates, and write it to the current position in the output tree
• Style class
6.4 XSLT Example
• Style class
“linieNebenstrasseNahverkehrVordergrund”:
• Line which is generated in the example (SVG statement):
.linieNebenstrasseNahverkehrVordergrund
{ fill: none; stroke-width: 8.5px; stroke: snow; stroke-linejoin: round}
<path class="linieNebenstrasseNahverkehrVordergrund"
d="M 8245.97 -2142.98 L 8253.65 -2146.15 8259.83 -2151.12"/>
• Scalable Vector Graphics (SVG)
• XML-based language for
describing two-dimensional, freely scalable vector graphics
6.5 SVG
freely scalable vector graphics
• Standard of the W3C
• Beside static graphics also interactions, animation, and filter applications are provided
• SVG files are relatively small and are editable with any text editor
• SVG documents are structured like XML documents
– Prolog with XML declaration and document type declaration
– Root element, including
6.5 SVG
– Root element, including
• Declaration of namespaces and
• Definition area (also for non-SVG code)
– Attributes "width" and "height" specify the width and the height of the entire graphic
– Optional attribute "viewBox" defines reference frame, specified are its left lower point and its width
– Example, declares a frame for a real estate map in the context of an A3 landscape format and a scale of
1:1000
6.5 SVG
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width= "42.0cm" height= "29.7cm "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width= "42.0cm" height= "29.7cm
viewBox= "99269.744 150779.44 42000.0 29700.0"
xmlns:xlink= "http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
.SN2028LinieFlurstueck{fill: none; stroke-width: 35; stroke-linecap: butt;
stroke-linejoin: miter; stroke: #000000;}
...
</style>
...
</defs>
...
• Several SVG elements and attributes, including
– Line between 2 points (line)
– Line connecting several points (polyline) – Rectangle (rect)
6.5 SVG
Rectangle (rect) – Circle
– Ellipse – Polygon – Path
– Text
<svg width="70" height="40">
<rect x="5" y="5"
width="50" height="25"
style="stroke: blue; fill: none;">
</svg>
• All attributes of rectangle
6.5 SVG
<!ATTLIST %SVG.rect.qname;
%SVG.Core.attrib;
%SVG.Conditional.attrib;
%SVG.Style.attrib;
%SVG.Paint.attrib;
%SVG.Color.attrib;
%SVG.Opacity.attrib;
%SVG.Opacity.attrib;
%SVG.Graphics.attrib;
%SVG.Clip.attrib;
%SVG.Mask.attrib;
%SVG.Filter.attrib;
%SVG.GraphicalEvents.attrib;
%SVG.Cursor.attrib;
%SVG.External.attrib;
x %Coordinate.datatype; #IMPLIED y %Coordinate.datatype; #IMPLIED width %Length.datatype; #REQUIRED height %Length.datatype; #REQUIRED rx %Length.datatype; #IMPLIED
ry %Length.datatype; #IMPLIED
• Circle example (with instruction for grouping and transformation)
6.5 SVG
<g style="fill-opacity:0.7;
stroke:black;
stroke-width:0.1cm;">
<circle cx="6cm" cy="2cm" r="100"
http://luxor-xul.sourceforge.net/
<circle cx="6cm" cy="2cm" r="100"
style="fill:red;"
transform="translate(0,50)"/>
<circle cx="6cm" cy="2cm" r="100"
style="fill:blue;"
transform="translate(70,150)"/>
<circle cx="6cm" cy="2cm" r="100"
style="fill:green;"
transform="translate(-70,150)"/>
</g>
• Path instruction for complex shapes, lines and areas
– Element’s attributes include the attribute “d” for specifying the points of the path
– Attribute “d” contains further commands for the
6.5 SVG
– Attribute “d” contains further commands for the interpretation of the points
– E.g. a point may be the begin or the end of a curve or of a line
<path id="SN4100_einzelsignaturNadelholz"
d="M 130 0 L -50 0 0 -180 50 0"
fill="none" stroke-miterlimit="20"
stroke-linejoin="miter"
stroke-width="12" stroke="&baumgrün;"/>
• Commands of the path instruction
6.5 SVG
command description example
M (MoveTo) specifies the starting point of a path M20 50
Z (ClosePath) generates a closed shape Z
L (LineTo) draws a line from the current point to the specified point
L50 100 specified point
H (Horizontal LineTo)
draws a horizontal line from the current point
H75
V (Vertical LineTo) draws a vertical line from the current point V40 C (CurveTo) draws a Bézier curve from the current
point
C30 0 50 20 60 15
Q (Quadratic Bézier CurveTo)
draws a quadratic Bézier curve from the current point
Q40 0 60 20 A (Elliptical Arc) draws an elliptic arc from the current point A25 25 -30 0 1
50 -25
• Path example (with quadratic Bezier curve)
6.5 SVG
<path fill="none" stroke-width="3"
stroke="green"
d="M 20 20 l 0 -13 M 16 20 q 0 -10 -5 -10 M 12 20 q 0 -6 -4 -6 M 12 20 q 0 -6 -4 -6 M 24 20 q 0 -10 5 -10 M 28 20 q 0 -6 4 -6"
id="Pflanzensymbol"/>
• Path example (with grouping command and filled areas)
6.5 SVG
<g id="SN3338SymbolApotheke">
<!-- Priority 350 -->
<path d="M -250.0 250.0 L -250.0 -250.0 250.0 -250.0 250.0 250.0 Z“ fill= "#FFFFFF"/>
250.0 250.0 Z“ fill= "#FFFFFF"/>
<path d="M -200.0 145.0 L -118.0 88.0 -94.0 97.0 -94.0 72.0 -148.0 72.0 -148.0 -27.0 -94.0 -27.0 -94.0 -152.0 33.0 -200.0 161.0 -134.0
161.0 80.0 200.0 115.0 132.0 200.0 62.0 150.0 62.0 72.0 0.0 72.0 0.0 150.0 -73.0 200.0 Z“ fill= "#FF0000"/>
<path d="M 0.0 -27.0 L 0.0 -119.0 62.0 -95.0 62.0 -27.0 Z"
fill= "#FFFFFF"/>
</g>
• Text instruction for text placement
– Beside being a graphic element, in SVG text is also available as a text element
6.5 SVG
element
– Several attributes,
including “x” and “y” for positioning
– Texts can be translated and turned
– Orientation, alignment, font stretch may be
specified among others
[SX08]
• Text example
6.5 SVG
<defs>
<style type="text/css">
<![CDATA[ text {font-family:verdana,sans-serif;
font-size:40px; font-weight:bold;}]]>
</style>
</defs>
http://svg.tutorial.aptico.de/
</defs>
<circle cx="150" cy="100" r="90“
style="fill:none; stroke:black;" />
<!-- multiple values for x and y-->
<text class="big" x="110,135,160" y="70,110,150"> SVG
</text>
<!-- usage of dx and dy-->
<text class="big" x="110,135,160" y="70,110,150“
dx="-10,-10,-10" style="fill:red;"> SVG
</text>
• Grouping instruction “g” to group elements
– Attributes of grouped elements can be specified altogether, e.g. style attributes
6.5 SVG
<g style="fill-opacity:0.7; stroke:black; stroke-width:0.1cm;">
<circle cx="6cm" cy="2cm" r="100" style="fill:red;"
– Groups can be named
<g id="SN3338SymbolApotheke">
<path d="M -250.0 250.0 L -250.0 ... Z" fill= "#FFFFFF"/>
<path d="M -200.0 145.0 L -118.0 ... Z" fill= "#FF0000"/>
<path d="M 0.0 -27.0 L 0.0 ... Z" fill= "#FFFFFF"/></g>
<circle cx="6cm" cy="2cm" r="100" style="fill:red;"
transform="translate(0,50)"/>
<circle cx="6cm" cy="2cm" r="100" style="fill:blue;"
transform="translate(70,150)"/>
<circle cx="6cm" cy="2cm" r="100" style="fill:green;"
transform="translate(-70,150)"/></g>
– Also different elements may be grouped
6.5 SVG
<g id="SN3309SymbolParkhausParkdeck">
<path d="M-250.0 310.0 L -250.0 -190.0 0.0 -310.0 250.0 -190.0 250.0 310.0 Z"
fill= "#00FFFF"/>
<text font-family= "Arial" font-weight= "bold"
font-size= "420" stroke= "#FFFFFF"
fill= "#FFFFFF" x= "-130.0" y="150.0">
• With the "use" element an instance of a named element (e.g. of a group) is created
fill= "#FFFFFF" x= "-130.0" y="150.0">
P
</text>
</g>
<use transform="translate(135463.0,173871.7)"
xlink:href="#SN3309SymbolParkhausParkdeck"/>