GEOM2240
GML

GML er et XML-basert format for utveksling av geografisk informasjon.

GML er spesifisert av OGC og senere standardisert av ISO for GML 3.2.1 OGC/ISO19136

(http://www.opengeospatial.org/standards/gml). 

Sentral litteratur:

 

Veileder for Geography Markup Language (GML)

https://www.geonorge.no/Geodataarbeid/veiledere/

(mange av figurene i denne presentasjonen er hentet fra denne)

 

Geography Markup Language (GML) Encoding Standard v. 3.2.1

Geography Markup Language (GML) — Extended schemas and encoding rules v. 3.3.0

http://www.opengeospatial.org/standards/gml

 

Eksempel på GML-objekt fra SOSI objektkatalog,
Ledningsnett v. 4.5, fra side 209: Eksempel på produktspesifikasjon

GML gir oss byggeklosser til å definere objekttyper i XML Skjema. Vi skal se på disse byggeklossene.

Eksempel på GML-objekt fra SOSI objektkatalog,
Ledningsnett v. 4.5, 
fra side 209: Eksempel på produktspesifikasjon


   <VA_Vannledning gml:id="VA_Vannledning.id2011">
      <kommune>0101</kommune>
      <identifikasjon>
        <Identifikasjon>
          <lokalId>11</lokalId>
          <navnerom>SOSI_VA</navnerom>
        </Identifikasjon>
      </identifikasjon>
      <status codeSpace="http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0/LedningsStatus">I bruk</status>
      <høydereferanse codeSpace="http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0/LedningHøydereferanse">Senter</høydereferanse>
      <nettverk ns2:href="#Ledningsnettverk.id2000"/>
      <beliggenhet>
        <gml:LineString gml:id="id5011" srsName="urn:ogc:def:crs:EPSG::5972" srsDimension="3">
          <gml:posList count="2">250495.0 6735215.0 10.0 250440.0 6735420.0 10.0</gml:posList>
        </gml:LineString>
      </beliggenhet>
      <fraKobling ns2:href="#VA_Anboring.id2009-1"/>
      <tilKobling ns2:href="#VA_Bakkekran.id2010"/>
      <sikkerhetsavstand>1.0</sikkerhetsavstand>
    </VA_Vannledning>

Alle elementer uten prefiks tilhører standard navnerom (GML applikasjonskjema):

xmlns=http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0

<kommune>
<identifikasjon>
<lokalId>
<navnerom>
<status>
<høydereferanse>
<nettverk>
<beliggenhet>
<fraKobling>
<tilKobling>
<sikkerhetsavstand>
<element name="kommune" type="gml:CodeType">
<element name="identifikasjon" type="app:IdentifikasjonPropertyType"/>
<element name="lokalId" type="string">
<element name="navnerom" type="string">
<element name="status" type="gml:CodeType"/>
<element name="høydereferanse" type="gml:CodeType"/>
<element maxOccurs="unbounded" minOccurs="0" name="nettverk" type="app:LedningsnettverkPropertyType"/>
<element minOccurs="0" name="beliggenhet" type="gml:CurvePropertyType"/>
<element minOccurs="0" name="fraKobling" type="app:KoplingPropertyType"/>
<element minOccurs="0" name="tilKobling" type="app:KoplingPropertyType"/>
<element name="sikkerhetsavstand" type="double">
@<?xml version="1.0" encoding="UTF-8"?>
<gml:FeatureCollection 
	xmlns="http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0" 
	xmlns:gml="http://www.opengis.net/gml/3.2" 
	xmlns:ns2="http://www.w3.org/1999/xlink" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	gml:id="SOSI_Ledning_Datasett_eksempel_a" 
	xsi:schemaLocation="http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0
                            http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0/SOSI_Ledning_Vedlegg1.xsd">

Hvordan finner vi standard navnerom?

Se i toppen av fil - under xmlns =

  Øvrige navnerom - med prefiks:

    gml - geography markup language

    ns2 - xlink

    xsi - XML Schema instans

Hvilke elementer på vannledningsobjektet er merket med gml-navnerom?


<gml:LineString gml:id="id5011" srsName="urn:ogc:def:crs:EPSG::5972" srsDimension="3">
    <gml:posList count="2">250495.0 6735215.0 10.0 250440.0 6735420.0 10.0</gml:posList>
</gml:LineString>

Hvor finner vi gml:Linestring og gml:posList definert?

 

Sjekker navnerom for gml i skjema-dokumentet (xsd-fil):

 

http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0/SOSI_Ledning_Vedlegg1.xsd

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" 
		xmlns:app="http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0" 
		xmlns:gml="http://www.opengis.net/gml/3.2" 
		elementFormDefault="qualified" 
		targetNamespace="http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0" version="1.0">
	<import namespace="http://www.opengis.net/gml/3.2" 
		schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>

<schema xmlns:gml="http://www.opengis.net/gml/3.2" 
        xmlns="http://www.w3.org/2001/XMLSchema" 
        targetNamespace="http://www.opengis.net/gml/3.2" 
        elementFormDefault="qualified" version="3.2.1.2">
<annotation>
<appinfo source="urn:x-ogc:specification:gml:schema-xsd:gml:3.2.1">gml.xsd</appinfo>
<documentation>
GML is an OGC Standard. Copyright (c) 2007,2010 Open Geospatial Consortium. 
To obtain additional rights of use, visit http://www.opengeospatial.org/legal/ .
</documentation>
</annotation>
<!--
 ====================================================================== 
-->
<include schemaLocation="dynamicFeature.xsd"/>
<include schemaLocation="topology.xsd"/>
<include schemaLocation="coverage.xsd"/>
<include schemaLocation="coordinateReferenceSystems.xsd"/>
<include schemaLocation="observation.xsd"/>
<include schemaLocation="temporalReferenceSystems.xsd"/>
<include schemaLocation="deprecatedTypes.xsd"/>
<!--
 ====================================================================== 
-->
</schema>

Hvordan finner vi gml:LineString her?

Topp-nivået på gml navnerom:
http://schemas.opengis.net/gml/3.2.1/gml.xsd

gml:LineString er 1D geometri - vi ser i geometryBasic2D

Fra GML-standard, side 412

gml.xsd

dynamicFeature.xsd

feature.xsd

geometryAggregates.xsd

geometryPrimitives.xsd

geometryBasic2d.xsd

geometryBasic0d1d.xsd

Hierarki i xsd-filer:

<complexType name="LineStringType">
    <complexContent>
        <extension base="gml:AbstractCurveType">
            <sequence>
                <choice>
                    <choice minOccurs="2" maxOccurs="unbounded">
                        <element ref="gml:pos"/>
                        <element ref="gml:pointProperty"/>
                        <element ref="gml:pointRep"/>
                    </choice>
                    <element ref="gml:posList"/>
                    <element ref="gml:coordinates"/>
                </choice>
            </sequence>
        </extension>
    </complexContent>
</complexType>

<element name="LineString" type="gml:LineStringType" substitutionGroup="gml:AbstractCurve">
    <annotation>
        <documentation>
            A LineString is a special curve that consists of a single 
            segment with linear interpolation. It is defined by two or more
            coordinate tuples, with linear interpolation between them. 
            The number of direct positions in the list shall be at least two.
        </documentation>
    </annotation>
</element>

<complexType name="DirectPositionListType">
    <annotation>
        <documentation>
            posList instances (and other instances with the content model specified by 
            DirectPositionListType) hold the coordinates for a sequence of direct positions 
            within the same coordinate reference system (CRS). if no srsName attribute is given, 
            the CRS shall be specified as part of the larger context this geometry element is part of, 
            typically a geometric object like a point, curve, etc. The optional attribute count 
            specifies the number of direct positions in the list. If the attribute count is present 
            then the attribute srsDimension shall be present, too. The number of entries in the list 
            is equal to the product of the dimensionality of the coordinate reference system 
            (i.e. it is a derived value of the coordinate reference system definition) 
            and the number of direct positions.
        </documentation>
    </annotation>
    <simpleContent>
        <extension base="gml:doubleList">
            <attributeGroup ref="gml:SRSReferenceGroup"/>
            <attribute name="count" type="positiveInteger"/>
        </extension>
    </simpleContent>
</complexType>

<element name="posList" type="gml:DirectPositionListType"/>

<?xml version="1.0" encoding="UTF-8"?>
<gml:FeatureCollection 
    xmlns="http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0" 
    xmlns:gml="http://www.opengis.net/gml/3.2" 
    xmlns:ns2="http://www.w3.org/1999/xlink" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    gml:id="SOSI_Ledning_Datasett_eksempel_a" 
    xsi:schemaLocation="http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0
                        http://skjema.geonorge.no/SOSI/produktspesifikasjon/SOSI_Ledning_Vedlegg_1/1.0/SOSI_Ledning_Vedlegg1.xsd">
  <!-- Koordinat-referanse-system EPSG 5972 (ETRS89 / UTM zone 32 + NN2000 height)-->
  <!-- Akserekkefølgen på UTM: 5971-5976 bygger på 25831-36+5941 
       og er east-north-height, enhet er meter -->
  <gml:boundedBy>
    <gml:Envelope srsName="urn:ogc:def:crs:EPSG::5972" srsDimension="3">
      <gml:lowerCorner>250000.0 6735000.0 0.0</gml:lowerCorner>
      <gml:upperCorner>250800.0 6735500.0 3000.0</gml:upperCorner>
    </gml:Envelope>
  </gml:boundedBy>
  <gml:featureMembers>
        .....
    <VA_Vannledning gml:id="VA_Vannledning.id2011">
        .....
    </VA_Vannledning>
  </gml:featureMembers>
</gml:FeatureCollection>

Demo QGIS og FME Universal Viewer

GEO3141 GML

By sverres

GEO3141 GML

  • 1,244