Copyright notice at the lower left of the map image

Daniel Morissette morissette at dmsolutions.ca
Wed Mar 7 17:52:18 EST 2001


Chad Streck wrote:
> 
> I saw the short thread on copyrights on an image and saw the mapfile
> layer definition that added the copyright, but I was wondering if there
> is a way of doing the same/similar thing in mapscript.  

Yes, it is possible to do the same with MapScript... at least part of
the reason why you're getting nothing is that you're setting some
parameter values in your layer as strings, but you should actually be
using constants:

       // base properties
       $layer->set('name', 'credits');
       $layer->set('status', MS_DEFAULT);
       $layer->set('transform', MS_FALSE);
       $layer->set('type', MS_ANNOTATION);


It would be much simpler if you defined your layer in the .map file, and
just altered the location of the copyright notice using MapScript. 
Assuming that you include the credits layer defn in your .map file, then
your function should be something like:

// add copyright
function copyright($mapobj, $imgObj, $author, 
                   $txtwidth=50, $txtheight=10) {
 
       $layer = $map->getLayerByName("credits");
 
       // point feature with text for location
       $point = ms_newpointobj();
       $point->setXY($mapobj->width - $txtwidth, 
                     $mapobj->height - $txtheight);

       $point->draw($mapObj, $layer, $imgObj, "credits",
                     "© 2001 $author");
 }

For this to work, you'll have to add a name to your class in the .map
file... the above example assumes the class name is "credits".  Finally,
the $imgObj parameter should have been obtained from a previous call to
$mapObj->draw() in your script.

-- 
------------------------------------------------------------
 Daniel Morissette                morissette at dmsolutions.ca
                 http://www.dmsolutions.ca/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.




More information about the mapserver-users mailing list