We are currently in the process of upgrading from Geoserver 2.10 to 2.16; what
follows is from our 2.10 installation.
We have a feature that carries historic detail. Our current mapping returns an
XML representation of the feature containing all of the historic detail. E.g.,
<myns:TheFeature>
< myns:FeatureIdentification>...</ myns:FeatureIdentification>
< myns:FeatureDetails>
< myns:FeatureDetail>
< myns:StartDate>2015-08-20</ myns:StartDate>
< myns:EndDate>2016-03-01</ myns:StartDate>
< myns:color>red</ myns:color>
< myns:cost>3.99</ myns:cost>
</ myns:FeatureDetail>
< myns:FeatureDetail>
< myns:StartDate>2016-03-02</ myns:StartDate>
< myns:EndDate>2018-12-15</ myns:StartDate>
< myns:color>green</ myns:color>
< myns:cost>3.99</ myns:cost>
</ myns:FeatureDetail>
<!-- Null end date means this is the last record in the time sequence
-->
< myns:FeatureDetail>
< myns:StartDate>2018-12-16</ myns:StartDate>
< myns:EndDate/>
< myns:color>red</ myns:color>
< myns:cost>4.29</ myns:cost>
</ myns:FeatureDetail>
</ myns:TheFeature>
Sometimes we want this complete historical record, but other times we want to
omit the history and return only the detail currently in effect - the detail
with a start date of 2018-12-16 in the example above. I thought to do this by
adding an element TheFeatureCurrent to the XML schema and to GeoServer mapping.
Like TheFeature, it is defined as being of TheFeatureType. I then added a
mapping for TheFeatureCurrent as a copy of the mapping for TheFeature, except
that instead of the table FEATURE_DETAIL, the database source for the detail
would be a view FEATURE_DETAIL_CURRENT_VIEW that restricted the detail to just
those rows covering the current date. Although the mapping file was ostensibly
for TheFeatureCurrent, the new mapping file actually mapped to the same
TheFeature element rather than TheFeatureCurrent.
I discovered that I needed to modify all the mapping names in the new mapping
file to not match the mapping names in the mapping file for the original
feature. If I did not do that, I got errors like
java.lang.RuntimeException: org.geotools.data.DataSourceException: Duplicate
mappingName or targetElement across FeatureTypeMapping instances detected.
They have to be unique, or app-schema doesn&apos;t know which one to get.
Please check your mapping file(s) with mappingName or targetElement of:
myns_SomeSubFeature
org.geotools.data.DataSourceException: ...
Once I changed all the mapping names, I got:
<ns3:ExceptionText>java.lang.RuntimeException: Error applying
mapping with targetAttribute myns:TheFeature
Error applying mapping with targetAttribute myns:TheFeature
myns:TheFeature is not a valid location path for type
http://www.myns.com/schema/1.0:TheFeautreType. myns:TheFeature ns:
http://www.myns.com, TheFeatureType properties:
http://www.opengis.net/gml/3.2#metaDataProperty ... </ns3:ExceptionText>
I _can_ get it to return results with TheFeatureCurrent by consistently
changing the mapping throughout, but we don't want to return that unfamiliar
element to the user. We could post-process the XML output to convert the
element name, but that would require additional software development add extra
processing time on large result sets. I have not yet tried creating a parallel
namespace currns to hold a duplicate of the myns schema, but that is also
something I'd like to avoid. Any suggestions?
---------------------------------------------------------------
Michael Stein, Northrop Grumman Defense Systems
_______________________________________________
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