[mapserver-users] Re: Python mapscript: inline point feature How To
Roger André
randre at gmail.com
Tue Feb 24 15:53:39 PST 2009
Answered my own question using Sean Gillies AWESOME unit tests - again.
http://kentuckykarst.org/mapserver/mapscript/python/tests/cases/fonttest.py
title_layer = mapobject.getLayerByName("title")
point = mapscript.pointObj(500, 4)
coords = mapscript.lineObj()
coords.add(point)
feature = mapscript.shapeObj(title_layer.type)
feature.add(coords)
feature.text = title_string
title_layer.addFeature(feature)
I also had to comment out the FEATURE section of my mapfile, in order to
prevent having 2 entries in the resulting map.
--
On Tue, Feb 24, 2009 at 2:44 PM, Roger André <randre at gmail.com> wrote:
> Hi Everyone,
>
> A little while ago, Brent Fraser sent me a mapfile snippet that could be
> used to add a Title to a map using pixel coordinate space. It looked like
> this:
>
> LAYER
> NAME title
> STATUS DEFAULT
> TRANSFORM FALSE
> TYPE ANNOTATION
>
> FEATURE
> POINTS 4 396 END
> TEXT 'This is a Great Map!'
> END
>
> CLASS
> LABEL
> TYPE TRUETYPE
> FONT arial
> SIZE 8
> ANTIALIAS
> COLOR 255 255 255
> POSITION UR
> END
> END
>
> END
>
> This works well, but I would like to override the TEXT value using
> mapscript to create new labels that are based on the result of PostGIS
> queries. I've been picking apart various examples on the web, but can't
> seem to come up with the magic sauce. I can figure out how to grab the
> layer ByName, but then I'm not quite sure what I need to do in order to
> access the feature and override the TEXT.
>
> Can someone give me a clue?
>
> Thanks,
>
> Roger
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090224/2513febf/attachment.htm>
More information about the MapServer-users
mailing list