Oops, I meant to also mention that it will probably not be exactly the right
length since for most fonts letter widths vary, but underscores are the same
size.  So you might still want to think about that fix Andrea was suggesting
:)

--
David Winslow
OpenGeo - http://opengeo.org/

On Thu, Jun 23, 2011 at 8:41 AM, David Winslow <[email protected]> wrote:

> To get the equivalent number of underscores you could use the strReplace
> function.  It's misdocumented in the page Andrea linked to, it actually
> takes 4 arguments and not just 2.
>
> css:
>
>> * {
>>   label: [PROP], [strReplace(PROP, '.', '_', true)];
>>   font-fill: black;
>> }
>
>
> sld:
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <sld:UserStyle xmlns="http://www.opengis.net/sld"; xmlns:sld="
>> http://www.opengis.
>>     <sld:Name>Default Styler</sld:Name>
>>     <sld:Title/>
>>     <sld:FeatureTypeStyle>
>>         <sld:Name>name</sld:Name>
>>         <sld:Rule>
>>             <sld:TextSymbolizer>
>>                 <sld:Label>
>>                     <ogc:PropertyName>PROP</ogc:PropertyName>
>>                 </sld:Label>
>>                 <sld:Fill>
>>                     <sld:CssParameter
>> name="fill">#000000</sld:CssParameter>
>>                 </sld:Fill>
>>             </sld:TextSymbolizer>
>>             <sld:TextSymbolizer>
>>                 <sld:Label>
>>                     <ogc:Function name="strReplace">
>>                         <ogc:PropertyName>PROP</ogc:PropertyName>
>>                         <ogc:Literal>.</ogc:Literal>
>>                         <ogc:Literal>_</ogc:Literal>
>>                         <ogc:Literal>true</ogc:Literal>
>>                     </ogc:Function>
>>                 </sld:Label>
>>                 <sld:Fill>
>>                     <sld:CssParameter
>> name="fill">#000000</sld:CssParameter>
>>                 </sld:Fill>
>>             </sld:TextSymbolizer>
>>         </sld:Rule>
>>     </sld:FeatureTypeStyle>
>> </sld:UserStyle>
>
>
>
> Hope this helps (and I'll fix the docs in a bit.)
>
> --
> David Winslow
> OpenGeo - http://opengeo.org/
>
> On Thu, Jun 23, 2011 at 8:26 AM, Andrea Aime <[email protected]
> > wrote:
>
>> On Thu, Jun 23, 2011 at 1:56 PM, Gis Mage <[email protected]> wrote:
>>
>>> Found a workaround:
>>> Two TextSymbolizers - first with underscores "_" characters, and the
>>> other one on top with the label field.
>>> My next question is - how to use a function, which calculates the lenght
>>> of the string and places equal number of "_" in a Label tag ?
>>>
>>> In general - is there a documentation on all existing functions (like
>>> PropertyIsEqualTo etc.) somewhere?
>>> Maybe a document or a web page?
>>>
>>
>> The reference document are the SLD and Filter specifications themselves,
>> you can download them
>> from the OGC web site.
>>
>> Filter functions, which is the part you need, are server specific and
>> listed here:
>> http://docs.geoserver.org/stable/en/user/filter/function_reference.html
>>
>> This blog also has some example on how to use them:
>>
>> http://blog.geoserver.org/2010/02/08/geoserver-hidden-treasures-filter-functions/
>>
>> Cheers
>> Andrea
>>
>> --
>> -------------------------------------------------------
>> Ing. Andrea Aime
>> GeoSolutions S.A.S.
>> Tech lead
>>
>> Via Poggio alle Viti 1187
>> 55054  Massarosa (LU)
>> Italy
>>
>> phone: +39 0584 962313
>> fax:      +39 0584 962313
>>
>> http://www.geo-solutions.it
>> http://geo-solutions.blogspot.com/
>> http://www.youtube.com/user/GeoSolutionsIT
>> http://www.linkedin.com/in/andreaaime
>> http://twitter.com/geowolf
>>
>> -------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------------
>> Simplify data backup and recovery for your virtual environment with
>> vRanger.
>> Installation's a snap, and flexible recovery options mean your data is
>> safe,
>> secure and there when you need it. Data protection magic?
>> Nope - It's vRanger. Get your free trial download today.
>> http://p.sf.net/sfu/quest-sfdev2dev
>> _______________________________________________
>> Geoserver-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>>
>
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to