AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth...

21
AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies <[email protected]> CSIRO Earth Science and Resource Engineering Free and Open Source Software for Geospatial Sydney, Australia, 20-23 October 2009 GeoServer application schema support: complex features for the masses

Transcript of AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth...

Page 1: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM

Ben Caradoc-Davies <[email protected]>CSIRO Earth Science and Resource Engineering

Free and Open Source Software for GeospatialSydney, Australia, 20-23 October 2009

GeoServer application schema support: complex features for the masses

Page 2: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

GeoServer

Java servlet for OGC Web Services WMS, WFS, WFS-T, ... Open Source (GPL) Built on GeoTools (LGPL) Reference OGC Web Feature Service

implementation Originally supported only simple features app-schema adds complex feature WFS (only)

Page 3: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Simple Feature

Flat XML representation of one database table

Page 4: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Simple Feature

Type autogenerated by GeoServer All properties in one namespace

Database schema exposed to consumer Meaning implied by element names Semantics often have to be inferred by user

<sf:GSML_MAPPEDFEATURE_SIMPLE gml:id="GSML_MAPPEDFEATURE_SIMPLE.fid-5d4a2c41_12451bfad2f_-7fff"> <sf:SITE_ID>209589</sf:SITE_ID> <sf:GML_NAME>urn:cgi:feature:PIRSA:MappedFeature:209589</sf:GML_NAME> <sf:DESCRIPTION>SEE PLAN 68-611</sf:DESCRIPTION> <sf:OBSERVATION_METHOD>(DISUSED) Map Plot</sf:OBSERVATION_METHOD> <sf:OBSERVATION_METHOD_CODESPACE>urn:cgi:classifierScheme:PIRSA:ObservationMethod</sf:OBSERVATION_METHOD_CODESPACE> <sf:SPECIFICATION_URN>urn:cgi:feature:PIRSA:MineralOccurrence:43deposit</sf:SPECIFICATION_URN> <sf:LOCATION> <gml:Point srsName="urn:x-ogc:def:crs:EPSG:4283"> <gml:pos>-26.8760644 133.0181594</gml:pos> </gml:Point> </sf:LOCATION> <sf:POS_ACC>urn:ogc:def:nil:OGC::missing</sf:POS_ACC> <sf:POS_ACC_UOM>http://urn.opengis.net/</sf:POS_ACC_UOM></sf:GSML_MAPPEDFEATURE_SIMPLE>

Page 5: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Complex Feature

Nested XML representation of multiple related database tables

Page 6: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Complex Feature

Represents object relationships Types defined in GML application schema Meaning specified in community-agreed

information standard

<gsml:MappedFeature gml:id="gsml.mappedfeature.209589"> <gml:description>SEE PLAN 68-611</gml:description> <gml:name codeSpace="http://services.auscope.org/pirsa-earthresource/wfs">urn:cgi:feature:PIRSA:MappedFeature:209589</gml:name> <gsml:observationMethod> <gsml:CGI_TermValue> <gsml:value codeSpace="urn:cgi:classifierScheme:PIRSA:ObservationMethod">(DISUSED) Map Plot</gsml:value> </gsml:CGI_TermValue> </gsml:observationMethod> <gsml:positionalAccuracy> <gsml:CGI_TermValue> <gsml:value codeSpace="http://urn.opengis.net/">urn:ogc:def:nil:OGC::missing</gsml:value> </gsml:CGI_TermValue> </gsml:positionalAccuracy> <gsml:samplingFrame xlink:href="urn:cgi:feature:CGI:EarthNaturalSurface" /> <gsml:specification xlink:href="urn:cgi:feature:PIRSA:MineralOccurrence:43deposit" /> <gsml:shape> <gml:Point> <gml:pos>133.0181594 -26.8760644</gml:pos> </gml:Point> </gsml:shape></gsml:MappedFeature>

Page 7: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Why Complex Features?

Simple features: Represent database table as XML Interoperability through simplicity

Complex features: GML application schema defines complex types Represent object relationships Polymorphism, aggregation, inheritance Extensible information model Scales to large problems and communities

Page 8: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

GML Application Schema Examples

GeoSciML: a GML application schema for the exchange of geoscience data

http://www.geosciml.org/

EarthResourceML extends GeoSciML http://www.earthresourceml.org/

Observations and Measurements SensorML CityML

Page 9: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Example: AuScope Discovery Portal

Three Australian jurisdictions: Victoria (GSV) – deegree Tasmania (MRT) – GeoServer app-schema South Australia (PIRSA) – GeoServer app-schema

(hosted by CSIRO) EarthResourceML (derived from GeoSciML) Interoperability through complex feature types

defined in a GML application schema Community-agreed information standard

Page 10: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

http://portal.auscope.org/

Page 11: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

History of GeoServer app-schema

2005-2007: GeoServer community-schemas Rob Atkinson, Gabriel Roldán Geochemistry roadshow (CSIRO) Fork of a branch (not dead, just sleeping) Informed GeoAPI and GeoTools development

2008: ported to trunk by AuScope Renamed Geoserver app-schema

Now: plugin for GeoServer 2.0-beta2 and later

Page 12: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

How app-schema works

Built on GeoTools data stores Maps simple features into complex features Works both ways, so supports queries

Page 13: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Installation and Configuration

app-schema plugin for vanilla GeoServer Can coexist with simple feature types

Configure by hand-editing XML mapping files Driven by GML application schema

Define schema URL in mapping file Feature chaining:

Define feature types separately and use as properties of each other

Page 14: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Mapping File

Defines mappings: From: column in database To: XPath in encoded XML

Use CQL expressions Set XML attributes<AttributeMapping> <targetAttribute>gsml:observationMethod/gsml:CGI_TermValue/gsml:value</targetAttribute> <sourceExpression> <OCQL>OBSERVATION_METHOD</OCQL> </sourceExpression> <ClientProperty> <name>codeSpace</name> <value>OBSERVATION_METHOD_CODESPACE</value> </ClientProperty></AttributeMapping>

Page 15: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Feature Chaining

Define feature types separately Use features as properties of each other Simplifies configuration Equivalent to a foreign key reference

<AttributeMapping> <targetAttribute>gsml:occurrence</targetAttribute> <sourceExpression> <OCQL>OCCURRENCE_URN</OCQL> <linkElement>gsml:MappedFeature</linkElement> <linkField>gml:name</linkField> </sourceExpression></AttributeMapping>

Page 16: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Strengths

No XSLT programming Configurable through straightforward mapping Uses existing GeoTools/GeoServer

components JDBC data sources: PostGIS, Oracle, ArcSDE Shapefiles, property files Good performance Strong developer community and user base

Aids adoption of GML application schemas

Page 17: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Weaknesses

No XSLT programming No data-driven polymorphism

Type of each property fixed at mapping time No configuration web interface

Hand-edit XML files Tedious and error-prone Requires knowledge of application schema Requires understanding of GML encoding rules

Page 18: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Future Work

Support for data-driven polymorphism Configuration web interface

Aid navigation of GML application schema

Page 19: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Conclusion

Complex feature types: Defined in a GML application schema Represent object relationships Extensible information model Community-agreed information standard

GeoServer app-schema plugin: Reuses existing community-supported components Configured with XML mapping files Maps simple features into complex features

Page 20: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Resources

GeoServer User Manual: Application Schema Support http://docs.geoserver.org/trunk/en/user/data/app-schema/

Application Schema Support: Tutorial http://docs.geoserver.org/trunk/en/user/data/app-schema/tutorial.html

GeoServer app-schema development https://www.seegrid.csiro.au/twiki/bin/view/Infosrvices/GeoserverDevelopment

PIRSA EarthResource GeoServer https://twiki.auscope.org/twiki/bin/view/Grid/PirsaEarthResourceGeoserver

AuScope Discovery Portal http://portal.auscope.org/

Page 21: AN ORGANISATION FOR A NATIONAL EARTH SCIENCE INFRASTRUCTURE PROGRAM Ben Caradoc-Davies CSIRO Earth Science and Resource Engineering Free and Open Source.

Credits

Rini Angreani, co-maintainer of app-schema and author of app-schema feature chaining.

Rob Atkinson, Gabriel Roldán, Jody Garnett, Justin Deoliveira, and the rest of the GeoTools and GeoServer communities.

Simon Cox, and the rest of the GeoSciML community. CSIRO is Australia's national science agency. AuScope Ltd is funded under the National Collaborative

Research Infrastructure Strategy (NCRIS), an Australian Commonwealth Government Programme.