NET-Mapnik icon indicating copy to clipboard operation
NET-Mapnik copied to clipboard

TextSymbolizer never wraps text

Open rouen-sk opened this issue 8 years ago • 3 comments

If I understand documentation correctly, TextSymbolizer should wrap every label longer than pixel-width specified in wrap-width. However, none of my labels are wrapped. I am using postgis datasource, but I even tried constant text in style XML, and result is still unwrapped. The rendered text is 3-times longer than wrap-width. Adding or removing wrap-before="true" changes nothing.


<Rule>
      <MaxScaleDenominator>3000000</MaxScaleDenominator>
      <MinScaleDenominator>200000</MinScaleDenominator>
      <TextSymbolizer size="14" fontset-name="fontset-3" wrap-width="50" fill="#333333" halo-fill="rgba(255, 255, 255, 0.5)" halo-radius="1" halo-rasterizer="fast">"Nove mesto nad Vahom"</TextSymbolizer>
    </Rule>

mapnik_no_wrapping

I created this issue also at mapnik (https://github.com/mapnik/mapnik/issues/3263), but maybe it is bug on NET-Mapnik, because I dont thing issue like this would go unnoticed by all the mapnik users?

rouen-sk avatar Mar 24 '16 13:03 rouen-sk

Update: I just tried to generate the same tile (with same style XML and from same DB) with python binding over mapnik 2.2.0. and the labels are wrapped. So it is probably NET-Mapnik's issue somehow. (Didnt test it with mapnik 3.0 because no binaries are avaiable to download)

rouen-sk avatar Mar 24 '16 14:03 rouen-sk

Didnt test it with mapnik 3.0 because no binaries are avaiable to download

@rouen-sk here's a 3.0.10 SDK https://mapnik.s3.amazonaws.com/dist/dev/mapnik-win-sdk-v3.0.10-x64-14.0.7z but Python bindings are not guaranteed to work as 3.x Python bindings still need some love. Use at own risk.

wilhelmberg avatar Mar 24 '16 15:03 wilhelmberg

Thanks @BergWerkGIS . Tried it with x86 version (python import failed with 64bit dll), but could not get it to work. I always get

Mapnik LOG> 2016-03-29 10:01:54: warning: unable to find face-name 'Open Sans Bold' in FontSet 'fontset-0'
Mapnik LOG> 2016-03-29 10:01:54: warning: unable to find face-name 'DejaVu Sans Book' in FontSet 'fontset-0'
Traceback (most recent call last):
  File "C:\mapnik-sdk\demo\python\rundemo2.py", line 36, in <module>
    mapnik.load_map(m,"my.style.xml")
RuntimeError: no valid fonts could be loaded in FontSet 'fontset-0' in FontSet o
f 'my.style.xml'

even if I use absolute path to fonts directory in python script like mapnik.register_fonts("c:\mapnik-sdk\lib\mapnik\fonts")

I guess this is one of the love-needing parts...

rouen-sk avatar Mar 29 '16 11:03 rouen-sk