110 likes | 310 Views
Web Feature Service Reference Implementation. Version 1.2. Kajal Claypool Ai-Hoa Sanh Dan Tennant. Getting Started with WFS. Data producers/ WFS Administrators. WFS Administrator. Data consumers. Data producers. Retrieve Feature Data. Handles the installation of the WFS server.
E N D
Web Feature ServiceReference Implementation Version 1.2 Kajal ClaypoolAi-Hoa SanhDan Tennant
Getting Started with WFS Data producers/ WFS Administrators WFS Administrator Data consumers Data producers Retrieve Feature Data Handles the installation of the WFS server Setup the storage and metadata for the feature type Publish Feature Data Publish & Retrieve Feature Type Setup Installation Step 1 Step 2 Step 3 Done through a soap client. Download soapUI, test client from wxforge, or write one! Done through WFS Admin or programmatically Done via scripts
Step 1: WFSRI Installation • Prerequisites • – Oracle 11g (should be installed) • – Apache Tomcat • – ActiveMQ (if using pub/sub) • Download the WFSRI 1.2 tar ball:https://wiki.ucar.edu/display/NNEWD/WFS+Reference+Implementation • Follow installation instructions: https://wiki.ucar.edu/display/NNEWD/WFSRI+Installation
Step 1: WFSRI Installation Installation Note • Multiple WFSRI installations can be hosted using one Oracle database instance – “sandboxes” – Primarily a development time feature • Caveats: • – Unique name for each WFSRI installation • – Feature type names & namespace URI must be unique to the sandbox • – User names (producers) must be unique across sandboxes • To point to a different WFSRI sandbox, modify the wfsri.properties file
Step 2: Feature Type Setup • Register a Producer public void testRegisterProducer( String producername, String password ) { ProducerAdministrator admin = new ProducerAdministrator( MockDataGenerator .createDataSource() ); int id = admin.registerProducer( producername, password ); System.out.println( "Producer ID is: " + id ); } • Create storage for the feature type • You define the table structure • Things you should consider: • What are the fields (elements/attributes) that are accessed frequently? • What are the most likely search patterns? • What are the “keys” for your feature type? • Based on above, you need to “map” feature type XSD to a relational table via map files
B.1: Map XML to Relational Step 2: Feature Type Setup <?xml version="1.0" ?> <nnew:FeatureSchemaxmlns:nnew="http://www.faa.gov/wfs/admin/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.faa.gov/wfs/admin/1.0 ../../../../../../../wfsri-bindings/schemas/gov/faa/wfs/admin/1.0.0/featureTableDefinition.xsd"> <nnew:FeatureTable> <nnew:schemaName>Producer1</nnew:schemaName> <nnew:tableName>LIGHTNINGFLASH</nnew:tableName> <nnew:xsdName>LightningFlash</nnew:xsdName> <nnew:xsdNamespaceURI> nawx='http://www.faa.gov/nawx/1.1‘ wx='http://www.eurocontrol.int/wx/1.1' gml='http://www.opengis.net/gml/3.2’</nnew:xsdNamespaceURI> <nnew:FeatureTableColumn> <nnew:columnName>NUMSTROKES</nnew:columnName> <nnew:columnDatatype/> <nnew:xsdName>nawx:numStrokes</nnew:xsdName> <nnew:xsdAttribute/> <nnew:xsdDatatype>integer</nnew:xsdDatatype> </nnew:FeatureTableColumn> <nnew:FeatureTableColumn> <nnew:columnName>GEOMETRY</nnew:columnName> <nnew:columnDatatype>Spatial</nnew:columnDatatype> <nnew:xsdName>./nawx:geometry</nnew:xsdName> <nnew:xsdAttribute>false</nnew:xsdAttribute> <nnew:xsdDatatype>PointPropertyType</nnew:xsdDatatype> </nnew:FeatureTableColumn> <nnew:FeatureTableColumn> <nnew:columnName>TIMEPOSITION</nnew:columnName> <nnew:columnDatatype/> <nnew:xsdName>wx:obsOrFcstTime/gml:TimeInstant/gml:timePosition</nnew:xsdName> <nnew:xsdAttribute/> <nnew:xsdDatatype>dateTime</nnew:xsdDatatype> </nnew:FeatureTableColumn> </nnew:FeatureTable> </nnew:FeatureSchema> Schema name, Table name Column definitions mapping xsd element/attribute to relational columns
B.2: Create Feature Table using Map File Step 2: Feature Type Setup public void testReifyFeatureTableDefinition() { FeatureTableAdministrator admin = new FeatureTableAdministrator( createDataSource() ); admin.reifyFeatureTable( "/xml/parsing/lightningflash/lightningFlash.xml" ); } Map file created in Step 2A.
Step 2: Feature Type Setup • Register the feature type into the system public Object[][] createRegisterFeaturetypeData() { RegisterFeatureTypefeaturetype = new RegisterFeatureType(); featuretype.setProducerId( 1 ); featuretype.setFeaturetypeName( "LightningFlash" ); featuretype.setFeaturetypeURL( "http://www.faa.gov/nawx/1.2" ); featuretype.setFeaturetypeAlias( "nawx" ); featuretype.setSchemaLocation( "http://www.faa.gov/nawx/1.2/wxLightning.xsd" ); featuretype.setSchemaName( “USERNAME" ); featuretype.setTableName( "LIGHTNINGFLASH" ); featuretype.setpKeyCol( "id" ); String[] columnInfo = { "NUMSTROKES", "UOM", "GEOMETRY", "TIMEPOSITION" }; featuretype.setColumnInfo( columnInfo ); featuretype.setpSpatialCol( "GEOMETRY" ); featuretype.setFeatureMemberNS( "http://www.opengis.net/gml/3.2" ); featuretype.setFeatureMemberName( "id" ); featuretype.setSrsNS( "urn:ogc:def:crs:EPSG::4326" ); featuretype.setSrsNsAlias( "EPSG" ); String[] mandatoryColInfo = { "NUMSTROKES", "GEOMETRY" }; featuretype.setMandatoryColInfo( mandatoryColInfo ); featuretype.setGml31( false ); featuretype.setReuse( false ); featuretype.setSharer( false ); featuretype.setFeaturetypeDescFile( new File("/ll/asanh/nnew/wfsri/src/test/resources/xml/get-capabilities/Lightning.xml") ); featuretype.setDescribeFeaturetypeFile( new File("/ll/asanh/nnew/ogc- bindings/schemas/gov/faa/nawx/1.2.0/wxLightning.xsd") ); return new Object[][] { new Object[] { featuretype } }; } public void testRegisterFeatureType( RegisterFeatureTypefeaturetype ) { FeatureTypeAdministrator admin = new FeatureTypeAdministrator( MockDataGenerator.createDataSource() ); intfeaturetypeId = admin.registerFeatureType( featuretype ); System.out.println( "Feature Type ID: " + featuretypeId ); }
Step 2: Feature Type Setup (Summary) • Register a Producer • Create storage for the feature type • Register the feature type into the system • More information can be found in the WFSRI User Guide:https://wiki.ucar.edu/display/NNEWD/WFSRI+User+Guide
Step 3: Go to Town! • Send WFS requests to server using your favorite SOAP client! • – LL provide soapClient: a simple command line client • <url> • <request> • <username> • <password> • – SoapUI
Transaction Insert Example <wfs:Transaction service="WFS" version="2.0.0" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wx=http://www.eurocontrol.int/wx/1.1 xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:om=http://www.opengis.net/om/1.0/gml32 xmlns:xlin="http://www.w3.org/1999/xlink" xmlns:nawx="http://www.faa.gov/nawx/1.2" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 ../../../../../../../ogc-bindings/schemas/net/opengis/wfs/2.0.0/wfs.xsd http://www.faa.gov/nawx/1.2 ../../../../../../../ogc-bindings/schemas/gov/faa/nawx/1.2.0/wxLightning.xsd"> <wfs:Insert> <nawx:LightningFlashgml:id="id5"> <wx:obsOrFcstTime> <gml:TimeInstantgml:id="id6"> <gml:timePosition>2008-07-09T03:54:25Z</gml:timePosition> </gml:TimeInstant> </wx:obsOrFcstTime> <nawx:strengthuom="kA">-30.0</nawx:strength> <nawx:numStrokes>3</nawx:numStrokes> <nawx:geometry> <gml:Pointgml:id="id7" srsName="urn:ogc:def:crs:EPSG::4326" srsDimension="2"> <gml:pos>38.611629486083984 -81.6015625</gml:pos> </gml:Point> </nawx:geometry> </nawx:LightningFlash> </wfs:Insert> </wfs:Transaction> Other examples bundled in tar ball and available in User Guide.