[mapserver-users] RE: Mapserver ODBC Access Database Field Concatenation
Donald Kerr
donald.kerr at dkerr.co.uk
Sat Nov 20 10:39:19 PST 2010
I have solved this by doing the concatenation in the TEXT part of the LAYER
CLASS as follows:
TEXT (Status: [Status]||Dia: [Diameter])
LABEL
FONT Arial
SIZE 10
TYPE truetype
ANTIALIAS TRUE
COLOR 0 0 0
BACKGROUNDCOLOR 255 255 192
BACKGROUNDSHADOWCOLOR 192 192 192
POSITION lr
FORCE TRUE
OFFSET -19 0
WRAP "|"
END # LABEL
Regards,
Donald
-----Original Message-----
From: Donald Kerr [mailto:donald.kerr at dkerr.co.uk]
Sent: 13 November 2010 20:11
To: 'mapserver-users at lists.osgeo.org'
Subject: Mapserver ODBC Access Database Field Concatenation
Hi List,
I want to create a multi line label based on a combination of text and
fields from an Access database. I can connect to the database and return the
required fields but I do not seem to be able to concatenate fields to
produce the required results.
Here's the contents of the ovf file:
<OGRVRTDataSource>
<OGRVRTLayer name="MyLayer">
<SrcDataSource>ODBC:@MyDSN</SrcDataSource>
<SrcSQL>SELECT ('Status: ',[Status],'|','Dia: ',[Diameter])
AS MyLabel FROM MyTable</SrcSQL>
<GeometryType>wkbPoint</GeometryType>
<GeometryField encoding='PointFromColumns' x='Easting'
y='Northing'/>
</OGRVRTLayer>
</OGRVRTDataSource>
There is not a problem if I simply request the fields alone (substitute the
line below for the one in the code above):
<SrcSQL>SELECT Status, Diameter FROM MyTable</SrcSQL>
The problem seems to be with concatenating fields. I have also tried
concatenation using the word CONCAT with the same results.
Can anyone advise please?
Alternatively is there a better way to produce the multi line label in the
LAYER definition i.e. can I do the concatenation in there?
Many thanks.
Regards,
Donald Kerr
More information about the MapServer-users
mailing list