[Geoserver-users] App-Schema Geometry Mapping

Hello,

I’d be extremely grateful if someone could help me with a GeoServer App-Schema issue that I’ve been battling to no avail!

I’m attempting to use the GeoServer App-Schema extension to map the geometry and attribution stored in a data table of a PostGIS database to a GMLAS.

My PostGIS data table ‘depth_area’ contains three columns: ‘pk_id’, ‘depth_range’ and ‘geom’. I have registered the geometry column via the AddGeometryColumn function and have confirmed that this column contains valid geometry (polygons).

I have defined the app-schema mapping file and GMLAS as shown below. I have checked that both are valid in an XML Editor.

On starting GeoServer, my workspace loads without errors. When GeoServer is running, I make the following WFS request:

http://localhost:8080/geoserver/MyPrefix/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=MyPrefix:DepthArea&maxFeatures=2

This returns me a valid response (bottom of this email), and the depth_range values are being successfully mapped across from the PostGIS database. However, the geometry element is empty:

< MyPrefix:geometry/>

Can anyone suggest where I may be going wrong, looking at my configuration below?

Best regards,

Ryan

= = = Begin App-Schema Mapping File = = =

<?xml version="1.0" encoding="UTF-8"?>

<as:AppSchemaDataAccess xmlns:as=“http://www.geotools.org/app-schema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://www.geotools.org/app-schema AppSchemaDataAccess.xsd”>

gml

http://www.opengis.net/gml/3.2

MyPrefix

MyURI

MyDataStore

dbtype

postgis

host

MyHost

port

MyPort

database

MyDatabaseName

user

MyUser

passwd

MyPassword

Expose primary keys

true

MySchemaURI

MyDataStore

depth_area

MyPrefix:DepthArea

MyPrefix:pk_id

pk_id

MyPrefix:depthrange

depth_range

geometry

geom

</as:AppSchemaDataAccess>

= = = End App-Schema Mapping File = = =

= = = Begin GML Application Schema = = =

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs=“http://www.w3.org/2001/XMLSchema” xmlns:MyPrefix=“MyURI” xmlns:gml=“http://www.opengis.net/gml/3.2” targetNamespace=“MyURI” elementFormDefault=“qualified”>

<xs:import namespace=“http://www.opengis.net/gml/3.2” schemaLocation=“http://schemas.opengis.net/gml/3.2.1/gml.xsd”/>

<xs:element name=“DepthArea” type=“MyPrefix:DepthAreaType” substitutionGroup=“gml:AbstractFeature”/>

<xs:complexType name=“DepthAreaType”>

xs:complexContent

<xs:extension base=“gml:AbstractFeatureType”>

xs:sequence

<xs:element name=“pk_id” type=“xs:integer”/>

<xs:element name=“geometry” type=“gml:SurfacePropertyType”/>

<xs:element name=“depthrange” type=“xs:float”/>

</xs:sequence>

</xs:extension>

</xs:complexContent>

</xs:complexType>

</xs:schema>

= = = End GML Application Schema = = =

= = = Begin WFS Request Response = = =

<?xml version="1.0" encoding="UTF-8"?>

<wfs:FeatureCollection xmlns:wfs=“http://www.opengis.net/wfs” xmlns:ogc=“http://www.opengis.net/ogc” xmlns:gml=“http://www.opengis.net/gml” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:MyPrefix=“MyURI” xmlns:xlink=“http://www.w3.org/1999/xlink” xmlns:ows=“http://www.opengis.net/ows” numberOfFeatures=“2” timeStamp=“2013-09-17T11:20:53.174Z” xsi:schemaLocation=“http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd MyURI MyGMLAS.xsd”>

gml:featureMember

<MyPrefix:DepthArea gml:id=“depth_area.0”>

< MyPrefix:geometry/>

< MyPrefix:depthrange>200.0</ MyPrefix:depthrange>

</ MyPrefix:DepthArea>

</gml:featureMember>

gml:featureMember

< MyPrefix:DepthArea gml:id=“depth_area.1”>

< MyPrefix:geometry/>

< MyPrefix:depthrange>0.0</ MyPrefix:depthrange>

</ MyPrefix:DepthArea>

</gml:featureMember>

</wfs:FeatureCollection>

= = = End WFS Request Response = = =

Hi Ryan,

Your mapping file contains :

geometry geom

I think you forgot the prefix for the target attribute :

MyPrefix:geometry geom

Hi Rudy,

I’ve tried your suggestion previously, but unfortunately it still gives me the empty geometry element MyPrefix:geometry/ in the WFS response.

Can you think of any other possible issues which may prevent the geometry being mapped across?

Many thanks,

Ryan

From: Rudy Commenge [mailto:rudywi.devel@anonymised.com]
Sent: 17 September 2013 13:30
To: Ryan Moody
Cc: geoserver-users@lists.sourceforge.net; Neil Kirk
Subject: Re: [Geoserver-users] App-Schema Geometry Mapping

Hi Ryan,

Your mapping file contains :

geometry geom

I think you forgot the prefix for the target attribute :

MyPrefix:geometry geom

In your XML Schema try to declare “geom” element with generic geometry type :
<xs:element name=“geometry” type=“gml:GeometryPropertyType” />

···

2013/9/17 Ryan Moody <ryan.moody@anonymised.com.5620…>

Hi Rudy,

I’ve tried your suggestion previously, but unfortunately it still gives me the empty geometry element MyPrefix:geometry/ in the WFS response.

Can you think of any other possible issues which may prevent the geometry being mapped across?

Many thanks,

Ryan

From: Rudy Commenge [mailto:rudywi.devel@anonymised.com]
Sent: 17 September 2013 13:30
To: Ryan Moody
Cc: geoserver-users@lists.sourceforge.net; Neil Kirk
Subject: Re: [Geoserver-users] App-Schema Geometry Mapping

Hi Ryan,

Your mapping file contains :

geometry geom

I think you forgot the prefix for the target attribute :

MyPrefix:geometry geom

Hi Rudy,

Thanks for your suggestion - unfortunately the problem still occurs! =(

One thing I’ve noticed is that, although I’m using a GML 3.2.1 schema, my URL request did not include the “outputFormat=gml32” setting.

When I include this setting in my WFS request, I get the error:

“The prefix “null” for element “null:Envelope” is not bound.”

According to the documentation, this error means that I need to define ‘gml’ as a secondary namespace, which I have done as described in

http://docs.geoserver.org/stable/en/user/data/app-schema/supported-gml-versions.html#secondary-namespace-for-gml-3-2-1-required

However, I’m still getting the same “The prefix “null” for element “null:Envelope” is not bound.” error message.

I should point out that my GMLAS has to be version 3.2.1.

Any suggestions on how I can resolve this error message and get my geometry mapping across?

Many thanks,

Ryan

From: Rudy Commenge [mailto:rudywi.devel@anonymised.com]
Sent: 17 September 2013 16:12
To: Ryan Moody
Cc: geoserver-users@lists.sourceforge.net; Neil Kirk
Subject: Re: [Geoserver-users] App-Schema Geometry Mapping

In your XML Schema try to declare “geom” element with generic geometry type :
<xs:element name=“geometry” type=“gml:GeometryPropertyType” />

2013/9/17 Ryan Moody <ryan.moody@anonymised.com>

Hi Rudy,

I’ve tried your suggestion previously, but unfortunately it still gives me the empty geometry element MyPrefix:geometry/ in the WFS response.

Can you think of any other possible issues which may prevent the geometry being mapped across?

Many thanks,

Ryan

From: Rudy Commenge [mailto:rudywi.devel@anonymised.com]
Sent: 17 September 2013 13:30
To: Ryan Moody
Cc: geoserver-users@lists.sourceforge.net; Neil Kirk
Subject: Re: [Geoserver-users] App-Schema Geometry Mapping

Hi Ryan,

Your mapping file contains :

geometry geom

I think you forgot the prefix for the target attribute :

MyPrefix:geometry geom

Ryan,

WFS 1.1.0 defaults to GML 3.1.1 output; you cannot return GML 3.2.1 content unless you use outputformat=gml32 or use WFS 2.0.0. I see you noticed this in a later email.
http://docs.geoserver.org/latest/en/user/data/app-schema/supported-gml-versions.html

This looks like a secondary namespace problem, as you note.

Also, your mapping for pk_id is invalid as gml:id cannot be an integer; they must be XML NCNames. Furthermore, just use sourceExpression if you want this to be an ordinary property. This is unrelated to the geometry problem.

Kind regards,
Ben.

On 17/09/13 19:50, Ryan Moody wrote:

Hello,

I’d be extremely grateful if someone could help me with a GeoServer
App-Schema issue that I’ve been battling to no avail!

I’m attempting to use the GeoServer App-Schema extension to map the
geometry and attribution stored in a data table of a PostGIS database to
a GMLAS.

My PostGIS data table ‘depth_area’ contains three columns: ‘pk_id’,
‘depth_range’ and ‘geom’. I have registered the geometry column via the
AddGeometryColumn function and have confirmed that this column contains
valid geometry (polygons).

I have defined the app-schema mapping file and GMLAS as shown below. I
have checked that both are valid in an XML Editor.

On starting GeoServer, my workspace loads without errors. When GeoServer
is running, I make the following WFS request:

http://localhost:8080/geoserver/MyPrefix/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=MyPrefix:DepthArea&maxFeatures=2

This returns me a valid response (bottom of this email), and the
depth_range values are being successfully mapped across from the PostGIS
database. However, the geometry element is empty:

< MyPrefix:geometry/>

Can anyone suggest where I may be going wrong, looking at my
configuration below?

Best regards,

Ryan

= = = Begin App-Schema Mapping File = = =

<?xml version="1.0" encoding="UTF-8"?>

<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.geotools.org/app-schema
AppSchemaDataAccess.xsd">

                 <namespaces>

                                 <Namespace>

                                                 <prefix>gml</prefix>

<uri>http://www.opengis.net/gml/3.2&lt;/uri&gt;

                                 </Namespace>

                                 <Namespace>

                                                 <prefix>MyPrefix</prefix>

                                                 <uri>MyURI</uri>

                                 </Namespace>

                 </namespaces>

                 <sourceDataStores>

                                 <DataStore>

                                                 <id>MyDataStore</id>

                                                 <parameters>

                                                                 <Parameter>

                                                                                 <name>dbtype</name>

                                                                                 <value>postgis</value>

</Parameter>

                                                                 <Parameter>

                                                                                 <name>host</name>

                                                                                 <value>MyHost</value>

</Parameter>

                                                                 <Parameter>

                                                                                 <name>port</name>

                                                                                 <value>MyPort</value>

</Parameter>

                                                                 <Parameter>

                                                                                 <name>database</name>

                                                                                 <value>MyDatabaseName</value>

</Parameter>

                                                                 <Parameter>

                                                                                 <name>user</name>

                                                                                 <value>MyUser</value>

</Parameter>

                                                                 <Parameter>

                                                                                 <name>passwd</name>

                                                                                 <value>MyPassword</value>

</Parameter>

                                                                 <Parameter>

                                                                                 <name>Expose primary keys</name>

                                                                                 <value>true</value>

</Parameter>

                                                 </parameters>

                                 </DataStore>

                 </sourceDataStores>

                 <targetTypes>

                                 <FeatureType>

<schemaUri>MySchemaURI</schemaUri>

                                 </FeatureType>

                 </targetTypes>

                 <typeMappings>

                                 <FeatureTypeMapping>

<sourceDataStore>MyDataStore</sourceDataStore>

<sourceType>depth_area</sourceType>

<targetElement>MyPrefix:DepthArea</targetElement>

                                                 <attributeMappings>

<AttributeMapping>

                                                                                 <targetAttribute>MyPrefix:pk_id</targetAttribute>

                                                                                 <idExpression>

                                                                                                 <OCQL>pk_id</OCQL>

                                                                                 </idExpression>

</AttributeMapping>

<AttributeMapping>

                                                                                 <targetAttribute>MyPrefix:depthrange</targetAttribute>

                                                                                 <sourceExpression>

                                                                                                 <OCQL>depth_range</OCQL>

                                                                                 </sourceExpression>

</AttributeMapping>

<AttributeMapping>

                                                                                 <targetAttribute>geometry</targetAttribute>

                                                                                 <sourceExpression>

                                                                                                 <OCQL>geom</OCQL>

                                                                                 </sourceExpression>

</AttributeMapping>

                                                 </attributeMappings>

                                 </FeatureTypeMapping>

                 </typeMappings>

</as:AppSchemaDataAccess>

= = = End App-Schema Mapping File = = =

= = = Begin GML Application Schema = = =

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema&quot;
xmlns:MyPrefix="MyURI" xmlns:gml="http://www.opengis.net/gml/3.2&quot;
targetNamespace="MyURI" elementFormDefault="qualified">

                 <xs:import namespace="http://www.opengis.net/gml/3.2&quot;
schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd&quot;/&gt;

                 <xs:element name="DepthArea"
type="MyPrefix:DepthAreaType" substitutionGroup="gml:AbstractFeature"/>

                 <xs:complexType name="DepthAreaType">

                                 <xs:complexContent>

                                                 <xs:extension
base="gml:AbstractFeatureType">

<xs:sequence>

                                                                                 <xs:element name="pk_id" type="xs:integer"/>

                                                                                 <xs:element name="geometry" type="gml:SurfacePropertyType"/>

                                                                                 <xs:element name="depthrange" type="xs:float"/>

</xs:sequence>

                                                 </xs:extension>

                                 </xs:complexContent>

                 </xs:complexType>

</xs:schema>

= = = End GML Application Schema = = =

= = = Begin WFS Request Response = = =

<?xml version="1.0" encoding="UTF-8"?>

<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xmlns:MyPrefix="MyURI" xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xmlns:ows="http://www.opengis.net/ows&quot; numberOfFeatures="2"
timeStamp="2013-09-17T11:20:53.174Z"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd MyURI MyGMLAS.xsd">

                 <gml:featureMember>

                                 <MyPrefix:DepthArea gml:id="depth_area.0">

                                                 < MyPrefix:geometry/>

                                                 <
MyPrefix:depthrange>200.0</ MyPrefix:depthrange>

                                 </ MyPrefix:DepthArea>

                 </gml:featureMember>

                 <gml:featureMember>

                                 < MyPrefix:DepthArea gml:id="depth_area.1">

                                                 < MyPrefix:geometry/>

                                                 <
MyPrefix:depthrange>0.0</ MyPrefix:depthrange>

                                 </ MyPrefix:DepthArea>

                 </gml:featureMember>

</wfs:FeatureCollection>

= = = End WFS Request Response = = =

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

Ryan,

did you create both workspaces/gml/namespace.xml and workspaces/gml/workspace.xml?

What happens if you make a WFS 2.0.0 request?

Kind regards,
Ben.

On 17/09/13 23:25, Ryan Moody wrote:

Hi Rudy,

Thanks for your suggestion - unfortunately the problem still occurs! =(

One thing I’ve noticed is that, although I’m using a GML 3.2.1 schema,
my URL request did not include the “outputFormat=gml32” setting.

When I include this setting in my WFS request, I get the error:

“The prefix "null" for element "null:Envelope" is not bound.”

According to the documentation, this error means that I need to define
‘gml’ as a secondary namespace, which I have done as described in

http://docs.geoserver.org/stable/en/user/data/app-schema/supported-gml-versions.html#secondary-namespace-for-gml-3-2-1-required

However, I’m still getting the same “The prefix "null" for element
"null:Envelope" is not bound.” error message.

I should point out that my GMLAS has to be version 3.2.1.

Any suggestions on how I can resolve this error message and get my
geometry mapping across?

Many thanks,

Ryan

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

Hi Ben,

I've changed my pk_id mapping to use a sourceExpression instead of an idExpression as suggested.

Regarding the geometry issue, I can confirm that I've created both workspaces/gml/namespace.xml and workspaces/gml/workspace.xml. However, when I attempt a WFS 2.0.0 request, I still get the error "The prefix &quot;null&quot; for element &quot;null:Envelope&quot; is not bound."

Any suggestions? Below is my namespace.xml and workspace.xml so that there is no doubt:

= = = Begin workspaces/gml/namespace.xml = = =

<namespace>
    <id>gml_namespace</id>
    <prefix>gml</prefix>
    <uri>http://www.opengis.net/gml/3.2&lt;/uri&gt;
</namespace>

= = = End workspaces/gml/namespace.xml = = =

= = = Begin workspaces/gml/workspace.xml = = =

<workspace>
    <id>gml_workspace</id>
    <name>gml</name>
</workspace>

= = = End workspaces/gml/workspace.xml = = =

Best regards,

Ryan

-----Original Message-----
From: Ben Caradoc-Davies [mailto:Ben.Caradoc-Davies@…367…]
Sent: 18 September 2013 07:47
To: Ryan Moody
Cc: Rudy Commenge; geoserver-users@lists.sourceforge.net; Neil Kirk
Subject: Re: [Geoserver-users] App-Schema Geometry Mapping

Ryan,

did you create both workspaces/gml/namespace.xml and workspaces/gml/workspace.xml?

What happens if you make a WFS 2.0.0 request?

Kind regards,
Ben.

On 17/09/13 23:25, Ryan Moody wrote:

Hi Rudy,

Thanks for your suggestion - unfortunately the problem still occurs!
=(

One thing I’ve noticed is that, although I’m using a GML 3.2.1 schema,
my URL request did not include the “outputFormat=gml32” setting.

When I include this setting in my WFS request, I get the error:

“The prefix "null" for element "null:Envelope" is not bound.”

According to the documentation, this error means that I need to define
‘gml’ as a secondary namespace, which I have done as described in

http://docs.geoserver.org/stable/en/user/data/app-schema/supported-gml
-versions.html#secondary-namespace-for-gml-3-2-1-required

However, I’m still getting the same “The prefix "null" for element
"null:Envelope" is not bound.” error message.

I should point out that my GMLAS has to be version 3.2.1.

Any suggestions on how I can resolve this error message and get my
geometry mapping across?

Many thanks,

Ryan

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@...367...> Software Engineer CSIRO Earth Science and Resource Engineering Australian Resources Research Centre

Ryan,

I was able produce a satisfactory WFS 2.0.0 response (attached) using your mapping files and a property file containing dummy data. I have attached the files that are different from those in the app-schema tutorial, for your inspection (zip file). Please have a look through the zip file and see if you missed something.

The query URL was:
http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=MyPrefix:DepthArea

All I changed was reformatting, the data store, and the prefix and schema URL. I used a gml:GeometryPropertyType in the schema, as discussed.

I used a recent master so I am not sure if the included wfs.xml will work with 2.3.5, but it only changes a few encoding options and can be ignored.

Kind regards,
Ben.

On 18/09/13 15:56, Ryan Moody wrote:

Hi Ben,

I've changed my pk_id mapping to use a sourceExpression instead of an idExpression as suggested.

Regarding the geometry issue, I can confirm that I've created both workspaces/gml/namespace.xml and workspaces/gml/workspace.xml. However, when I attempt a WFS 2.0.0 request, I still get the error "The prefix &quot;null&quot; for element &quot;null:Envelope&quot; is not bound."

Any suggestions? Below is my namespace.xml and workspace.xml so that there is no doubt:

= = = Begin workspaces/gml/namespace.xml = = =

<namespace>
     <id>gml_namespace</id>
     <prefix>gml</prefix>
     <uri>http://www.opengis.net/gml/3.2&lt;/uri&gt;
</namespace>

= = = End workspaces/gml/namespace.xml = = =

= = = Begin workspaces/gml/workspace.xml = = =

<workspace>
     <id>gml_workspace</id>
     <name>gml</name>
</workspace>

= = = End workspaces/gml/workspace.xml = = =

Best regards,

Ryan

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

DepthArea.zip (5.27 KB)

response.xml (2.08 KB)

Hi Ben,

Thanks for sending me your configuration - I spotted some differences in my layer.xml configuration and the geometry is now being mapped across! I'm using the following WFS request in my web browser to get the desired response:

http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=MyPrefix:DepthArea&count=2

I'd now like to be able to visualise the response using QGIS. I've tried adding a WFS layer to a new QGIS project, specifying the same request URL, but QGIS gives me the error "capabilities document contained no layers". I then tried changing the version of the QGIS WFS request to 1.1.0 - this recognised the DepthArea layer, but informed me that it wasn't a valid layer and could not be added to the map.

For this simple case, is there any request URL that I can put directly into QGIS to visualise my DepthArea geometry, or will I need to write some form of QGIS plugin before I can visualise my DepthArea features?

Many thanks,

Ryan

-----Original Message-----
From: Ben Caradoc-Davies [mailto:Ben.Caradoc-Davies@…367…]
Sent: 18 September 2013 09:44
To: Ryan Moody
Cc: Rudy Commenge; geoserver-users@lists.sourceforge.net; Neil Kirk
Subject: Re: [Geoserver-users] App-Schema Geometry Mapping

Ryan,

I was able produce a satisfactory WFS 2.0.0 response (attached) using your mapping files and a property file containing dummy data. I have attached the files that are different from those in the app-schema tutorial, for your inspection (zip file). Please have a look through the zip file and see if you missed something.

The query URL was:
http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=MyPrefix:DepthArea

All I changed was reformatting, the data store, and the prefix and schema URL. I used a gml:GeometryPropertyType in the schema, as discussed.

I used a recent master so I am not sure if the included wfs.xml will work with 2.3.5, but it only changes a few encoding options and can be ignored.

Kind regards,
Ben.

On 18/09/13 15:56, Ryan Moody wrote:

Hi Ben,

I've changed my pk_id mapping to use a sourceExpression instead of an idExpression as suggested.

Regarding the geometry issue, I can confirm that I've created both workspaces/gml/namespace.xml and workspaces/gml/workspace.xml. However, when I attempt a WFS 2.0.0 request, I still get the error "The prefix &quot;null&quot; for element &quot;null:Envelope&quot; is not bound."

Any suggestions? Below is my namespace.xml and workspace.xml so that there is no doubt:

= = = Begin workspaces/gml/namespace.xml = = =

<namespace>
     <id>gml_namespace</id>
     <prefix>gml</prefix>
     <uri>http://www.opengis.net/gml/3.2&lt;/uri&gt;
</namespace>

= = = End workspaces/gml/namespace.xml = = =

= = = Begin workspaces/gml/workspace.xml = = =

<workspace>
     <id>gml_workspace</id>
     <name>gml</name>
</workspace>

= = = End workspaces/gml/workspace.xml = = =

Best regards,

Ryan

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@...367...> Software Engineer CSIRO Earth Science and Resource Engineering Australian Resources Research Centre

On Wed, Sep 18, 2013 at 10:55 AM, Ryan Moody <ryan.moody@anonymised.com> wrote:

Hi Ben,

Thanks for sending me your configuration - I spotted some differences in
my layer.xml configuration and the geometry is now being mapped across! I'm
using the following WFS request in my web browser to get the desired
response:

http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=MyPrefix:DepthArea&count=2

I'd now like to be able to visualise the response using QGIS. I've tried
adding a WFS layer to a new QGIS project, specifying the same request URL,
but QGIS gives me the error "capabilities document contained no layers". I
then tried changing the version of the QGIS WFS request to 1.1.0 - this
recognised the DepthArea layer, but informed me that it wasn't a valid
layer and could not be added to the map.

For this simple case, is there any request URL that I can put directly
into QGIS to visualise my DepthArea geometry, or will I need to write some
form of QGIS plugin before I can visualise my DepthArea features?

Does QGis support complex features at all? That would be a surprise for me

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Have you tried the QGIS WFS 2.0.0 Client Plugin? I have not used QGIS or this plugin, but it might be worth investigating:

http://plugins.qgis.org/plugins/wfsclient/
http://www.weichand.de/2012/06/07/wfs-2-0-client-plugin-for-qgis-english/
http://www.weichand.de/2012/08/26/qgis-wfs-2-0-plugin-update/

Kind regards,
Ben.

On 18/09/13 17:55, Ryan Moody wrote:

Hi Ben,

Thanks for sending me your configuration - I spotted some differences in my layer.xml configuration and the geometry is now being mapped across! I'm using the following WFS request in my web browser to get the desired response:

http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=MyPrefix:DepthArea&count=2

I'd now like to be able to visualise the response using QGIS. I've tried adding a WFS layer to a new QGIS project, specifying the same request URL, but QGIS gives me the error "capabilities document contained no layers". I then tried changing the version of the QGIS WFS request to 1.1.0 - this recognised the DepthArea layer, but informed me that it wasn't a valid layer and could not be added to the map.

For this simple case, is there any request URL that I can put directly into QGIS to visualise my DepthArea geometry, or will I need to write some form of QGIS plugin before I can visualise my DepthArea features?

Many thanks,

Ryan

-----Original Message-----
From: Ben Caradoc-Davies [mailto:Ben.Caradoc-Davies@anonymised.com]
Sent: 18 September 2013 09:44
To: Ryan Moody
Cc: Rudy Commenge; geoserver-users@lists.sourceforge.net; Neil Kirk
Subject: Re: [Geoserver-users] App-Schema Geometry Mapping

Ryan,

I was able produce a satisfactory WFS 2.0.0 response (attached) using your mapping files and a property file containing dummy data. I have attached the files that are different from those in the app-schema tutorial, for your inspection (zip file). Please have a look through the zip file and see if you missed something.

The query URL was:
http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=MyPrefix:DepthArea

All I changed was reformatting, the data store, and the prefix and schema URL. I used a gml:GeometryPropertyType in the schema, as discussed.

I used a recent master so I am not sure if the included wfs.xml will work with 2.3.5, but it only changes a few encoding options and can be ignored.

Kind regards,
Ben.

On 18/09/13 15:56, Ryan Moody wrote:

Hi Ben,

I've changed my pk_id mapping to use a sourceExpression instead of an idExpression as suggested.

Regarding the geometry issue, I can confirm that I've created both workspaces/gml/namespace.xml and workspaces/gml/workspace.xml. However, when I attempt a WFS 2.0.0 request, I still get the error "The prefix &quot;null&quot; for element &quot;null:Envelope&quot; is not bound."

Any suggestions? Below is my namespace.xml and workspace.xml so that there is no doubt:

= = = Begin workspaces/gml/namespace.xml = = =

<namespace>
      <id>gml_namespace</id>
      <prefix>gml</prefix>
      <uri>http://www.opengis.net/gml/3.2&lt;/uri&gt;
</namespace>

= = = End workspaces/gml/namespace.xml = = =

= = = Begin workspaces/gml/workspace.xml = = =

<workspace>
      <id>gml_workspace</id>
      <name>gml</name>
</workspace>

= = = End workspaces/gml/workspace.xml = = =

Best regards,

Ryan

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com> Software Engineer CSIRO Earth Science and Resource Engineering Australian Resources Research Centre

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

A sufficiently normalised complex feature (OGC Simple Features SF1) where all the properties of interest are simple and at the top level or one where QGIS ignores complex properties might be usable. The plugin I mentioned does not support multiple geometries. They do mention INSPIRE, GeoServer beta 2.2, degree 3.x, and GO Publisher WFS, which are correlated with complex feature use. :slight_smile:

Complex features might be usable if complex properties can be referenced in queries even if complex property data is not usable.

But I do not use QGIS. I am only guessing. Ryan will find out by testing.

Kind regards,
Ben.

On 19/09/13 05:04, Andrea Aime wrote:

Does QGis support complex features at all? That would be a surprise for me

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

Hi Ben,

I've tried out the WFS 2.0 QGIS plugin that you referred to in your previous email - the plugin is excellent! It gave me a visualisation of the features supplied by the WFS response, and I'm able to query the values of the features' attributes that are being mapped across by app-schema within this visualisation - this is exactly what I needed.

Thank you very much for your continued support, it's really appreciated =)

Best regards,

Ryan

-----Original Message-----
From: Ben Caradoc-Davies [mailto:Ben.Caradoc-Davies@…367…]
Sent: 19 September 2013 02:38
To: Andrea Aime
Cc: Ryan Moody; GeoServer Mailing List List; Neil Kirk
Subject: Re: [Geoserver-users] App-Schema Geometry Mapping

A sufficiently normalised complex feature (OGC Simple Features SF1) where all the properties of interest are simple and at the top level or one where QGIS ignores complex properties might be usable. The plugin I mentioned does not support multiple geometries. They do mention INSPIRE, GeoServer beta 2.2, degree 3.x, and GO Publisher WFS, which are correlated with complex feature use. :slight_smile:

Complex features might be usable if complex properties can be referenced in queries even if complex property data is not usable.

But I do not use QGIS. I am only guessing. Ryan will find out by testing.

Kind regards,
Ben.

On 19/09/13 05:04, Andrea Aime wrote:

Does QGis support complex features at all? That would be a surprise
for me

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@...367...> Software Engineer CSIRO Earth Science and Resource Engineering Australian Resources Research Centre

That is great news! Thanks for the confirmation. I am sure there are other app-schema users who would be interested in using QGIS to consume their data. I am also interested to know how well it works with complex properties, so if you encounter any difficulties, please let us know.

Kind regards,
Ben.

On 19/09/13 15:59, Ryan Moody wrote:

Hi Ben,

I've tried out the WFS 2.0 QGIS plugin that you referred to in your previous email - the plugin is excellent! It gave me a visualisation of the features supplied by the WFS response, and I'm able to query the values of the features' attributes that are being mapped across by app-schema within this visualisation - this is exactly what I needed.

Thank you very much for your continued support, it's really appreciated =)

Best regards,

Ryan

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre