[Geoserver-devel] [JIRA] (GEOS-9718) App schema default geometry descriptor not working

Karl Lindström created an issue

GeoServer / BugGEOS-9718

App schema default geometry descriptor not working

Issue Type:

BugBug

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:

MediumMedium

Reporter:

Karl Lindström

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:

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:

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:

      &lt;typeMappings&gt;
          &lt;FeatureTypeMapping&gt;
              &lt;sourceDataStore&gt;dataStore&lt;/sourceDataStore&gt;
              &lt;sourceType&gt;damm_prod_2013_3&lt;/sourceType&gt;
              &lt;targetElement&gt;hy-p:DamOrWeir&lt;/targetElement&gt;
              &lt;defaultGeometry&gt;hy-p:geometry&lt;/defaultGeometry&gt;

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.

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100144-sha1:b4c0399)

Atlassian logo