Hi Ben, Thanks for your assistance - I tried using lowercase identifiers as described in Attempt 1, and using <OCQL>'test'</OCQL> as described in Attempt 2, but unfortunately I'm still not getting the townName data coming through in the WFS response.
Can you confirm that my GML Application Schema (below) has the townName correctly configured please? Is there anything else that I should verify that may be relevant to getting the townName mapping working? Many thanks, Ryan = = = GML Application Schema = = = <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:town="http://www.envitia.com/schemas/1.0" targetNamespace="http://www.envitia.com/schemas/1.0" elementFormDefault="qualified"> <xsd:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/> <xsd:element name="TownSurvey" type="town:TownSurveyType" substitutionGroup="gml:AbstractFeature"/> <xsd:complexType name="TownSurveyType"> <xsd:complexContent> <xsd:extension base="gml:AbstractFeatureType"> <xsd:sequence> <xsd:element name="townName" type="xsd:string"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> </xsd:schema> = = = -----Original Message----- From: Ben Caradoc-Davies [mailto:[email protected]] Sent: 11 June 2013 03:02 To: Ryan Moody Cc: [email protected]; Ian Turton; Neil Kirk Subject: Re: [Geoserver-users] App-Schema Publish Layer Exception On 10/06/13 19:38, Ryan Moody wrote: > This is progress, but I noticed that only the ID was being mapped - the town > name was not being mapped. Referring back to extracts of my latest mapping > file and my GML Application Schema, I have entries for "townName" as shown > below. I have confirmed that TOWN is a character column in my PostGIS > database, and I have tried various combinations of AttributeMappings that > unfortunately haven't worked. [...] > = = = > Mapping File (Attempt 1) > = = = > <AttributeMapping> > <targetAttribute>town:townName</targetAttribute> > <sourceExpression><OCQL>TOWN</OCQL></sourceExpression> > </AttributeMapping> Almost right. PostGIS identifiers should be lowercase; unless you really, really defined your table with 'create table "TOWN" ...' in PostGIS (and I have seen this particular insanity), names are stored in lowercase. You should be able to make this work by changing it to: <sourceExpression><OCQL>town</OCQL></sourceExpression> See: http://docs.geoserver.org/latest/en/user/data/app-schema/mapping-file.html#database-identifiers > = = = > Mapping File (Attempt 2) > = = = > > <AttributeMapping> > <targetAttribute>town:townName</targetAttribute> > <sourceExpression>"test"</sourceExpression> > </AttributeMapping> Invalid as you have no <OCQL> enclosing your literal; a validating XML editor should warn you about this. The nonvalidating parser that reads the mapping file see you have no <OCQL> and ignores the extraneous content. Furthermore, CQL literal strings are delimited with single (') not double (") quotes. You should be able to make this work by changing it to: <sourceExpression><OCQL>'test'</OCQL></sourceExpression> (Attempt 3 is a variation on this. I prefer 2 as it has namespace prefixes and omits redundant information.) Kind regards, -- Ben Caradoc-Davies <[email protected]> Software Engineer CSIRO Earth Science and Resource Engineering Australian Resources Research Centre ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Geoserver-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
