How do I embed any text onto the map

Steve Lime steve.lime at DNR.STATE.MN.US
Thu Dec 1 22:32:33 PST 2005


Hi Aniruddha: The way to do that is using inline layers. For example:

LAYER
  NAME 'copyright'
  TYPE ANNOTATION
  STATUS DEFAULT
  TRANSFORM FALSE # coordinates are in pixels
  FEATURE
    POINTS 10 10 END
  END
  CLASS
    LABEL 
      SIZE MEDIUM
      COLOR 0 0 0
      OUTLINECOLOR 255 255 255
      POSITION CR
    END
    TEXT 'Copyright 2005'
  END
END

This would place the text 'Copyright 2006' towards the upper-left hand corner of the map, just to the right of the pixel coordinate 10,10. You could do similar things with a custom string:

  - you can alter the CLASS TEXT dynamically with run-time subsitutions (e.g. TEXT '%title%')

 and a north arrow marker:

  - use a POINT layer that references a north arrow graphic in the CLASS STYLE

The problem you'll run into is that inline pixel coordinates are absolute so they really only work with one image size. (except for the UL corner which is always 0,0) The only solution there is to either have 1 mapfile for each image size you need. You could muck with the coordinates at runtime possibly too. 

Ideally we'd allow relative pixel coordinates some like:

FEATURE
  RELATIVETO LR
  POINTS -50 -50 END
END

Which would give you a point just inside the lower right-hand corner, but alas it has not been implemented. (not a bad idea and not that hard- I'll file a bug now).

Steve

>>> "Aniruddha S. Khadkikar" <as.khadkikar at NCL.RES.IN> 12/01/05 11:34 PM >>>
Hi,
I am unable to resolve how to add any text on the map.
I wish to add the following elements:
1. Copyright statement for the image produced.
2. North Symbol
3. Dynamic text e.g. Name of the species for which the distribution map 
is being generated.

I am providing an option for downloading the image at 100, 200,300 dpi. 
I am using pmapper for the project. So it is necessary that the final 
jpg file have all these details on the image itself. All the above 
elements will be 'relatively' fixed on the map. i.e. I want the name on 
the upper left corner, north symbol and copyright statement towards the 
upper right corner of the map.

I hope I am clear.

Aniruddha
-- 
ANIRUDDHA S. KHADKIKAR Ph.D.
.....................................................
Digital Information Resource Centre
National Chemical Laboratory
Dr. Homi Bhabha Road
Pune 411008, INDIA
.....................................................
Phone : 91 020 25893457 (Off)
Fax   : 91 020 25893973
Email : as.khadkikar at ncl.res.in
Web   :  http://www.ncbi.org.in
.....................................................

*****************************************************************
This email is virus free by TrendMicro Inter Scan Security Suite.
*****************************************************************



More information about the MapServer-users mailing list