Home

Cookbook 5: How To Serve a GeoSciML Version 3.2

image

Contents

1. lt ClientProperty gt lt name gt xlink href lt name gt lt value gt cgi_ lithology uri lt value gt lt Cl ientProperty gt lt ClientProperty gt lt name gt xlink title lt name gt lt value gt cgi_lithology label lt value gt lt ClientProperty gt lt AttributeMapping gt e This mapping leaves the content of the gsmlem lithology element empty but sets an xlink href attribute to the value of the cgi_ lithology uri column and an xlink title attribute to the value of the cgi lithology label column Note also that in this case the property attributes being set are nested two levels below the parent gsmlgu CompositionPart e As can be seen from this example multiple ClientProperty mappings can be set This would generate output like lt gsmlem lithology xlink href http resource geosciml org classifier cgi lithology clastic mudstone xlink title Mudstone gt Feature chaining4 In feature chaining one feature type is used as a property of an enclosing feature type by value or by reference The following examples show the parts of the gsml_ MappedFeature xml and gsmlgu_GeologicUnit xml mapping files that put the gsmligu GeologicFeature elements inside the gsml specification properties of gsml MappedFeature elements Ingsml MappedFeature xml lt AttributeMapping gt lt targetAttribute gt gsml specification lt targetAttribute gt lt sourceExpression gt lt OCQL gt lex rcs lt OCQL gt
2. OneGeology grant select on table gbr bgs_ 625k uk_625k geol_ unit _comp_part to ows reader If you have problems with the above steps which are difficult to resolve you may find that setting log statement all in postgresql conf reloading the server and then monitoring the log file is helpful for debugging them Configuring GeoServer WE Ga Download the example configuration files from ftp ftp bgs ac uk pubload OneGeology gbr_bgs_625k_wfs data_625k_cgi zip and expand it to a spare location on your server Copy the files from this expanded directory to the matching locations in your GeoServer data directory overwriting any files that already exist there The main configuration files are inside the workspaces directory these shouldn t exist in your installation except for the default xm1 file which simply defines the example gsml MappedFeature to be the default The files global xml wfs xml at the top level of the directory contain service metadata relevant to the example data set When you set up your own data you will use the web GUI to change these values The contents of the demo directory are some example requests which are documented below Copy the file ftp bgs ac uk pubload OneGeology INSPIREWFS app schema properties to WEB INF classes app schema properties and edit the database connection parameters appropriately for wherever your installation of PostgreSQL is running If you want to use a JNDI data co
3. lt linkElement gt gsmlgu GeologicUnit lt linkElement gt lt linkField gt FEATURE_ LINK lt linkField gt lt sourceExpression gt lt AttributeMapping gt Implementing a OneGeology WFS 29 OneGeology In gsmlgu_GeologicUnit xml lt AttributeMapping gt lt targetAttribute gt FEATURE LINK lt targetAttribute gt lt sourceExpression gt lt 0CQL gt lex_rces lt 0CQL gt lt sourceExpression gt lt AttributeMapping gt e Inthis case from the mapping for gsml MappedFeature we specify a mapping for its gsml specification property e The linkElement specifies which feature or other complex type should be used as the value of the property e The link specification field of the source gsml_ MappedFeature simple feature is use as the foreign key which maps to the special FEATURE LINK field in each gsm1 GeologicFeature e The mapping of the special FEATURE LINK attribute in gsmlgu_GeologicFeature xml to the foreign key field of the underlying table means that every gsmlgu GeologicFeature with lex rcs equal to the lex rcs of the gsml MappedFeature under construction is included as a gsml specification property of the gsml MappedFeature by value Feature chaining has been used to construct the property gsml specification of gsml MappedFeature This property is a gsmlgu GeologicUnit The WFS response for gsml MappedFeature combines the output of both
4. Most mappings consist of a target and source Here is a simple property with a text value from gsmlgu_GeologicUnit xml lt AttributeMapping gt lt targetAttribute gt gml description lt targetAttribute gt lt sourceExpression gt lt OCQL gt description lt OCQL gt lt sourceExpression gt lt AttributeMapping gt e inthis case the value of gm1 description is just the value of the description column in the uk 625k geol unit table e For a database the field name is the name of the column the table view is set in sourceType above Database identifiers must be lowercase for PostGIS or uppercase for Oracle Spatial e CQL expressions can be used to calculate content Use caution because queries on CQL calculated values prevent the construction of efficient SQL queries e Source expressions can be CQL literals which are single quoted The above would generate output like lt gml description gt STRATHCLYDE GROUP SEDIMENTARY ROCK CYCLES STRATHCLYDE GROUP TYPE lt gml description gt Client properties In addition to the element content a mapping can set values of XML attributes on property elements These are called client properties in GeoServer terminology Here is one from gsmlgu_CompositionPart xml lt AttributeMapping gt Implementing a OneGeology WFS 28 OneGeology lt targetAttribute gt gsmlgu material gsmlem RockMaterial gsmlem lithology lt targ etAttribute gt
5. dbtype gt app schema lt entry gt lt connectionParameters gt lt dataStore gt Note Ensure that there is no whitespace inside an entry element For other feature types the pattern is the same where you replace the names and ids appropriately and change the namespace if necessary The url entry is a file URI pointing to the location of the mapping file relative to the GeoServer data directory The dbtype entry will always be app schema to define complex feature types Mapping files Configuration of app schema feature types is performed in mapping files e g e workspaces gsmlgu gsmlgu_ GeologicUnit gsmlgu_ GeologicUnit xml e workspaces gsml gsml_ MappedFeature gsml MappedFeature xml Namespaces9 Each mapping file contains namespace prefix definitions The below extract is from gsml_ MappedFeature xml lt namespaces gt lt Namespace gt lt prefix gt gml lt prefix gt lt uri gt http www opengis net gml 3 2 lt uri gt lt Namespace gt lt Namespace gt lt prefix gt gsml lt prefix gt lt uri gt http xmins geosciml org GeoSciML Core 3 2 lt uri gt lt Namespace gt lt Namespace gt lt prefix gt gsmlgu lt prefix gt lt uri gt http xmlns geosciml org GeologicUnit 3 2 lt uri gt lt Namespace gt lt Namespace gt lt prefix gt gsmlgs lt prefix gt lt uri gt http xmlns geosciml org GeologicStructure 3 2 lt uri gt lt Namespace gt lt Namespace gt Implementing a OneGeology WFS 24 OneGeolo
6. 4289999997 lt gml lowerCorner gt lt gml upperCorner gt 281182 8969999998 696298 8440000011 lt gml upperCorner gt lt gml Envelope gt lt gml boundedBy gt SS EE lt gsml shape gt Sh ee lt gsml shape gt lt gsml specification gt lt gsmlgu GeologicUnit gml id CKN CYCC gt lt gml description gt CLACKMANNAN GROUP SEDIMENTARY ROCK CYCL CLACKMANNAN GROUP TYPE lt gml description gt ee Ka Wei lt gsmlgu GeologicUnit gt lt gsml specification gt lt gsml metadata xsi nil true gco nilReason missing gt lt gsml MappedFeature gt lt wfis member gt lt wfs member gt lt gsml MappedFeature gml id bgsn_digmap20111213000016262 625k gt lt gml boundedBy gt lt gml Envelope srsDimension 2 srsName urn ogc def crs EPSG 27700 gt lt gml lowerCorner gt 273924 59599999984 687632 7340000008 lt gml1 lowerCorner gt lt gml upperCorner gt 276292 57699999935 690639 8490000011 lt gml upperCorner gt lt gml Envelope gt lt gml boundedBy gt see 356 gt lt gsml shape gt SS ee lt gsml shape gt lt gsml specification xlink href SYG CYCS gt lt gsml metadata xsi nil true gco nilReason missing gt lt gsml MappedFeature gt lt wis member gt lt wfs member gt lt gsml MappedFeature gml id bgsn_digmap20111213000016481 625k gt lt gml boundedBy gt lt gml Envelope srsDimension 2 srsName urn ogc def crs EPSG 27700 gt lt gml l
7. B alpha 3 code for English TG Requirement 574 If a client request specifies an unsupported language or the parameter is absent in the request the above fields Title Abstract shall be provided in the service default language The response to the following request specifying the unsupported Finnish language is in English http localhost 8080 geoserver ows service wfs amp version 2 0 0 amp request GetCapabilities amp language fin amp TG Requirement 584 The Extended Capabilities shall indicate the response language used for the GetCapabilities Response Depending on the requested language the value of the lt inspire_common ResponseLanguage gt corresponds to the current used language If a supported language was requested lt inspire_ common ResponseLanguage gt shall correspond to that requested language If an unsupported language was requested or if no specific language was requested lt inspire_common ResponseLanguage gt shall correspond to the service default language lt inspire_common DefaultLanguage gt This is illustrated by the fragment shown under requirement 54 TG Requirement 594 The Extended Capabilities shall contain the list of supported languages indicated in lt inspire_common SupportedLanguages gt This list of supported languages shall consist of 1 exactly one element lt inspire_common DefaultLanguage gt indicating the service default language and 2 zero or more elements lt inspire_common SupportedL
8. Java tab you can put a maximum memory value such as 256 MB in the Maximum Memory pool field e The first time GeoServer starts with the tutorial configuration it will download all the schema XSD files it needs and store them in the app schema cache folder in the data directory You must be connected to the internet for this to work Complex Feature Test requests When GeoServer is running test app schema WFS in a web browser You can query the six feature types using these links Change localhost 8080 in the examples below if you have deployed it at a different location e http ocalhost 8080 geoserver wfs request GetFeature amp version 2 0 0 amp typeName gsmlI MappedFeature amp count 25 e http ocalhost 8080 geoserver wfs request GetFeature amp version 2 0 0 amp typeName gsmlgu GeologicUnit amp count 25 You can also obtain WFS responses by using the Demo requests page in the GeoServer web interface Note that the web interface does not yet support app schema store for layer administration You can select some of the example age and lithology queries from the request drop down list or put http localhost 8080 geoserver ows into the service URL section and try pasting in your own queries The examples are reproduced below Usemame Remember me C Ai Login GeoServer Demo requests About amp Status Example requests for GeoServer using the TestServlet Select a request from the drop down list and then hit Ch
9. amp request GetFeature amp storedquery_id http inspire ec europa eu operation download GetSpatialDataSet amp DataSetIdCode 13603180 amp DataSetiIdNamespace nhttp data bgs ac uk id dataHolding amp CRS urn ogc def crs EPSG 4326 amp Language eng amp count 20 amp TG Requirement 504 Any possible i e available combinations of CRS DataSetldCode DataSetIdNamespace language shall be made available through pre defined stored queries In the example service there is only one combination of CRS DataSetIDCode DataSetIdNamespace language available and that is illustrated under requirement 49 above TG Recommendation 139 The following identifier should be used to identify the Stored Query for serving pre defined Spatial Data Sets http inspire ec europa eu operation download GetSpatialDataSet This has been implemented as illustrated by the query under requirement 49 above TG Requirement 514 Pre defined Stored Queries shall use the parameter names CRS DataSetldCode DataSetIdNamespace and Language to identify the CRS dataset ID code dataset ID namespace and language components of a query The query shown under requirement 49 above shows the use of these parameters TG Requirement 524 A separate WFS endpoint shall be provided for each INSPIRE dataset thus providing one dataset per GetCapabilities response Currently there is only one dataset in the example service so this is satisfied trivially TG
10. feature types into a single response The first gsml MappedFeature has a gsml specification property value of the gsmlgu GeologicUnit with the same lex rcs code The next time a mapped feature with the same lex rcs code appears rather than including the whole geologic unit inline again the property has an xlink href attribute pointing to the first occurrence The relationships between the feature instances are data driven Portal Age and Lithology Query4 The OneGeology portal has a graphical interface to allow a user to select geological ages or lithologies from a hierarchical list and query a given WFS so that it returns all features with the selected property values within the current viewing window In order to work with this your WFS must include the features and properties and dictionaries required by the query and described in the GeoSciML 3 2 Encoding Cookbook for OneGeology 5 star WFS services Version 1 0 This chapter gives you some example queries which your WFS should support and shows how these are created in the OneGeology portal When you have set up a WFS for OneGeology you will be able to ask for it to be registered against one or more WMS layers that portray the data returned by it possibly styled Implementing a OneGeology WFS 30 OneGeology differently according to different property values If you then select one of those registered WMS layers in the portal and select the Active Layer Properties you will see a dialog
11. gml http www opengis net gml1 3 2 service WFS version 2 0 0 outputFormat application gml xml version 3 2 count 10 gt lt wfs Query typeNames gsml MappedFeature gt lt fes Filter gt lt fes BBOX gt lt fes ValueReference gt gsml shape lt fes ValueReference gt lt gml Envelope gt lt gml lowerCorner gt 1 0 51 0 lt gml lowerCorner gt lt gml upperCorner gt 0 0 52 0 lt gml upperCorner gt lt gml Envelope gt lt fes BBOX gt lt fes Filter gt lt wfs Query gt lt wfs GetFeature gt TG Requirement 639 Implementing a OneGeology WFS 39 OneGeology A Direct Access Download Service shall conform to ISO 19143 Ad hoc Query Conformance Class The age lithology and BBOX queries described in the previous chapter show various examples of different queries in this class TG Requirement 644 A Direct Access Download Service shall conform to ISO 19143 Resource Identification Conformance Class This is illustrated by the query below lt xml version 1 0 encoding UTF 8 gt lt wfs GetFeature xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http www opengis net wfs 2 0 http schemas opengis net wfs 2 0 wfs xsd http www opengis net gml 3 2 http schemas opengis net gml1 3 2 1 gml xsd Eelere xmins xmins xmins gsml http xmins geosciml org GeoSciML Core 3 2 fes http www opengis net fes 2 0 wfs http www opengi
12. gsml_mappedfeature sourced from the table of the same name in the PostGIS database set up in the previous chapter e When working with databases sourceType is the name of a table or view Database identifiers must be lowercase for PostGIS or uppercase for Oracle Spatial e targetElement is the name of the output complex feature type gml id mapping4 The first mapping sets the gm1 id to be the feature id specified in the source property file lt AttributeMapping gt lt targetAttribute gt gsml MappedFeature lt targetAttribute gt lt idExpression gt lt OCQL gt uuid lt OCQL gt lt idExpression gt lt AttributeMapping gt e targetAttribute is the XPath to the element for which the mapping applies in this case the top level feature type e idExpression is a special form that can only be used to set the gml id ona feature In the tutorial database we have a column uuid suitable for use as a gm1 id attribute value If your database doesn t have such a column you may be able to use the special function getId here instead This will synthesise an id mm from the table or view name a dot and the primary key of the table If this is not Implementing a OneGeology WFS 27 OneGeology desirable any other field or CQL expression can be used if it evaluates to an NCName The above would generate output like lt gsml MappedFeature gml id bgsn_ digmap20111213000014089 625k gt Ordinary mappings
13. of Tomcat on your own machine with default settings you should be able to visit http localhost 8080 geoserver and click on the Layer Preview link to check that the example services shipped with GeoServer work Implementing a OneGeology WFS 8 OneGeology properly You will have to modify the preceding URL appropriately if you have deployed GeoServer on a different machine or port lsemame Remember me A ji p GeoServer beme We Welcome About amp Status About GeoServer Welcome This GeoServer belongs to The ancient geographes INC Service Capabilities Data GWC F Layer Preview This GeoServer instance is running version 2 3 1 For more information please contact the 1 0 0 administrator WCS 1 0 0 1 1 0 1 1 2 Demos App schema Plugin Installation e Download and install the app schema plugin geoserver app schema plugin zip following the application schema installation instructions Note the WFS service settings e Check you can restart GeoServer without any errors being thrown INSPIRE Plugin Installationg If you are providing an INSPIRE download service you will need to provide the extra INSPIRE mandated metadata in the WFS GetCapabilities response This is optional for OneGeology e Download and install the INSPIRE plugin geoserver inspire plugin zip following the INSPIRE plugin installation instructions e Check that the WFS 1 1 0 and 2 0 0 GetCapabilities responses contain the ins
14. shape bgsn_digmap20111213000014089 625k srsDimension 2 srsName urn ogc def crs EPSG 27700 gt lt gml surfaceMember gt lt gml Polygon gml id gsml shape bgsn_ digmap20111213000014089 625k 1 srsDimension 2 gt lt gml exterior gt lt gml LinearRing gt lt qmispostasit gt 27 185 ol 29999998 698998 S24 000001 A771 823F 5400000005 693969 0079999991 277654 64600000007 693696 0569999999 ZVI So S OSOS OS ISAS OSS Bi Tas HMOs CISAIO SLOVO 2 Zod IIIS SEI lo EE 276 99270639999996 NG ISiZ02 EELER EE 693566 081000001 277134 9740000011 693839 0320000002 EE ENEE GIAO EE 2775 Sil Zogogers 693998 524000001 lt gml posList gt lt gml LinearRing gt lt gml exterior gt lt gml Polygon gt lt gml surfaceMember gt lt gml MultiSurface gt lt gsml shape gt lt gsml specification gt lt gsmlgu GeologicUnit gml id SYG CYCS gt lt gml description gt STRATHCLYDE GROUP SEDIMENTARY ROCK CYCLES STRATHCLYDE GROUP TYPE lt gml description gt SE ea ee lt gsmlgu GeologicUnit gt Implementing a OneGeology WFS 19 OneGeology lt gsml specification gt lt gsml metadata xsi nil true gco nilReason missing gt lt gsml MappedFeature gt lt wfis member gt lt wfs member gt lt gsml MappedFeature gml id bgsn_digmap20111213000015084 625k gt lt gml boundedBy gt lt gml Envelope srsDimension 2 srsName urn ogc def crs EPSG 27700 gt lt gml lowerCorner gt 280207 97299999953 694960
15. want to check the Working with Databases section of the GeoServer manual to see if your database is supported by GeoServer and follow the instructions for installation of any extensions that may be needed for this support PostGIS support is built into the core GeoServer download If you want to try the example data or don t have a supported database system you should install PostGIS The PostGIS Installation page contains instructions on how to do this for different operating systems For the purposes of testing this cookbook setup we used the Enterprise DB Windows Installer which installs the base PostgreSQL database has an Implementing a OneGeology WFS 7 OneGeology option to install the PostGIS extension into this and also includes the pgAdmin graphical database administration tool You may use a database on the same machine as GeoServer or you can have it ona separate machine which is accessible over a network from your GeoServer machine GeoServer 4 GeoServer has extensive documentation which you should refer to in addition to this cookbook References will be made to relevant parts rather than repeating too much of what is already there There is also a the geoserver users mailing list Assumptions9 You will need to have Java installed on the machine on which you are going to install GeoServer The GeoServer manual recommends Oracle JRE 6 or later but at the time of writing March 2014 GeoServer was not fully tested with Or
16. wfs xsd http www opengis net gml 3 2 http schemas opengis net gml1 3 2 1 gml xsd xmlns gsml http xmlins geosciml org GeoSciML Core 3 2 xmlns gsmlgu http xmlns geosciml org GeologicUnit 3 2 xmlns gsmlga http xmlns geosciml org GeologicAge 3 2 xmlns fes http www opengis net fes 2 0 xmlns wfs http www opengis net wfs 2 0 xmlns gml http www opengis net gml1 3 2 xmlns xlink http www w3 org 1999 xlink count 10 service WFS version 2 0 0 outputFormat application gml xml version 3 2 gt lt wfs Query typeNames gsml MappedFeature gt lt fes Filter gt lt fes Or gt lt fes PropertylIsEqualTo gt lt fes ValueReference gt gsml specification gsmlgu GeologicUnit gsml relatedFeat ure gsmlga GeologicHistory gsml relatedFeature gsmlga GeologicEvent gsmlga youngerNamedAge xlink href lt fes ValueReference gt lt fes Literal gt http resource geosciml org classifier ics ischart LowerDevon ian lt fes Literal gt lt fes PropertylIsEqualTo gt lt fes PropertylsEqualTo gt lt fes ValueReference gt gsml specification gsmlgu GeologicUnit gsml relatedFeat ure gsmlga GeologicHistory gsml relatedFeature gsmlga GeologicEvent gsmlga youngerNamedAge xlink href lt fes ValueReference gt lt fes Literal gt http resource geosciml org classifier ics ischart Emsian lt fe s Literal gt lt fes PropertylsEqualTo gt lt fes Pro
17. 2 xmlns gsmlga http xmlns geosciml org GeologicAge 3 2 xmlns fes http www opengis net fes 2 0 xmlns wfs http www opengis net wfs 2 0 xmlns gml http www opengis net gml1 3 2 xmlns xlink http www w3 org 1999 xlink count 10 service WFS version 2 0 0 outputFormat application gml xml version 3 2 gt lt wfs Query typeNames gsml MappedFeature gt lt fes Filter gt lt fes Or gt lt fes PropertylsEqualTo gt lt fes ValueReference gt gsml specification gsmlgu GeologicUnit gsmlgu compositi on gsmlgu CompositionPart gsmlgu material gsmlem RockMaterial gsmlem lithol ogy xlink href lt fes ValueReference gt lt fes Literal gt http resource geosciml org classifier cgi lithology limeston e lt fes Literal gt lt fes PropertylsEqualTo gt lt fes PropertylsEqualTo gt lt fes ValueReference gt gsml specification gsmlgu GeologicUnit gsmlgu compositi on gsmlgu CompositionPart gsmlgu material gsmlem RockMaterial gsmlem 1lithol ogy xlink href lt fes ValueReference gt Implementing a OneGeology WFS 14 OneGeology lt fes Literal gt http resource geosciml org classifier cgi lithology chalk lt f es Literal gt lt fes PropertylsEqualTo gt lt fes PropertylsEqualTo gt lt fes ValueReference gt gsml specification gsmlgu GeologicUnit gsmlgu compositi on gsmlgu CompositionPart gsmlgu material gsmlem RockMaterial gsmlem 1lithol o
18. Cookbook 5 How To Serve a GeoSciML Version 3 2 Web Feature Service WFS Using Geoserver Version 1 0 OneGeology DOCUMENT CONTROL Change Summary Version Date 1 0 25t April 2014 Author Editor Marcus Sen Change Summary Implementing a OneGeology WFS OneGeology Contents Introduction Mean meen mee meester rete ene e E re a eee er eee 4 Pre requisites System REQUIFeMeNtS ssccsscsssccssentscesscsscascesssceosoossecssessncssecssessenssnenssanensrecsate 4 PVE E 5 Installation GT SEET 7 Database E 7 E ote TE a EEEE EEEE E A EEE E E E 8 Example Data and 90 9 Loading example PostGIS dataf oesensnesnesseesssrsnesnorssreneenerrsntsesrennsnonssteseenenrsnesserenesnenees 10 Configuring GeoServer E 11 INSPIRE Extended Capabilities EE 16 INSPIRE Pre defined Dataset Download 17 Complex Febuar erennere ett 18 SEELEN 21 Data directory E 21 WSIS pac e 22 datastore XM E 23 lie LSS E 24 Bereldeng 30 INSPIRE Conformance ecnin GER 33 Pre defined Dataset Download 33 Direct ACCESS Bomrdoergt eeett eege ii E A RE 38 Implementing a OneGeology WFS iii OneGeology Introductiong This guidance describes how to set up a web service server using free and open source Geoserver software to provide a OneGeology compliant ISO OGC Web Feature Service WFS version 2 0 serving GeoSciML v3 2 as described in OneGeology Cookbook 4 GeoSciML 3 2 Encoding Cookbook for OneGeology 5 star WFS services Version 1 0 Whils
19. Requirement 534 INSPIRE Metadata for the Download Service shall EITHER be linked to via an lt inspire_common MetadataURL gt in an extended capabilities section OR the extended capabilities section shall contain all the INSPIRE Metadata for the Download Service in accordance with Table 4 and the inspire_dis ExtendedCapabilities schema Implementing a OneGeology WFS 35 OneGeology The example service uses the inspire_common MetadataURL element as shown below This has a dummy URL as the example isn t a real service and so it isn t registered in a metadata catalogue The INSPIRE plugin GUI described in the previous chapter only allows setting a MetadataURL If you wanted to include all the INSPIRE metadata inside the extended capabilities section itself then you would need to manually edit the xxx file lt inspire common MetadataUrl xsi type inspire common resourceLocatorType gt lt inspire common URL gt http metadata bgs ac uk geonetwork srv en csw SERVICE CSW RE OW HSM Cenc conc yale sl Maorien cue OmOCmenecrne cmmnciacirs lementSetName full OutputSchema http www isotc211 org 2005 gmd amp lt inspire common URL lt inspire common MediaType gt application vnd ogc csw GetRecordByIdResponse_ xml lt inspire common MediaType gt lt inspire common MetadataUrl1 gt TG Requirement 544 A network service Download Service metadata response shall contain a list of the natural la
20. acle JRE 7 While testing the example for this document we used Oracle JRE 7 without apparent problems Some people have successfully run it with non Oracle versions of Java but these aren t supported and you may need to do extra work and be prepared to enter into technical discussions on the geoserver users email list in order to get it working with these Ideally you will be familiar with deploying applications in a servlet container application such as Apache Tomcat or Jetty If not however you can use one of the all in one installers to install a stand alone version of GeoServer Also note that Tomcat and Jetty are the two most tested serviet containers used with GeoServer so although you may well be able to use others there may be extra work involved and you may need to get advice from the geoserver users email list Basic Installationg e Download and install GeoServer following whichever one of the installation paths in the GeoServer manual suits your situation best If you already have a servlet container application such as Apache Tomcat set up or you are familiar with how to set one up then you will probably wish to download the web archive WAR and deploy that in your servlet container If you are not comfortable with configuring a serviet container then you will probably wish to use one of the installer programs e Run GeoServer at least once to check the installation has worked If for example you are testing in a local instance
21. and passwords outside of the GeoServer data directory so that the latter can be copied freely The Property Interpolation section of the GeoServer manual contains more information on how properties can be set and used in other parts of the configuration files In the reference configuration files this contains database connection parameters some commonly used URI values and the setting to turn on joining In fact with current versions of GeoServer certainly pre dating v2 4 5 joining is turned on by default and is the recommended setting There may be some limited situations as described in the joining documentation however when you need to switch this off Data directory4 Implementing a OneGeology WFS 21 OneGeology The example configuration files contain a complete GeoServer data directory so that you can get a working service to try out up and running as quickly as possible The parts relevant for configuration of a complex feature WFS are contained in the workspaces directory described in the next section The other parts contain items like service metadata security etc and can mostly be set up using the web interface Thus when you come to set up your own service you will probably start with the default GeoServer data directory configure service metadata etc in the web interface and copy the complex feature configuration files from the reference data workspaces directory to your own data directory for editing there Workspace la
22. ange This will S i About GeoServer display the request url and body if an xml request Hit submit to send the request to GeoServer Data 4 Request Choose One MS Layer Preview URL http localhost 8080 geoserver ows Demos C Bz 12pt r lt wis GetFeature xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http www opengis net wfs 2 0 http schemas opengis net wfs 2 0 wfs xsd http www opengis net gml 3 2 http schemas opengis net gml 3 2 1 gml xsd xmlns gsml http xmlns geosciml org GeoSciML Core 3 1 xmlns gsmlgu http xmlns geosciml org GeologicUnit 3 1 xmlns gsmlga http xmlns geosciml o ologicAge 3 1 umins fes http www opengis net fes amlns wis http www opengis net wis 0 xmlns gml http www opengis net gml 3 2 amlns xlink http www w3 org 1999 xlink count 10 service WFS version 2 0 0 outputFormat application gml xml version 3 2 gt lt wis Query typeNames gsml MappedFeature gt lt fes Filter gt W Body Implementing a OneGeology WFS 12 OneGeology A query for mapped features showing outcrops of geologic units of a particular age NES getFeaturelGAge xml lt xml version 1 0 encoding UTF 8 gt lt wfs GetFeature xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation ht ttp www opengis net wfs 2 0 http schemas opengis net wfs 2 0
23. anguage gt to indicate Implementing a OneGeology WFS 37 OneGeology all additional supported languages Regardless of the response language the list of supported languages is invariant for each GetCapabilities Response This is illustrated by the fragment shown under requirement 54 TG Requirement 604 The Extended Capabilities shall use the XML Schema as defined in the INSPIRE online schema repository The example service declares the above schema in the schemaLocation attribute of the GetCapabilities response as shown below and the response document validates according to the Schema xsi schemaLocation http www opengis net wfs 2 0 http schemas opengis net wfs 2 0 wfs xsd http inspire ec europa eu schemas common 1 0 http inspire ec europa eu schemas common 1 0 common xsd Pre A AMASOIL ee eu Slovenes inopire dle http inspire ec ceuropa eu schemas inspire dls 1 0 inspire dls xsd TG Recommendation 149 For further language support for other operations it is recommended to replace the operation online resources in each language specific GetCapabilities Response by a specific operation online resource for that language To support the additional operation online resources the service shall listen at the language specific operation end points to distinguish for the requested languages The example service does not implement this recommendation as it doesn t support more than one language anyway TG Recommend
24. ation 159 The support of IETF RFC 4646 is recommended wherever the support of ISO 639 B alpha3 for languages infringes the conformity with the standard used for implementing the INS NS think this doesn t apply to any INSPIRE service as yet as there is no language support defined in current OGC standards applying to WFS Direct Access Download 4 Implementing a OneGeology WFS 38 OneGeology TG Requirement 614 Implementations shall meet TG Requirement 48 conformance to ISO 19142 HTTP GET conformance class and TG Requirement 52 one endpoint for each INSPIRE dataset This is covered under requirements 48 and 52 above TG Requirement 624 Implementations shall conform to ISO 19142 Conformance Class Basic WFS The comments under requirement 46 in fact also apply to this requirement A illustration of a query showing GetFeature with a Query element which is part of the Basic WFS conformance class but not the Simple WFS conformance class would be the BBOX query below lt xml version 1 0 encoding UTF 8 gt lt wfs GetFeature xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http www opengis net wfs 2 0 http schemas opengis net wfs 2 0 wfs xsd http www opengis net gml 3 2 http schemas opengis net gml 3 2 1 gml xsd xmlns gsml http xmlns geosciml org GeoSciML Core 3 2 xmlns fes http www opengis net fes 2 0 xmlns wfs http www opengis net wfs 2 0 xmlns
25. ature xml The AppSchemaDataAccess xsd file isn t used for the configuration it is just provided as a convenience when you are editing a mapping file such as gsm1_MappedFeature xml to allow a validating XML editor to give you hints that you have the structure of the file correct The following sections will describe the datastore xml1 file which creates an application schema data store and specifies the mapping file described in the section after which contains the substantive portion of the configuration mapping source data fields to output in the complex feature types datastore xmlq Each data store configuration file datastore xml specifies the location of a mapping file and triggers its loading as an app schema data source This file should not be confused with the source data store which is specified inside the mapping file For gsml MappedFeature the file is workspaces gsml gsml_ MappedFeature datastore xml lt dataStore gt lt id gt gsml_MappedFeature_ datastore lt id gt lt name gt gsml_MappedFeature lt name gt lt enabled gt true lt enabled gt lt workspace gt lt id gt gsml_workspace lt id gt lt workspace gt lt connectionParameters gt lt entry key namespace gt http xmlns geosciml org GeoSciML Core 3 2 lt entry gt Implementing a OneGeology WFS 23 OneGeology lt entry key url gt file workspaces gsml gsml_MappedFeature gsml MappedFeature xml lt e ntry gt lt entry key
26. box like below Active Layers Properties Automatically display layers depending on scale and location H Ca GBR BGS 1 625k Bedrock Age If you expand the layer description by clicking on the down arrow at the right you should see buttons for GeoSciML WFS URL and Thematic Analysis at the bottom Legend Data URL Metadata URL Service URL GeoSciML WFS URL Thematic Analysis l Clicking on the Thematic Analysis button will bring a choice of Full Statistics or Lithology Statistics Thematic analysis We will cover the Full Statistics option first and then the Lithology Statistics The Full Statistics option brings up a dialog with collapsible hierarchical lists of geological age and lithology terms from the CGI dictionaries You can select a number of age values or lithology values or combinations of these Features satisfying any of the lithology terms and any of the age terms selected will be retrieved if no age or lithology terms are selected then the features are not filtered on that property By default if you select a term that has sub categories represented by a folder icon then all the sub categories will also be selected This will usually be what you want but you can unselect these afterwards if you wish Implementing a OneGeology WFS 31 OneGeology Thematic analysis Filter by lithology Filter by age EC Carbonate mudstone IS Carbonate wackestone D E crystalline carbona
27. e Class Simple WFS The GetCapabilities response from the service includes the declaration lt ows Constraint name ImplementsBasicWFS gt lt ows NoValues gt lt ows DefaultValue gt TRUE lt ows DefaultValue gt lt ows Constraint gt and the WFS 2 0 0 standard states that conforming to the Basic WFS class means also implementing the Simple WFS conformance class Running the OGC CITE tests that check for conformance to the standards is part of the GeoServer build process This doesn t guarantee full conformance especially as not all the same tests may be run against app schema Apart from the queries getting information about what the service holds like GetCapabilities DescribeFeatureType ListStoredQueries and DescribeStoredQueries this conformance class requires that the server at least implements a GetFeature request with the WFS 2 0 0 standard query to get a feature using its id as shown by the example request below http localhost 8080 geoserver ows service wfs amp version 2 0 0 amp request GetFeature amp storedquery_id urn ogc def query 0GC WFS GetFeatureByld amp id mf 1 amp Note Implementing a OneGeology WFS 33 OneGeology At the time of writing Dec 2013 there seems to be a bug so that the above query doesn t actually work See bug report GEOS 6233 TG Requirement 474 Implementations shall conform to ISO 19143 Conformance Class Query We can send a query using the wfs Query element such a
28. e actual MIME type of your metadata resource you will need to work around this by manually editing the wfs xml file inside the GeoServer data directory as documented in issue GEOS 5157 On the other hand it isn t clear whether any client would actually use this information For example entering the values shown in the screenshot below would result in a GetCapabilities response with the ExtendedCapabilities section shown below it Implementing a OneGeology WFS 16 OneGeology INSPIRE Language eng x Service Metadata URL http metadata bgs ac uk geonetwork srv en csw SE Service Metadata Type CSW GetRecord by ID request Spatial Dataset Identifiers Code Namespace 9df8df51 6342 37a8 e044 0003ba9b0d98 Add identifier lt ows ExtendedCapabilities gt lt inspire dis Extended apabilaties gt lt inspire common MetadataUrl XS1 type in epice EE EISE EES EE are lt inspire_common URL gt Remove http metadata bgs ac uk geonetwork srv en csw SERVICE CSW amp amp R EQU EST Get RecordById amp amp elementSetName full amp OutputSchema http www isotc211 org 2005 gmd amp amp ID 7822e848 822d 45a5 8584 56d352fd2170 amp lt inspire common URL gt lt inspire_ common MediaType gt application vnd ogc csw GetRecordByIdResponse xml lt inspire common MediaType gt lt inspire common MetadataUrl gt lt inspire common SupportedLanguages xSi type inspire common
29. gy lt prefix gt swe lt prefix gt lt uri gt http www opengis net swe 2 0 lt uri gt lt Namespace gt lt Namespace gt lt prefix gt gmd lt prefix gt lt uri gt http www isotc211 0org 2005 gmd lt uri gt lt Namespace gt lt Namespace gt lt prefix gt gco lt prefix gt lt uri gt http www isotc211 0org 2005 gco lt uri gt lt Namespace gt lt Namespace gt lt prefix gt xlink lt prefix gt lt uri gt http www w3 org 1999 xlink lt uri gt lt Namespace gt lt Namespace gt lt prefix gt xsi lt prefix gt lt uri gt http www w3 org 2001 XMLSchema instance lt uri gt lt Namespace gt lt namespaces gt Only those namespace prefixes used in the mapping file need to be declared although you may find it easier just to put all the namespaces used by GeoSciML in all of them Source data store The data for this tutorial is contained in the PostGIS database set up in the previous section For this example each feature type uses an identical source data store configuration The Parameter elements contain values for various database connection parameters Here we are using property interpolation so that these don t have to get changed in each mapping file if they change and so that the configuration files can be shared without exposing password information The values of the interpolated variables which have the form name should be defined in the WEB INF classes app schema properties file An example wh
30. gy xlink href lt fes ValueReference gt lt fes Literal gt http resource geosciml org classifier cgi lithology traverti ne lt fes Literal gt lt fes PropertylsEqualTo gt lt fes Or gt lt fes Filter gt lt wfs Query gt lt wfs GetFeature gt A bounding box query to retrieve mapped features with shapes that overlap the specified bounding box WFS_getFeatureBBOX xml lt xml version 1 0 encoding UTF 8 gt lt GetFeature xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http www opengis net wfs 2 0 http schemas opengis net wfs 2 0 wfs xsd http www opengis net gml 3 2 http schemas opengis net gml1 3 2 1 gml xsd xmlns http www opengis net wfs 2 0 xmlns gsml http xmlns geosciml org GeoSciML Core 3 2 xmlns fes http www opengis net fes 2 0 xmlns xlink http www w3 org 1999 xlink xmlns gml http www opengis net gml1 3 2 version 2 0 0 service WFS count 100 gt lt Query typeNames gsml MappedFeature srsName urn ogc def crs EPSG 4326 gt lt fes Filter gt lt fes BBOX gt lt fes ValueReference gt gsml shape lt fes ValueReference gt lt gml Envelope srsName urn ogc def crs EPSG 4326 gt lt gml lowerCorner gt 56 08643859340388 4 0004826736994445 lt gml1 lowerCorner gt lt gml upperCorner gt 56 165510496146474 3 8381055732299343 lt gml upperCorner gt lt gml Envelope gt lt fes BBOX gt lt fes Filter g
31. ich you can use as a template to fill in with your own values is at ftp ftp bgs ac uk pubload OneGeology INSPIREWFS app schema properties lt sourceDatastores gt Dalbasitone gt lt id gt datastore lt id gt lt parameters gt Parame tsr lt name gt dbtype lt name gt lt value gt cgi dbtype lt value gt lt Parameter gt lee SE EE lt name gt jndiReferenceName lt name gt lt value gt cgi jndi lt value gt Implementing a OneGeology WFS 25 OneGeology lt Parameter gt EE lt Parameter z lt name gt host lt name gt lt value gt cgi host lt value gt lt Parameter gt lt Parameter gt lt name gt port lt name gt lt value gt cgi port lt value gt lt Parameter gt Parameter lt name gt database lt name gt lt value gt cgi database lt value gt lt Parameter gt lt Pabametrer gt lt name gt user lt name gt lt value gt cgi user lt value gt lt Parameter gt lt Pabamneren lt name gt passwd lt name gt lt value gt S cgi passwd lt value gt lt Parameter gt lt Parameter gt lt name gt schema lt name gt lt value gt cgi schema lt value gt lt Parameter gt lt Parameter gt lt name gt Expose primary keys lt name gt lt value gt true lt value gt lt Parameter gt lt parameters gt lt DataStore gt lt sourceDataStores gt See _hittp docs geoserver org stable en user data app schema data stores html for a description of how to use other types
32. iguration on Windows 7 Windows Server 2008 OS s with PostgreSQL v8 4 and v9 1 and PostGIS 1 5 Oracle Java 1 6 and 1 7 and GeoServer 2 4 5 Other versions will also be possible but you may encounter particular issues that require consulting the application documentation or mailing lists Windows Linux and Mac operating systems are all supported by the software used here although installation methods differ PostgreSQL v8 4 will reach its end of life support in July 2014 so you should probably select a later version GeoServer recommends the use of Oracle Java 1 6 See the GeoServer site for the latest recommendations At the time of writing March 2014 there were still some tests reported failing with Oracle Java 1 7 although we didn t encounter any problems in our example service with it You should use GeoServer 2 4 5 or later as we have encountered bugs with the complex feature support in earlier versions Overview4 The text in this cookbook will assume you have your source data in tables in a relational database system This is the most likely situation for data of any complexity but you should be able to adapt the details for other sources such as files etc You will need to study the GeoSciML data model Having done this you will need to work out a mapping from your source data to appropriate parts of the GeoSciML model See the GeoSciML 3 2 Encoding Cookbook for OneGeology 5 star WFS services You will then have the task of configuring you
33. nguages supported by the service This list shall contain one or more languages that are supported This is included in the extended capabilities section of the GetCapabilities response as shown below lt inspire common SupportedLanguages SEET lt inspire Common Defaulrtlanguagez lt inspire common Language gt eng lt inspire common Language gt lt inspire common DefaultLanguage gt lt inspire common SupportedLanguages gt lt inspire common ResponseLanguage gt lt inspire common Language gt eng lt inspire common Language gt lt inspire common ResponseLanguage gt TG Requirement 554 A client may specify a specific language in a request If the requested language is contained in the list of supported languages the natural language fields of the service response shall be in the requested language It the requested language is not supported by the service then this parameter shall be ignored Implementing a OneGeology WFS 36 OneGeology This is trivially supported by the example service as there is only one language supported and all responses are in that language TG Requirement 564 The GetCapabilities operation is extended by an additional parameter that indicates the client s preferred language The name of this parameter shall be LANGUAGE The parameter values are based on ISO 639 2 B alpha 3 codes as used in INS MDTG For the example service the parameter value is eng which is the ISO 639 2
34. nnection configured in your servlet container then you will also need to edit the appropriate places in the datastore xml files described in a subsequent section So it will be easier for initial testing just to enter the host database user and password parameters Perform any configuration required by your servlet container and then start the servlet One configuration item you may need to change is to increase the memory available for Java The method depends on how you have installed GeoServer but if you get java lang OutOfMemoryError Java heap space errors with the request below you will need to increase the memory with a directive such as Xmx256M The details of tuning memory and other options of the Java Virtual Machine are complex and not dealt with in this cookbook Some information is in the GeoServer User Manual under the Running in a Production Environment section If you have used the Windows Installer you can apply this by editing the file C Program Files x86 GeoServer 2 4 5 wrapper wrapper conf The exact file location will depend on where you installed GeoServer and which version you are using Find the Implementing a OneGeology WFS 11 OneGeology line wrapper java maxmemory 128 and increase the value 128 or whatever it happens to be to something like 256 If you are running in Apache Tomcat on Windows you can use the Configure Tomcat program that the Tomcat Windows installer provides In the
35. of data store Target types4 The XML Schemas which are required to define a feature type and its properties are specified in the targetTypes section The type of the output feature is defined in targetElement in the typeMapping section The below example is from oam MappedFeature xml lt target Types lt Fearturelype gt lt schemaUri gt http schemas geosciml org geologicunit 3 2 geologicUnit xsd lt schemaUri gt lt FeatureType gt lt Heakunelype gt lt schemaUri gt http schemas geosciml org geologicstructure 3 2 geologicStructure xsd lt schemaUri gt lt FeatureType gt Implementing a OneGeology WFS 26 OneGeology lt targetTypes gt In this case the schema is published but because the OASIS XML Catalog is used for schema resolution a private or modified schema in the catalog can be used if desired Mappings9 The typeMappings element begins with configuration elements From gsml_ MappedFeature xml lt typeMappings gt lt FeatureTypeMapping gt lt sourceDataStore gt datastore lt sourceDataStore gt lt sourceType gt uk 625k mapped feature lt sourceType gt lt targetElement gt gsml MappedFeature lt targetElement gt e The mapping starts with sourceDataStore which gives the arbitrary identifier used above to name the source of the input data in the sourceDataStores section e sourceType gives the name of the source simple feature type In this case it is the simple feature type
36. on and gsml purpose with their text content being put directly inside the property elements ee pimi a E ha kd ae ae lt gml description gt UNNAMED IGNEOUS INTRUSION CARBONIFEROUS TO PERMIAN lt gm1 description gt description purpose St lt gsml purpose gt typicalNorm lt gsml purpose gt lt gsmlgu Geologicunit gt With complex features such as in the INSPIRE data specifications there are a number of ways in which the configuration can be more complex A feature property could be 1 1 but its value a complex type with attributes or nested element content whose values come from the table columns In the below diagram the columns of the mapped feature table are directly placed inside property elements or attribute values within a complex nested property structure mapped _feature lt gsml MappedFeature gt lt gsml positionalAccuracy gt lt swe Quantity gt aoe code m pos _acc_uom_code pos _acc_uom title Pxlink title meter gt lt swe value gt 1000 lt swe value gt lt swe Quantity gt lt gsm1 positionalAccuracy gt lt gsm1 MappedFeature gt Note often attributes like the units of measure may be the same for all rows in your table and you may want to hard code a value such as meter in the service configuration rather than repeat the same values in every row of your database table The property values may be polymorphic having different content structure depending on the par
37. ou a good overview of the configuration files needed and what the different parts do They produce valid INSPIRE Annex Il Geology theme GeoSciML v3 2 features and so hopefully will provide a good starting point to adapt for your own services However the mapping from your source data to your INSPIRE theme Implementing a OneGeology WFS 18 OneGeology model may require some features not used in the example For these cases you should refer to the Working with Application Schemas section of the GeoServer manual which contains comprehensive documentation on the different kinds of mapping from source to output XML that are possible It uses GeoSciML v2 based examples Because a single gsmlgu GeologicUnit can be observed at several distinct locations on the Earth s surface several gsml MappedFeature features may point via their gsml specification property to the same gsmlgu GeologicUnit lt xml version 1 0 encoding UTF 8 gt lt wfs FeatureCollection gt ee lt wfs member gt lt gsml MappedFeature gml id bgsn_digmap20111213000014089 625k gt lt gml boundedBy gt lt gml Envelope srsDimension 2 srsName urn ogce def crs EPSG 27700 gt lt gml lowerCorner gt 276992 0639999996 693085 1679999997 lt gml lowerCorner gt lt gml upperCorner gt 277851 8129999998 694098 9850000012 lt gml upperCorner gt lt gml Envelope gt lt gml boundedBy gt i 555 gt lt gsml shape gt lt gml MultiSurface gml id gsml
38. owerCorner gt 275822 8000000001 690776 9270000004 lt gm1 lowerCorner gt Implementing a OneGeology WFS 20 OneGeology lt gml upperCorner gt 277358 40499999985 693332 1230000001 lt gm1 upperCorner gt lt gml Envelope gt lt gml boundedBy gt SHS ot ee lt gsml shape gt CESS od lt gsml shape gt lt gsml specification xlink href SYG CYCS gt lt gsml metadata xsi nil true gco nilReason missing gt lt gsml MappedFeature gt lt wfis member gt lt wfs member gt lt gsml MappedFeature gml id bgsn_digmap20111213000023007 625k gt lt gml boundedBy gt lt gml Envelope srsDimension 2 srsName urn ogc def crs EPSG 27700 gt lt gml lowerCorner gt 247904 646999999 664467 5469999999 lt gml1 lowerCorner gt lt gml upperCorner gt 289537 88300000026 697616 4020000009 lt gml1 upperCorner gt lt gml Envelope gt lt gml boundedBy gt StS Sa e lt gsml shape gt Si Litas WER cea lt gsml shape gt lt gsml specification xlink href CKN CYCC gt lt gsml metadata xsi nil true gco nilReason missing gt lt gsml MappedFeature gt lt wfis member gt lt wis FeatureCollection gt app schema properties4 This file in the WEB INF classes directory is not strictly required but is very useful for storing certain configuration parameters that will be re used in different parts of the other configuration files and for storing configuration parameters like database usernames
39. pertylIsEqualTo gt lt fes ValueReference gt gsml specification gsmlgu GeologicUnit gsml relatedFeat ure gsmlga GeologicHistory gsml relatedFeature gsmlga GeologicEvent gsmlga youngerNamedAge xlink href lt fes ValueReference gt lt fes Literal gt http resource geosciml org classifier ics ischart Lochkovian lt fes Literal gt lt fes PropertylsEqualTo gt lt fes PropertylsEqualTo gt Implementing a OneGeology WFS 13 OneGeology lt fes ValueReference gt gsml specification gsmlgu GeologicUnit gsml relatedFeat ure gsmlga GeologicHistory gsml relatedFeature gsmlga GeologicEvent gsmlga youngerNamedAge xlink href lt fes ValueReference gt lt fes Literal gt http resource geosciml org classifier ics ischart Pragian lt f es Literal gt lt fes PropertylIsEqualTo gt lt fes Or gt lt fes Filter gt lt wfis Query gt lt wis GetFeature gt A OneGeology query for mapped features showing outcrops of geological units with particular lithologies WFS_getFeaturelGLith xml lt xml version 1 0 encoding UTF 8 gt lt wfs GetFeature xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http www opengis net wfs 2 0 http schemas opengis net wfs 2 0 wfs xsd http www opengis net gml 3 2 http schemas opengis net gml1 3 2 1 gml xsd xmlns gsml http xmlns geosciml org GeoSciML Core 3 2 xmlns gsmlgu http xmlns geosciml org GeologicUnit 3
40. pire dls ExtendedCapabilities section Example Data and Configurationg This tutorial chapter will show you how to set up a OneGeology compliant GeoSciML v3 2 WFS covering at least the encoding guidance in the GeoSciML 3 2 Encoding Cookbook for OneGeology 5 star WFS services Version 1 0 using the Open Source GeoServer WFS and PostGIS spatial database with an example source dataset It enables you to get some initial experience setting up a service Your own services may be set up by customising it or you may use it to get some understanding of what is involved when setting up your own service The tutorial assumes you are familiar with representing complex features in GML applications Implementing a OneGeology WFS 9 OneGeology Loading example PostGIS data It is assumed that you have installed the PostGIS software and that you have a spatially enabled database the default installation will create one called postgis The following will all be working within this spatially enabled database Download the database dump file from ftp ftp bgs ac uk pubload OneGeology INSPIREWFS gbr_bgs_625k backup Create a separate schema for the example data The schema name is used in the commands below so if you change it from gbr_bgs_ 625k you will need to change these accordingly CREATE SCHEMA gbr Dos 625k AUTHORIZATION postgres Import the data from the database dump file downloaded above If you have installed the pgAdmin graphical admini
41. portion range is at least as high as the specified query proportion Statistics on BBOX gt 4 Please choose a field Description Y name translation count pcarea SCOTTISH COAL MEASURES GROUP SCOTTISH COAL MEASURES GROUP 1 100 0 Implementing a OneGeology WFS 32 OneGeology INSPIRE Conformance4q In the previous section we have set up in INSPIRE terminology both a Web Feature Service and Filter Encoding Implementation of Pre defined Dataset Download Service and a Web Feature Service and Filter Encoding implementation of Direct Access Download Service The former needs to conform to the requirements set out in chapter 6 and the latter to the requirements set out in chapter 7 of the Technical Guidance for the implementation of INSPIRE Download Services We briefly illustrate how the example service conforms to each requirement below We emphasise that for OneGeology purposes only you do not need to conform to INSPIRE Technical Guidance TG Requirements however as most of them are just standard capabilities of competent and useful WFS 2 0 services we include them in this cookbook and point out that INSPIRE requirements 46 47 48 49 52 54 55 62 63 64 65 66 67 and 68 below are what one might expect from a good WFS 2 0 for general use and the GeoServer software described here can provide these capabilities Pre defined Dataset Download TG Requirement 464 Implementations shall conform to ISO 19142 Conformanc
42. r software to generate XML conformant to your INSPIRE theme schema from your source data The structure of your source data may be similar to or quite different from the INSPIRE model and we can t cover all possible situations but you will be able to make configuration changes in two places i in your underlying database and ii in the WFS software configuration mapping database contents to generated output A number of constraints administrative performance flexibility of the WFS software configuration and complexity will govern exactly how you do this but as a general principle it will usually be preferable to do as much in the database as possible to create source data matching INSPIRE output as closely as possible GeoServer can do some quite powerful processing of the underlying data but this is often at the expense of performance and ability to query the data Normally you will have one main table for each feature type you are intending to serve Ina simple feature WFS each row will generate one feature and the values of the table columns will be the values contained in simple property values of the generated features or spatial Implementing a OneGeology WFS 5 OneGeology data columns generating GML geometry property values The diagram below shows a table geol_ unit which is mapped to the feature type gsmlgu GeologicUnit Two example text columns description and purpose are mapped directly to simple feature properties gml descripti
43. s net wfs 2 0 gml http www opengis net gml 3 2 service WFS version 2 0 0 outputFormat application gml xml version 3 2 count 10 gt lt wfs Query typeNames gsml MappedFeature gt lt fes Filter gt lt fes Resourceid rid mesi gt lt fes Filter gt ese Query gt lt wis GetFeature gt TG Requirement 654 A Direct Access Download Service shall conform to ISO 19143 Minimum Standard Filter Conformance Class This is illustrated by the age and lithology queries in the previous chapter TG Requirement 664 Implementing a OneGeology WFS 40 OneGeology A Direct Access Download Service shall conform to ISO 19143 Minimum Spatial Filter Conformance Class This is illustrated by the BBOX query in the previous chapter TG Requirement 674 A Direct Access Download Service shall conform to ISO 19143 Minimum Temporal Filter Conformance Class The GetCapabilities response states that this is supported as is the During filter operation but the example data does not contain any temporal properties TG Requirement 689 A Direct Access Download Service shall conform to ISO 19143 Minimum XPath Conformance Class The age and lithology queries in the previous chapter show the use of XPath to refer to some nested property values Implementing a OneGeology WFS 41
44. s the below lt xml version 1 0 encoding UTF 8 gt lt wfs GetFeature xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http www opengis net wfs 2 0 http schemas opengis net wfs 2 0 wfs xsd http www opengis net gml 3 2 http schemas opengis net gml 3 2 1 gml xsd xmlns gsml http xmlins geosciml org GeoSciML Core 3 2 xmlns fes http www opengis net fes 2 0 xmlns wfs http www opengis net wfs 2 0 xmlns gml http www opengis net gml1 3 2 service WFS version 2 0 0 outputFormat application gml xml version 3 2 count 10 gt lt wfs Query typeNames gsml MappedFeature gt lt wfs Query gt lt wfs GetFeature gt TG Requirement 484 Implementations shall conform to ISO 19142 Conformance Class HTTP Get This is illustrated by an example KVP encoded request like the following http localhost 8080 geoserver ows service wfs amp version 2 0 0 amp request GetFeature amp typenames gsmlI MappedFeature amp count 20 amp TG Requirement 494 Pre defined Stored Queries shall be provided to make pre defined datasets available The stored query with the name specified in the technical guidance can be invoked with the following query Note you must have used the CreateStoredQuery request in the previous chapter to create the stored query first Implementing a OneGeology WFS 34 OneGeology http localhost 8080 geoserver ows service wfs amp version 2 0 0
45. stration tool you can use the menu option Tools gt Restore lf you are using the command line you can use the command pg_ restore exe host localhost port 5432 username postgres dbname postgis no password no owner no privileges no tablespaces schema gbr_bgs_ 625k verbose gbr_bgs_ 625k backup assuming you are using the default postgis named database You should create a database user with read only access to these tables for the WFS software to use when accessing them With more recent versions of PostgreSQL you can use the shorter syntax to grant access to all tables in the gor_bgs 625k schema with older versions you will have to grant access to each table individually CREATE ROLE ows reader LOGIN PASSWORD your password VALID UNTIL infinity COMMENT ON ROLE ows reader IS A role with read only access to data used in web services grant usage on schema gbr bgs 625k to ows reader grant select on table geometry columns to ows reader grant select on table spatial ref sys to ows reader Short syntax for versions of PostgreSQL works at least as far back as v9 1 grant select on all tables in schema gbr bgs 625k to ows reader Separate grants for each table for older versions of PostgreSQL known to be required for v8 4 grant select on table gbr bgs 625k uk_ 625k mapped feature to ows reader grant select on table gbr bgs 625k uk_625k geol_ unit to ows_reader Implementing a OneGeology WFS 10
46. supportedLanguagesType gt lt inspire common DefaultLanguage gt lt inspire common Language gt eng lt inspire common Language gt lt inspire common DefaultLanguage gt lt inspire common SupportedLanguages gt lt inspire common ResponseLanguage gt lt inspire common Language gt eng lt inspire common Language gt lt inspire_ common ResponseLanguage gt lt inspire dills Deene tierz lt inspire common Code gt 9df8df51 6342 37a8 e044 0003ba9b0d98 lt inspire _common Code gt lt inspire dls SpatialDataSetIdentifier gt lt inspire dls ExtendedCapabilities gt lt ows ExtendedCapabilities gt INSPIRE Pre defined Dataset Download If you decide that you are going to provide an INSPIRE pre defined dataset download service direct from your WFS rather than pre generating the full datasets and just providing links to the download through ATOM then you can do this by creating a Stored Query such Implementing a OneGeology WFS 17 OneGeology as the one below The example data directory includes the CreateStoredQuery command in the Demos examples lt xml version 1 0 encoding UTF 8 gt lt wfs CreateStoredQuery xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http www opengis net wfs 2 0 http schemas opengis net wfs 2 0 wfs xsd xmlns gsml http xmlins geosciml org GeoSciML Core 3 2 xmlns fes http www opengis org fes 2 0 xmilns wfs http www opengis net
47. t lt Query gt lt GetFeature gt Note Implementing a OneGeology WFS 15 OneGeology App schema cannot be configured using the web interface you will need to edit the configuration files directly You will see the configured workspaces and stores appear in the web interface but not the layers features The properties that can be edited in the web interface are very limited INSPIRE Extended Capabilities If you are providing an INSPIRE download service you will need to provide the extra INSPIRE mandated metadata in the WFS GetCapabilities response All INSPIRE specific requirements are optional for OneGeology use but will work as OneGeology services As described in the plugin documentation you should find a section in the WFS service settings of the administration interface where you can choose a language enter a service metadata URL and type and add one or more spatial dataset identifiers For guidance on what to enter in these settings see the Technical Guidance for the implementation of INSPIRE Download Services Check that the GetCapabilities responses contain your edited values Note The plugin GUI only allows you to select one of two values for the Service Metadata Type Online ISO 19139 ServiceMetadata document sets the MIME type to application vnd iso 19139 xml CSW GetRecord by ID request sets the MIME type to application vnd ogc csw GetRecordByIdResponse xml If neither of these correspond to th
48. t a OneGeology WFS does not need to be INSPIRE compliant INSPIRE WFS are simply standard WFS 2 0 and therefore this guidance can be used with the proviso that the sections on INSPIRE extended capabilities need not be provided for OneGeology purposes but can be if you want It describes how you can implement the WFS functionality described in chapters 6 and 7 of the latest Technical Guidance for the implementation of INSPIRE Download Services A WFS setup using the encoding guidance in Cookbook 4 will enable the service to be used and queried using the OneGeology portal age and lithology WFS query tool thus enabling the service to achieve 5 star accreditation This guidance includes example data and configuration files that can be used to create running Open GeoSpatial Consortium OGC Web Feature Services WFS that deliver data in GeoSciML This example illustrates aspects of service and data configuration that should help the reader to set up services using their own data Pre requisites System Requirements9 The cookbook is technical and some assumptions are made about the reader s background knowledge e The reader is a or is working closely with an expert in the data model and schema for GeoSciML who has read the sister cookbook to this one first GeoSciML 3 2 Encoding Cookbook for OneGeology 5 star WFS services e The reader has some familiarity with setting up web servers and preferably Java servlet containers e The reader is able
49. te ETC Dolomitic or magnesian sedimentary rock O E Framestone D amp Grainstone E O Impure carbonate sedimentary rock D E Packstone 4 7 Sj Pure carbonate sedimentary rock E Dolomite 4 V 5 Limestone T E chak M E Travertine E Pure carbonate mudstone gt E 0 Dolomitic or magnesian sedimentary material E O Chemical sedimentary material E O Clastic sedimentary material gt E O Non dastic siliceous sedimentary material E G Organic rich sedimentary material E O Phosphate rich sedimentary material E O Sediment E O Sedimentary rock gt E O Unconsolidated material 4 Phanerozoic 4 Cenozoic EI O Eocene 4 Neogene gt E O Miocene 4 V Pliocene E Piacenzian E Zanclean ET amp Oligocene gt E Paleogene EI CC Quaternary gt E O Mesozoic gt E amp Paleozoic gt E Precambrian The selected properties are queried for combined with a BBOX filter on the current view port of the portal Statistics on BBOX Please choose a field Description X translation name count pcarea CLACKMANNAN GROUP CLACKMANNAN GROUP 60 47 STRATHCLYDE GROUP STRATHCLYDE GROUP 1 39 52 The Lithology Statistics option allows you to select just one lithology term but also to specify a proportion value so that only features where that lithology is present in at least the given proportion are returned It checks that the lower value of the pro
50. ticular data under consideration A simple example would be nillable properties where the output structure changes when the property has nil values Implementing a OneGeology WFS 6 OneGeology If process_uri and title have values process url lt gsmlga GeologicEvent gt process title lt gsmlga eventProcess xlink href http resource geoscim org classifier cgi eventprocess 0041 xlink title intrusion gt lt gsmlga Geologicevent gt If process_uri and title are null lt gsmlga GeologicEvent gt lt gsmlga eventProcess xsi nil true xlink title intrusion gt lt gsmlga GeologicEvent gt Other complexities include one to many many to one or many to many relationships between features and their properties In these cases you will normally have separate database tables for the features and their property values which may be features in their own right Installation of Software4 The software used here all has extensive documentation and support forums and mailing lists Here we will just point you to the appropriate places to download the software and get installation instructions We assume e You have a basic familiarity with relational databases e You are able to install applications such as PostGIS Apache Tomcat GeoServer etc on a server with your chosen operating system using their project documentation Database4 If you already have your data in a relational database system you will
51. to install software on their machine and can follow the appropriate installation instructions for PostgreSQL PostGIS and GeoServer documented on the websites for that software To set up a production OneGeology WFS Download service you will need server equipment to run your database and GeoServer Estimating the level of hardware resources required to support a responsive service is a complex task depending on the amount of your data its complexity and the demand that will be placed on your service by users It is out of the scope of this document to give advice on these issues but you can find some assistance from the GeoServer web site and mailing list To test setting up a service using the example in this guide a modern PC with Intel Core or equivalent processor and 4Gb RAM should certainly be adequate and you can probably get away with less Implementing a OneGeology WFS 4 OneGeology The software required includes the PostgreSQL database with PostGIS spatial extensions Java in most cases a Java servlet container such as Apache Tomcat and GeoServer itself There are a lot of different versions and all these software packages are continuously updated You may have conditions specific to your site which make particular versions preferable For example you may already have your data in a different database system such as Oracle Spatial rather than PostGIS It isn t possible to cover all possible set ups here We have run the example conf
52. wfs 2 0 xmlns gml http www opengis net gml 3 2 xmlns xsd http www w3 org 2001 XMLSchema service WFS version 2 0 0 gt lt wfs StoredQueryDefinition id http inspire ec europa eu operation download GetSpatialDataSet gt lt wfs Parameter name CRS type xsd string gt lt wfs Parameter name DataSetIdCode type xsd string gt lt wfs Parameter name DataSetIdNamespace type xsd string gt lt wfs Parameter name Language type xsd string gt lt wfs Parameter name Ccount type xsd integer gt lt wfs Parameter gt lt wfs QueryExpressionText returnFeatureTypes gsml MappedFeature language urn ogc def queryLanguage OGC WFS WFS QueryExpression isPrivate false gt lt wfs Query typeNames gsml MappedFeature srsName CRS gt lt wfs Query gt lt wfs QueryExpressionText gt lt wfs StoredQueryDefinition gt lt wis CreateStoredQuery gt This can then be invoked with a request like http localhost 8080 geoserver ows service wfs amp version 2 0 0 amp request GetFeature amp storedquery_id http inspire ec europa eu operation download GetSpatialDataSet amp DataSetIdCode 13603180 amp DataSetiIdNamespace nhttp data bgs ac uk id dataHolding amp CRS urn ogc def crs EPSG 4326 amp Language eng amp count 20 amp Complex Feature Configuration4 This part of the cookbook describes selected parts of the configuration files from the example set This should give y
53. yout4 The files for configuring complex feature output are contained in the data workspaces directory Inside this directory there is a sub directory for each namespace of features you will be serving and other namespaces that these features may use somewhere in their content In the example this includes workspaces Geo gmd gml gsml gsmlem gsmlga gsmlgs gsmlgu gsmlu swe xik These cover all the namespaces used by features in the example data set so if you are producing a Geology theme service it is likely that you will use the same ones However for other themes you will need to create similar directories for the namespaces used in those themes and even for the geology theme you may need to add others if you use additional GeoSciML packages such as boreholes The example configuration defines 2 feature types to be served by the WFS Their configurations are stored in data store sub directories of the appropriate namespace directory and are named according to the pattern prefix Feature for a feature prefix Feature workspaces JES gmd gml gsml _ gsml MappedFeature gsmlem Implementing a OneGeology WFS 22 OneGeology gsmlga gsmlgs gsmlgu gsmlgu_GeologicUnit gsmlu swe xlink Each of the data store directories contains files similar to the following example for gsml MappedFeature gsml_ MappedFeature AppSchemaDataAccess xsd datastore xml gsml MappedFeature L featuretype xml gsml_ MappedFe

Download Pdf Manuals

image

Related Search

Related Contents

Fujitsu MB3845 User's Manual  10.311 BHC USER GUIDE (Aug 2010):Layout 1  Manuale Utente Users Manual 3Costruzioni Elettroniche S.n.c.  User Manual  

Copyright © All rights reserved.
Failed to retrieve file