[mapguide-users] Watermarking a Map

Crispin at 1Spatial Crispin.Hoult at 1Spatial.com
Wed Sep 24 12:17:36 EDT 2008


Stuart,

This is excellent and will certainly do for my (current) requirements that
do not need to interface with the Legend... but apparently position '3' is
not allowing me to resize the legend or turn layers on or off.

Positioning the watermark just under the slider places it just above the
legend and so a better position is to drill into the tbMap / map / mapSpace
?

Many many thanks.

 Crispin



gingerbbm wrote:
> 
> 
> 
> 
>>> Here is Fridays problem - Watermarking a map.  Not in Fusion, just on a
>>> basic layout.
>> 
> 
> Here's what I came up with (for the Ajax viewer). The expected parameters
> to
> this JavaScript method are:
> 
> doc: The document object, such as that returned by
> "frames['mapFrame'].document"
> imageUrl: The path to the watermark tile, e.g. "/images/watermark.gif"
> 
> So this method will insert a DIV that covers the entire map with the tiled
> image. My image is transparent except for the required watermark string.
> In
> the code I set the opacity, but this is probably not necessary if you get
> your image looking the way you want it to beforehand. There are two
> important things to note:
> 
> 1. I'm using this in a WebLayout with no left or right pane, and the
> middle
> pane comprises the status bar and zoom control only (plus the map of
> course). In this configuration the map frame is resizeable despite no left
> pane being present, which is undesirable. Fortunately, the watermarking
> method below covers this up and prevents manual resizing.
> 
> 2. The z-index of the inserted DIV must be configured to be less than that
> of the zoom control ("scale slider") so that it appears underneath, but
> still above the map image.
> 
> 
> 	ShowInAjaxViewer: function(doc, imageUrl) {
> 
> 		if (!doc) return;
> 		if (!imageUrl) return;
> 
> 		//
> 		// Create a DIV to hold the watermark.
> 		//
> 		var watermark = doc.createElement('div');
> 
> 		//
> 		// Assign the passed-in background image URL.
> 		//
> 		watermark.style.backgroundImage = 'url(' + imageUrl + ')';
> 
> 		//
> 		// This value is very important. It must be less than the lowest z-index
> 		// value used by the scale slider (which happens to be 4 at the time of 
> 		// writing.
> 		//
> 		watermark.style.zIndex = '3';
> 
> 		//
> 		// The rest of the styles.
> 		//
> 		watermark.style.position = 'absolute';
> 		watermark.style.width = '100%';
> 		watermark.style.height = '100%';
> 		watermark.style.opacity = 0.5;
> 		watermark.style.filter = 'alpha(opacity=50)';
> 
> 		doc.body.insertBefore(watermark, doc.body.firstChild);
> 	}
> 
> 
> Hope this helps somebody.
> 
> Cheers
> Stuart
> -- 
> View this message in context:
> http://n2.nabble.com/Watermarking-a-Map-tp1085166p1112325.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Watermarking-a-Map-tp19457144p19652458.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list