[mapserver-users] Including a variable title on a map?

Fawcett, David David.Fawcett at state.mn.us
Mon Sep 29 09:48:43 EDT 2008


Robert, 
 
I tried to play with an example to get the substitution to work by just setting the feature text or layer text, but I got parse errors.  Those params may not be available for substitution.
 
My quick solution would be to create both the feature and it's text on the fly.  If you were setting the location for the title in the map file, I am guessing that you can hardcode it in the URL that requests the map.
 
Here is an example that does work: 
 
The URL:
# to create a new point feature
http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/workshop08/testPoint.map&mode=map&map.layer[howdy]=FEATURE+POINTS+0+0+END+TEXT+%27Goodbye%20World%27+END <http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/workshop08/testPoint.map&mode=map&map.layer[howdy]=FEATURE+POINTS+0+0+END+TEXT+%27Hello%20World%27+END> 
 
 
Here is the map file text:
 
MAP
 
  NAME 'hello_world'
  SIZE 500 500
  IMAGECOLOR 143 188 143
  EXTENT  -200 -200 200 200
  
LAYER
 NAME "howdy"
 STATUS DEFAULT
 TYPE ANNOTATION
 FEATURE
  POINTS
   0 0
  END
  #TEXT 'Hello World'
 END
 CLASS
  LABEL
   TYPE BITMAP
   COLOR 0 0 0
  END
 END
END  
  
 
END  # end of map


	-----Original Message-----
	From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Robert Sanson
	Sent: Sunday, September 28, 2008 4:09 PM
	To: mapserver-users at lists.osgeo.org
	Subject: RE: [mapserver-users] Including a variable title on a map?
	
	
	OK - thanks for the hints. I can now get a static string on my map as annotation, but I am still struggling to modify this via the URL. My map file snippet is:
	 
	 LAYER
	  NAME fid
	  STATUS ON
	  TYPE annotation
	  TRANSFORM false
	  FEATURE
	    POINTS
	      600 20 #this is the position of the text in image coordinates (pixels)
	    END
	    TEXT "úrmid%"
	  END   
	  CLASS
	    LABEL #defines the font, colors etc. of the text
	      FONT "arial"
	      TYPE TRUETYPE
	      SIZE 14
	      BUFFER 1
	      COLOR 255 0 0
	      OUTLINECOLOR 255 255 255 #--Halo
	      FORCE TRUE
	    END
	  END 
	 END
	 
	My URL contains this section:
	 
	&map.layer[fid].feature[0].TEXT=AS00001 
	 
	I have tried with and without quotes around the TEXT, and also with and without feature[0].
	 
	Any assistance appreciated.
	 
	Robert Sanson
	
	>>> "Fawcett, David" <David.Fawcett at state.mn.us> 26/09/2008 1:35 a.m. >>>
	
	If you want to allow the title string to be passed through the URL, you can use URL Configuration changes to pass the text in.  
	Take a look at this document (if you are using MapServer 5.x): http://trac.osgeo.org/mapserver/browser/branches/branch-5-0/mapserver/MIGRATION_GUIDE.TXT
	Scroll down to the section on URL configuration changes.  Take a look at example 3.  I am not sure if you can pass in just the text, or if you will need to pass in the feature coords and the text.  
	Combine this with the example that Jukka pointed you to and you should be set.
	David.

		-----Original Message-----
		From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Rahkonen Jukka
		Sent: Thursday, September 25, 2008 1:36 AM
		To: Robert Sanson; mapserver-users at lists.osgeo.org
		Subject: Re: [mapserver-users] Including a title on a map?
		
		
		Perhaps you could see if this copyright layer document points to right direction?
		http://mapserver.gis.umn.edu/docs/faq/copyright-layer
		 
		-Jukka Rahkonen-
		

________________________________

			Lähettäjä: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] Puolesta Robert Sanson
			Lähetetty: 25. syyskuuta 2008 7:02
			Vastaanottaja: mapserver-users at lists.osgeo.org
			Aihe: [mapserver-users] Including a title on a map?
			
			
			Is it possible to print a title on a map? I would like to be able to send a variable on the URL containing a string to be used as a title to embed into the returned image in a particular location.
			 
			I am using Javascript to formulate a CGI request for a PDF output, using mode=map.
			 
			Many thanks,
			 
			Robert Sanson



------------------------------------------------------------------
The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.
------------------------------------------------------------------	



			This message has been scanned for malware by SurfControl plc. www.surfcontrol.com <http://www.surfcontrol.com/> 



	Click here <https://www.mailcontrol.com/sr/8KBuz0TuG3PTndxI!oX7UihQAH2Wln+Dl3nxVTW8QEzLdM2kKMnUZ86pZht1Q5VlAx1tJ6swZg7wFL4l1WzKMQ==>  to report this email as spam.




------------------------------------------------------------------
The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.
------------------------------------------------------------------	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080929/63771ad0/attachment-0001.html


More information about the mapserver-users mailing list