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