Karl Lindström ( 
https://osgeo-org.atlassian.net/secure/ViewProfile.jspa?accountId=5f40f4bb347294003e474b8c
 ) *created* an issue

GeoServer ( 
https://osgeo-org.atlassian.net/browse/GEOS?atlOrigin=eyJpIjoiMzQwNmExZGQxZjMxNGI5OWE1M2NjMWVjMjgyNTYzMzMiLCJwIjoiaiJ9
 ) / Bug ( 
https://osgeo-org.atlassian.net/browse/GEOS-9718?atlOrigin=eyJpIjoiMzQwNmExZGQxZjMxNGI5OWE1M2NjMWVjMjgyNTYzMzMiLCJwIjoiaiJ9
 ) GEOS-9718 ( 
https://osgeo-org.atlassian.net/browse/GEOS-9718?atlOrigin=eyJpIjoiMzQwNmExZGQxZjMxNGI5OWE1M2NjMWVjMjgyNTYzMzMiLCJwIjoiaiJ9
 ) App schema default geometry descriptor not working ( 
https://osgeo-org.atlassian.net/browse/GEOS-9718?atlOrigin=eyJpIjoiMzQwNmExZGQxZjMxNGI5OWE1M2NjMWVjMjgyNTYzMzMiLCJwIjoiaiJ9
 )

Issue Type: Bug Affects Versions: 2.17.2 Assignee: Unassigned Attachments: 
HydroPhysicalWaters.appschema, mapping.png, table.png Components: Application 
schema Created: 22/Aug/20 1:59 PM Environment:

Geoserver 2.17.2
Apache Tomcat 9.0.31
Red Hat Enterprise Linux 8.2

Priority: Medium Reporter: Karl Lindström ( 
https://osgeo-org.atlassian.net/secure/ViewProfile.jspa?accountId=5f40f4bb347294003e474b8c
 )

Hello,

I am trying to use App Schema where the data source is a PostGIS table, and the 
mapping is made in Hale Studio. The schema I want to map to is the following 
Inspire schema: 
http://inspire.ec.europa.eu/schemas/hy-p/4.0/HydroPhysicalWaters.xsd

Here is my table definition:

( https://osgeo-org.atlassian.net/secure/attachment/33554/33554_table.png )

I am sure that the PostGIS table is works as expected because if I import it 
directly without using App Schema I get the expected layer properties and CRS 
and the layer preview works correctly.

I am also sure that the mapping created in Hale Studio is correct because I can 
validate it against the target schema and I get the right output if I do a 
transform of the data form Hale.

Here's a screenshot of my Hale mapping:

( https://osgeo-org.atlassian.net/secure/attachment/33553/33553_mapping.png )

Then I uploaded this mapping to Geoserver using Hale's Geoserver plugin with 
the "direct upload" method. This created the data store and the layer, but the 
layer SRS was not assigned correctly as the Native SRS was emtpy and the 
Declared SRS was EPSG:404000.

When asking about this on the mailing list I was told that the solution was to 
edit the App Schema type mapping file and add the <defaultGeometry> element. 
This element specifies where the geometry element is found in the target 
schema. In my case this element is called `geometry` and is direct child of the 
root element `DamOrWeir`, so following the example here 
https://docs.geoserver.geo-solutions.it/edu/en/complex_features/faq/index.html 
I added the following to the mapping file:

     <typeMappings>
         <FeatureTypeMapping>
             <sourceDataStore> dataStore </sourceDataStore>
             <sourceType> damm_prod_2013_3 </sourceType>
             <targetElement> hy-p:DamOrWeir </targetElement>
             <defaultGeometry> hy-p:geometry </defaultGeometry>

However, now when I try to create a layer I get the following exception:

22 Aug 13:10:06 WARN [complex.config] - Error creating app-schema data store 
for 'hy-p:DamOrWeir' , caused by: Default geometry descriptor could not be 
found for type "http: //inspire.ec.europa.eu/schemas/hy-p/4.0
:DamOrWeir " at x-path " hy-p:geometry"
22 Aug 13:10:06 ERROR [geoserver.web] - Error retrieving layers for the 
specified store
java.lang.RuntimeException: Could not list layers for this store, an error 
occurred retrieving them: java.lang.IllegalArgumentException: Default geometry 
descriptor could not be found for type "http: //inspire.ec
.europa.eu/schemas/hy-p/4.0:DamOrWeir " at x-path " hy-p:geometry"
       at 
org.geoserver.web.data.layer.NewLayerPageProvider.getItemsInternal(NewLayerPageProvider.java:170)
       at 
org.geoserver.web.data.layer.NewLayerPageProvider.getItems(NewLayerPageProvider.java:47)
       at 
org.geoserver.web.data.layer.NewLayerPage$8.onUpdate(NewLayerPage.java:282)
       at 
org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior.onEvent(AjaxFormComponentUpdatingBehavior.java:154)
       at 
org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:155)
       at 
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:601)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at 
org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
       at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
       at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
       at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
       at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)
       at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
       at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
       at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
       at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
       at 
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
       at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
       at 
org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:159)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
       at 
org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:166)
       at 
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)
       at 
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)
       at 
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
       at 
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
...

I've tried other values for the <defaultGeometry> element such as 
"hy-p:DamOrWeir/hy-p:Geometry", "./hy-pGeometry", "/hy-p:Geometry", 
"//hy-p:Geometry" and so on but I get the same error.

Is this a bug or am I doing something wrong here? Any help would be greatly 
appreciated! I have attached the complete App Schema mapping in case it helps.

( 
https://osgeo-org.atlassian.net/browse/GEOS-9718#add-comment?atlOrigin=eyJpIjoiMzQwNmExZGQxZjMxNGI5OWE1M2NjMWVjMjgyNTYzMzMiLCJwIjoiaiJ9
 ) Add Comment ( 
https://osgeo-org.atlassian.net/browse/GEOS-9718#add-comment?atlOrigin=eyJpIjoiMzQwNmExZGQxZjMxNGI5OWE1M2NjMWVjMjgyNTYzMzMiLCJwIjoiaiJ9
 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( 
https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail
 ) or iOS ( 
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8
 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100144- 
sha1:b4c0399 )
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to