Web Feature Service Reference Implementation

utahcokeΔιακομιστές

17 Νοε 2013 (πριν από 3 χρόνια και 6 μήνες)

98 εμφανίσεις

WFSRI

1

Kajal Claypool

Ai
-
Hoa Sanh

Dan Tennant


V
ERSION

1.2

Web Feature Service

Reference Implementation

WFSRI

2

Getting Started with WFS

Installation

Feature
Type Setup

Publish &

Retrieve

WFS

Administrator

Handles the
installation of the
WFS server

Data producers/

WFS Administrators

Setup the storage
and metadata for the
feature type

Data producers

Publish
Feature

Data

Retrieve
Feature

Data

Step 1

Step 2

Step 3

Done via scripts

Done through WFS Admin

or programmatically

Done through a soap client.
Download
soapUI
, test client
from
wxforge
, or write one!

Data consumers

WFSRI

3

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




WFSRI

4

Step 1: WFSRI Installation



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


Installation Note

WFSRI

5

Step 2: Feature Type Setup

A.
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 );


}


B.
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

WFSRI

6

B.1: Map XML to Relational

<?xml version="1.0" ?>

<
nnew:FeatureSchema

xmlns: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

Step 2: Feature Type Setup

WFSRI

7






public void
testReifyFeatureTableDefinition
() {


FeatureTableAdministrator

admin =


new
FeatureTableAdministrator
(
createDataSource
() );



admin.reifyFeatureTable
( "/xml/parsing/
lightningflash
/lightningFlash.xml" );



}

Map file created in Step 2A.

B.2: Create Feature Table using Map File

Step 2: Feature Type Setup

WFSRI

8

C.
Register the feature type into the system


public Object[][]
createRegisterFeaturetypeData
() {


RegisterFeatureType

featuretype

= 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
(
RegisterFeatureType

featuretype

) {


FeatureTypeAdministrator

admin = new
FeatureTypeAdministrator
(


MockDataGenerator.createDataSource
() );


int

featuretypeId

=
admin.registerFeatureType
(
featuretype

);


System.out.println
( "Feature Type ID: " +
featuretypeId

);

}

Step 2: Feature Type Setup

WFSRI

9

Step 2: Feature Type Setup (Summary)

A.
Register a Producer


B.
Create storage for the feature type


C.
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

WFSRI

10

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



WFSRI

11

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:LightningFlash

gml:id
="id5">


<
wx:obsOrFcstTime
>


<
gml:TimeInstant

gml:id
="id6">


<
gml:timePosition
>2008
-
07
-
09T03:54:25Z</
gml:timePosition
>


</
gml:TimeInstant
>


</
wx:obsOrFcstTime
>


<
nawx:strength

uom
="kA">
-
30.0</
nawx:strength
>


<
nawx:numStrokes
>3</
nawx:numStrokes
>


<
nawx:geometry
>


<
gml:Point

gml: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.