layer type annotation ...label??
Richard Duivenvoorde
rdmailings at DUIF.NET
Fri Jul 20 01:59:17 PDT 2007
Hi John,
I've been fiddling with annotations myself recently and was suprised by
the (sometimes a little hidden) possibilities of it:
- there are several types of annotation:
1) pure text
2) use an image (SYMBOL CLASS) see
http://www.nabble.com/Example-of-placing-a-PNG-symbol-in-a-map.-tf1007115.html#a2610844
3) use your own font (eg truetype made from an image) and use that as
copyright (much like the little google txts all over the map in GoogleMaps)
- if you have varying size of maps, and still want to show your
copyright always in the lower right (50,50 pixels from the corner) of
your maps you can use TRANSFORM in combination with the LABEL-POSITION
stuff (see: http://mapserver.gis.umn.edu/development/rfc/ms-rfc-14)
Some examples:
ad 1: pure text
LAYER
NAME txtcopyright
STATUS default
TYPE annotation
TRANSFORM lr # we use lower right as 0,0 (lr, ll, ul, ur ...)
FEATURE
POINTS
0 -22 #this is the position of this point with 'lr' as 0,0
END
TEXT "© my copyright" #this is your displaying text
END
CLASS
# normal label stuff:
LABEL #defines the font, colors etc. of the text
FONT "arial" # as defined in your fonts.txt
TYPE TRUETYPE
ANTIALIAS TRUE
SIZE 8
BUFFER 3
OFFSET 2 2
POSITION ul
COLOR 128 128 128
FORCE TRUE
PARTIALS FALSE
END
END
END
ad 2: use of an image (via SYMBOL CLASS)
LAYER
NAME northnarrow
STATUS default
TYPE annotation
TRANSFORM ul # upper left corner
FEATURE
POINTS
90 90 #this is the position in image coordinates (pixels)
END
END
CLASS
SYMBOL "north" # this is a SYMBOL
COLOR 0 0 0
LABEL
MINFEATURESIZE 50
MINDISTANCE 150
SIZE TINY
COLOR 0 0 0
PARTIALS FALSE
FORCE TRUE
END
END
END
from mysymbols.sym file:
SYMBOL
NAME "north"
TYPE PIXMAP
IMAGE "mysymbols/north.png"
END
ad 3: use your own font (eg true type font made from an image)
LAYER
NAME logos
STATUS default
TYPE annotation
TRANSFORM false
FEATURE
POINTS
150 150 # some positions in the map
150 550
150 950
350 350
350 750
550 150
550 550
550 950
750 350
750 750
950 150
950 550
950 950
END
TEXT " " #this is your displaying text
END
CLASS
LABEL #defines the font, colors etc. of the text
# this is a custom truetype font build from an image
# defined in fonts.txt as: "myfont myfont.ttf"
FONT "myfont"
TYPE TRUETYPE
SIZE 48
BUFFER 2
COLOR 224 224 224
FORCE TRUE
PARTIALS FALSE
END
END
END
Hope this is helpfull for somebody.
Richard Duivenvoorde
John Smith wrote:
> if i just leave the annotation layer shown below in the map file, this
> is what gives?
>
> msDrawLegend(): GD library error. Unable to initialize image.
> msImageCreateGD(): Image handling error. Cannot create GD image of size
> 40 x 0.
>
> but why??
>
> i can label shape layers fine, just not annotation layers??
> jzs
>
> On 7/19/07, John Smith <jayzee.smith at gmail.com> wrote:
>> guys,
>> racked my brains on what may be a simple problem- trying to add some
>> copyright info like so:
>>
>> LAYER
>> NAME "copyright"
>> GROUP "metadata"
>> STATUS on
>> TYPE annotation
>> FEATURE
>> POINTS
>> 30 30 # position of text in image pixel
>> coordinates
>> END
>> TEXT "2007"
>> END
>> CLASS
>> LABEL
>> TYPE bitmap
>> COLOR 0 0 0
>> POSITION auto
>> END
>> END
>> END # layer
>>
>> what gives??
>> jzs
>>
>
>
More information about the MapServer-users
mailing list