(chinese) unicode labeling with postgis db

Mario Basa mario.basa at GMAIL.COM
Wed Feb 14 10:13:18 EST 2007


Hello Christian,

What I usually do if I have label encoding problems (w/c happens a lot
with japanese characters) is to create an annotation layer with an
inline feature and then test using different fonts or encoding
parameters. Something like this:

LAYER
    NAME "Label Test"
    STATUS DEFAULT

    TRANSFORM FALSE

    TYPE ANNOTATION
    FEATURE
      POINTS 420 420 END
      TEXT " Japanese_Characters_go_here "
    END

    CLASS
      LABEL
        TYPE TRUETYPE
        ENCODING SJIS
        FONT pgothic
        SIZE 10
        COLOR 255 255 255
        BACKGROUNDCOLOR 0 0 255
      END
    END
  END

Also, the ENCODING parameter translates the label into UTF-8,  so if
the label is in UTF-8 already, ENCODING shouldn't be necessary
anymore.

Regards,

Mario.

2007/2/14, Christian Sengstock <csengstock at gmail.com>:
> Hi list,
> i try to do labeling for chinese features but have some problems.
> I tried to make it the way i found in some docs in the internet and in
> the mail archive:
>
> - use a postgis unicode db
> - use unicode truetype fonts
>
> But unfourtunately its not working for now.
>
>
> I use a postgres/postgis dbms (PostgreSQL 8.0.9  POSTGIS 1.0.6) and
> mapserver 4.10.0 (ms4w package).
>
> My database is UNICODE encoded (imported with GB18030 client encoding).
> The unicode chars seem to be ok, i can use these chinese strings in my
> web application and they work.
>
> I have a point layer which i render with UMN mapserver.
> Now i tried to render the points like this...
>
> LAYER
>   NAME 'poi'
>   TYPE POINT
>   CONNECTIONTYPE postgis
>   CONNECTION '...'
>   DATA 'geom FROM geo.poi'
>   METADATA
>     'wms_title' 'poi'
>   END
>   STATUS ON
>   TRANSPARENCY 100
>   PROJECTION
>   'proj=longlat'
>    'ellps=WGS84'
>    'datum=WGS84'
>    'no_defs'
>   END
>   LABELITEM 'name'
>   CLASS
>      NAME poi
>      STYLE
>         SYMBOL 'circle'
>         SIZE 3
>         COLOR 255 150 150
>      END
>      LABEL
>        ANTIALIAS true
>        COLOR 255 255 255
>        OUTLINECOLOR 0 0 0
>        POSITION CC
>        OFFSET 0 2
>        BUFFER 2
>        TYPE TRUETYPE
>        FONT 'arialuni'
>        ANGLE auto
>        SIZE 8
>        #ENCODING UTF-8 | UNICODE ???
>     END
>   END
> END
>
> where font 'arialuni' ist the microsoft arial unicode font:
> arialuni ARIALUNI.TTF
>
> If i use ENCODING UNICODE, its no labels at all.
> If i use ENCODING UTF-8 (or GB18030), its like i have no ENCODING attribute.
>
> Attached is a screenshot from the map.
>
>
> Maybe someone can help or can point me to a good doc?
> Thanx a lot,
> Chris
>
>



More information about the mapserver-users mailing list