<div dir="ltr">Probably not the direction you want to go, but if you did it as a WFS, or other client-side vector layer, you could process the text in the browser with JavaScript, at least in OpenLayers.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 29, 2016 at 10:30 AM, Lime, Steve D (MNIT) <span dir="ltr"><<a href="mailto:Steve.Lime@state.mn.us" target="_blank">Steve.Lime@state.mn.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Jeff's suggestion is a good one. There's no way to do that using text expressions - you can concatenate and do simple transformations (e.g. toupper) but there is no substring operator. Would be a nice addition... --Steve<br>
<div class="HOEnZb"><div class="h5"><br>
-----Original Message-----<br>
From: mapserver-users [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a>] On Behalf Of Jeff McKenna<br>
Sent: Monday, February 29, 2016 7:28 AM<br>
To: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
Subject: Re: [mapserver-users] Using a attribute substring for labeling<br>
<br>
On 2016-02-29 9:02 AM, lars lingner wrote:<br>
> Hello,<br>
><br>
> while using a ShapeFile, created with gdaltindex, as data source for a<br>
> layer I'd like to use a substring of the location attribute for labeling.<br>
><br>
> I could (and probably will) preprocess the ShapeFile to add the label<br>
> text as additional attribute. But I wanted to try this step within<br>
> MapServer first.<br>
><br>
> My current example contains a path and file name. The file name has a 4<br>
> digit number in it I would like to use as label. To make it more<br>
> complicated, the substring has various positions within the whole string.<br>
> Maybe there is a way with tostring() which accepts sprintf formatting,<br>
> but I couldn't figure out the correct syntax yet.<br>
><br>
> With a database layer of course I would be able to use SQL to extract a<br>
> substring and pass it as additional attribute, but not with a ShapeFile.<br>
><br>
> Is there a way to extract a substring from an attribute value and use it<br>
> as label? It would be nice to have a function available to use in<br>
> EXPRESSION or TEXT parameter.<br>
><br>
> Thank you in advance for any hints.<br>
><br>
> Lars<br>
<br>
Hi Lars,<br>
<br>
Did you try piping this shapefile layer through an OGR connection<br>
(CONNECTIONTYPE OGR) and then passing your SQL in the data statement?<br>
I'd first start at the ogrinfo commandline, and test your SQL there with<br>
the -sql switch, and then move to the mapfile next.<br>
<br>
Otherwise I'd probably need a sample of your data to dive into this.<br>
<br>
-jeff<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Jeff McKenna<br>
MapServer Consulting and Training Services<br>
<a href="http://www.gatewaygeomatics.com/" rel="noreferrer" target="_blank">http://www.gatewaygeomatics.com/</a><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Richard W. Greenwood, PLS<br><a href="http://www.greenwoodmap.com" target="_blank">www.greenwoodmap.com</a></div></div>
</div>