Hi Ben, Thanks for the reply. I did what you suggested with the geometry property types and mapped it as (for example):
<AttributeMapping> <targetAttribute> iso19112:position </targetAttribute> <sourceExpression> <OCQL>wkb_geometry</OCQL> </sourceExpression> </AttributeMapping> But it only gets empty gml elements: <iso19112:SI_LocationInstance gml:id="gazplaces.312925"> <iso19112:geographicIdentifier>WA100148359</iso19112:geographicIdentifier>... <iso19112:position/> </iso19112:SI_LocationInstance> Should I be using the GeoServer trunk rather than 2.1.3, which I'm using? Or is there something else that I'm missing? Regards, Andrew -----Original Message----- From: Ben Caradoc-Davies [mailto:ben.caradoc-dav...@csiro.au] Sent: Monday, 27 February 2012 2:11 PM To: Andrew Betlehem Cc: geoserver-users@lists.sourceforge.net Subject: Re: [Geoserver-users] App schema mapping gives error casting GeometryTypeImpl to ComplexType 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(Abstract > MappingFeatureIterator.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 ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users