Sorry for the partial message I just sent. Let me try again 😊 I'm trying to map
the schema http://inspire.ec.europa.eu/schemas/hy-p/4.0/HydroPhysicalWaters.xsd
I have the following now in my mapping file:
<FeatureTypeMapping>
<sourceDataStore>dataStore</sourceDataStore>
<sourceType>damm_id</sourceType>
<targetElement>hy-p:DamOrWeir</targetElement>
<defaultGeometry>hy-p:geometry</defaultGeometry>
When I try to create a layer I now get an error in geoserver:
[cid:27bcc370-a01c-4250-9285-44a2ef3954a9]
From what I have understood from reading this page
https://geoserver.geo-solutions.it/edu/en/complex_features/faq/index.html
"hy-p:geometry" should be used as the defaultGeometry expression because
<geometry> is a direct child element of the target element <DamOrWeir>. I tried
a a few other combinations as well such as "hy-p:DamOrWeir/hy-p:geometry" but I
get the same error. Any idea what the problem is? I'm attaching the mapping
file in case it helps.
<http://i>Regards,
Karl Lindström
________________________________
From: Lindström Karl
Sent: 22 June 2020 14:42:54
To: Nuno Oliveira
Cc: [email protected]
Subject: Re: [Geoserver-users] SRS is incorrect when creating app-schema layer
from a PostGIS database
Thank you for your response Nuno. The target schema I am trying to map is
http://inspire.ec.europa.eu/schemas/hy-p/4.0/HydroPhysicalWaters.xsd
________________________________
From: Nuno Oliveira <[email protected]>
Sent: 14 June 2020 21:14:16
To: Lindström Karl
Cc: [email protected]
Subject: Re: [Geoserver-users] SRS is incorrect when creating app-schema layer
from a PostGIS database
Hi,
explicitly setting the default geometry should do the trick:
https://docs.geoserver.org/stable/en/user/data/app-schema/mapping-file.html#mappings
Something likes this:
<typeMappings>
<FeatureTypeMapping>
<mappingName>mappedfeature1</mappingName>
<sourceDataStore>datastore</sourceDataStore>
<sourceType>mappedfeature</sourceType>
<targetElement>gsml:MappedFeature</targetElement>
<isDenormalised>true</isDenormalised>
<defaultGeometry>gsml:MappedFeature/gsml:shape/gml:Polygon</defaultGeometry>
Hope it helps, otherwise feel free to open a JIRA ticket, make sure you
describe your mapping and target GML, as well the table definition.
Best regards,
Nuno Oliveira
On Mon, May 25, 2020 at 9:39 AM Lindström Karl
<[email protected]<mailto:[email protected]>> wrote:
I have PostGIS database with a table that was exported from a shapefile using
shp2pgsql. I have verified that the SRID is correct by querying the
geometry_columns table.
If I use this database table as a data source in Geoserver and create a layer
from it everything works as expected and the correct SRS is set on the layer.
However, when I try to create an app-schema mapping using this table (I'm
creating the mapping in Hale and exporting it using the direct upload method)
the correct CRS is not picked up by Geoserver. Instead the Native SRS is emtpy
and the Declared SRS is EPSG:404000. I also don't get any position elements if
I preview the GML. I'm assuming this is because the SRS is incorrect, but I get
the same problem even if I declare the correct SRS and use the "Force declared"
option.
I think the problem is related to app-schema because if I import the data in
Hale the correct SRS gets used and if I do a transformation in Hale the
resulting GML contains position elements for each feature.
Does anyone know what the problem could be?
I'm running Geoserver 2.17.0 on RHEL 8 using Java 1.8.0_252.
Regards,
Karl Lindström
_______________________________________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
If you want to request a feature or an improvement, also see this:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the experts!
Visit http://goo.gl/it488V for more information.
==
Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
Con riferimento alla normativa sul trattamento dei dati
personali (Reg. UE 2016/679 - Regolamento generale sulla
protezione dei dati “GDPR”), si precisa che ogni
circostanza inerente alla presente email (il suo contenuto,
gli eventuali allegati, etc.) è un dato la cui conoscenza
è riservata al/i solo/i destinatario/i indicati dallo
scrivente. Se il messaggio Le è giunto per errore, è
tenuta/o a cancellarlo, ogni altra operazione è illecita.
Le sarei comunque grato se potesse darmene notizia.
This email is intended only for the person or entity to
which it is addressed and may contain information that
is privileged, confidential or otherwise protected from
disclosure. We remind that - as provided by European
Regulation 2016/679 “GDPR” - copying, dissemination or
use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you
have received this email by mistake, please notify
us immediately by telephone or e-mail.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns3:AppSchemaDataAccess xmlns:ns2="http://www.opengis.net/ogc" xmlns:ns3="http://www.geotools.org/app-schema">
<namespaces>
<Namespace>
<prefix>hy-p</prefix>
<uri>http://inspire.ec.europa.eu/schemas/hy-p/4.0</uri>
</Namespace>
<Namespace>
<prefix>gml</prefix>
<uri>http://www.opengis.net/gml/3.2</uri>
</Namespace>
<Namespace>
<prefix>base</prefix>
<uri>http://inspire.ec.europa.eu/schemas/base/3.3</uri>
</Namespace>
<Namespace>
<prefix>xsi</prefix>
<uri>http://www.w3.org/2001/XMLSchema-instance</uri>
</Namespace>
</namespaces>
<includedTypes/>
<sourceDataStores>
<DataStore>
<id>dataStore</id>
<parameters>
<Parameter>
<name>url</name>
<value>file:./damm_id.shp</value>
</Parameter>
<Parameter>
<name>memory mapped buffer</name>
<value>false</value>
</Parameter>
<Parameter>
<name>create spatial index</name>
<value>true</value>
</Parameter>
<Parameter>
<name>charset</name>
<value>ISO-8859-1</value>
</Parameter>
</parameters>
</DataStore>
</sourceDataStores>
<targetTypes>
<FeatureType>
<schemaUri>http://inspire.ec.europa.eu/schemas/hy-p/4.0/HydroPhysicalWaters.xsd</schemaUri>
</FeatureType>
</targetTypes>
<typeMappings>
<FeatureTypeMapping>
<sourceDataStore>dataStore</sourceDataStore>
<sourceType>damm_id</sourceType>
<targetElement>hy-p:DamOrWeir</targetElement>
<attributeMappings>
<AttributeMapping>
<targetAttribute>hy-p:DamOrWeir</targetAttribute>
<idExpression>
<OCQL>strConcat('DamOrWeir_', DAMMID)</OCQL>
</idExpression>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>gml:identifier</targetAttribute>
<sourceExpression>
<OCQL>strConcat('https://opendata.smhi.se/DamOrWeir_', DAMMID)</OCQL>
</sourceExpression>
<encodeIfEmpty>true</encodeIfEmpty>
<ClientProperty>
<name>codeSpace</name>
<value>'http://inspire.ec.europa.eu/ids'</value>
</ClientProperty>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>hy-p:inspireId/base:Identifier/base:localId</targetAttribute>
<sourceExpression>
<OCQL>strConcat('DamOrWeir_', DAMMID)</OCQL>
</sourceExpression>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>hy-p:beginLifespanVersion</targetAttribute>
<sourceExpression>
<OCQL>DATUM</OCQL>
</sourceExpression>
<ClientProperty>
<name>xsi:nil</name>
<value>if_then_else(isNull(DATUM), 'true', Expression.NIL)</value>
</ClientProperty>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>gml:name</targetAttribute>
<sourceExpression>
<OCQL>NAMN</OCQL>
</sourceExpression>
<isMultiple>true</isMultiple>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>hy-p:geometry</targetAttribute>
<sourceExpression>
<OCQL>the_geom</OCQL>
</sourceExpression>
<ClientProperty>
<name>xsi:nil</name>
<value>if_then_else(isNull(the_geom), 'true', Expression.NIL)</value>
</ClientProperty>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>hy-p:inspireId/base:Identifier/base:namespace</targetAttribute>
<sourceExpression>
<OCQL>'https://opendata.smhi.se'</OCQL>
</sourceExpression>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>hy-p:condition</targetAttribute>
<encodeIfEmpty>true</encodeIfEmpty>
<ClientProperty>
<name>nilReason</name>
<value>'missing'</value>
</ClientProperty>
<ClientProperty>
<name>xsi:nil</name>
<value>if_then_else(isNull('missing'), Expression.NIL, 'true')</value>
</ClientProperty>
</AttributeMapping>
</attributeMappings>
</FeatureTypeMapping>
</typeMappings>
</ns3:AppSchemaDataAccess>
_______________________________________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
If you want to request a feature or an improvement, also see this:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users