Andrew,

GeoServer/GeoTools geometries are atomic entities. Instead of trying to 
set properties/attributes on parts of geometries, create geometries (for 
example, from a database geometry column, using database functions) with 
srs set correctly and let GeoServer unpack and encode them for you. The 
target attribute in this case should be territoryOfUse. If this is a 
geometry property type, you probably don't need targetAttributeNode as 
app-schema (with GeoServer trunk) is now smart enough to search the 
substitution list (thank you Niels).

Second, your namespace prefix "19112" is invalid. Namespace prefixes 
must be NCNames, and cannot start with a digit. They can contain digits 
but typically start with a letter. For example, a valid prefix would be 
"iso19112":
http://www.w3.org/TR/xml-names11/#NT-NCName
http://www.w3.org/TR/xml11/#NT-NameStartChar

Kind regards,
Ben.


On 24/02/12 12:56, Andrew Betlehem wrote:
> Hi,
>
> With Geoserver 2.3.1, we’re trying to use the app schema extension and get a 
> Java error see below:
>
> 24 Feb 15:40:37 ERROR [geoserver.ows] -
> java.lang.RuntimeException: Error applying mapping with targetAttribute 
> 19112:territoryOfUse/gml:Polygon
>        at 
> org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(DataAccessMappingFeatureIterator.java:776)
>        at 
> org.geotools.data.complex.AbstractMappingFeatureIterator.next(AbstractMappingFeatureIterator.java:172)
>        at 
> org.geotools.data.complex.AbstractMappingFeatureIterator.next(AbstractMappingFeatureIterator.java:55)
> …
>        at 
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>        at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.ClassCastException: 
> org.geotools.feature.type.GeometryTypeImpl cannot be cast to 
> org.opengis.feature.type.ComplexType
>        at org.geotools.data.complex.filter.XPath.set(XPath.java:603)
>        at org.geotools.data.complex.filter.XPath.set(XPath.java:555)
>        at 
> org.geotools.data.complex.DataAccessMappingFeatureIterator.setAttributeValue(DataAccessMappingFeatureIterator.java:446)
>        at 
> org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(DataAccessMappingFeatureIterator.java:773)
>
> A section of our mapping file is:
>    <targetTypes>
>      <FeatureType>
>        
> <schemaUri>http://frameworkwfs.usgs.gov/framework/schemas/gazetteer/1.0.0/gmlsf1/iso/2005/gmd/gmd.xsd</schemaUri>
>        
> <schemaUri>file:C:/OSP-Gazetteer/data/geoserver%20data/workspaces/iso19112/iso19112.xsd</schemaUri>
>      </FeatureType>
>    </targetTypes>
>    <typeMappings>
>      <FeatureTypeMapping>
>        <sourceDataStore>Common Datastore</sourceDataStore>
>        <sourceType>Common</sourceType>
>        <targetElement>19112:SI_Gazetteer</targetElement>
>        <attributeMappings>
>          <AttributeMapping>
>            <targetAttribute>19112:SI_Gazetteer</targetAttribute>
>            <idExpression>
>              <OCQL>getId()</OCQL>
>            </idExpression>
>          </AttributeMapping>
>          <AttributeMapping>
>            <targetAttribute>
>              19112:name
>            </targetAttribute>
>            <sourceExpression>
>              <OCQL>name</OCQL>
>            </sourceExpression>
>          </AttributeMapping>
>          <AttributeMapping>
>            <targetAttribute>
>              19112:scope
>            </targetAttribute>
>            <sourceExpression>
>              <OCQL>scope</OCQL>
>            </sourceExpression>
>          </AttributeMapping>
>          <AttributeMapping>
>            <targetAttribute>
>              19112:territoryOfUse
>            </targetAttribute>
>            <targetAttributeNode>
>              gml:PolygonPropertyType
>            </targetAttributeNode>
>          </AttributeMapping>
>          <AttributeMapping>
>            <targetAttribute>
>              19112:territoryOfUse/gml:Polygon
>            </targetAttribute>
>            <ClientProperty>
>              <name>srsName</name>
>              <value>srs</value>
>            </ClientProperty>
>          </AttributeMapping>
>          <AttributeMapping>
>            <targetAttribute>
>              
> 19112:territoryOfUse/gml:Polygon/gml:Exterior/gml:LinearRing/gml:PosList
>            </targetAttribute>
>            <sourceExpression>
>              <OCQL>extent</OCQL>
>            </sourceExpression>
>          </AttributeMapping>
>          <AttributeMapping>
>            <targetAttribute>
>              19112:custodian
>            </targetAttribute>
>            <targetAttributeNode>
>              gmdsf1:CI_ResponsiblePartyPropertyType
>            </targetAttributeNode>
>          </AttributeMapping>
>          <AttributeMapping>
>            <targetAttribute>
>              
> 19112:custodian/gmdsf1:CI_ResponsibleParty/gmdsf1:organizationName
>            </targetAttribute>
>            <sourceExpression>
>              <OCQL>organisation</OCQL>
>            </sourceExpression>
>          </AttributeMapping>
>          <AttributeMapping>
>            <targetAttribute>
>              19112:custodian/gmdsf1:CI_ResponsibleParty/gmdsf1:role
>            </targetAttribute>
>            <sourceExpression>
>              <OCQL>role</OCQL>
>            </sourceExpression>
>          </AttributeMapping>
>        </attributeMappings>
>      </FeatureTypeMapping>
>    </typeMappings>
> </as:AppSchemaDataAccess>
>
> Any help or clues as to what we’re doing wrong would be appreciated.
>
> Regards,
>
> Andrew
>

-- 
Ben Caradoc-Davies <ben.caradoc-dav...@csiro.au>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to