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

Reply via email to