Dynamic map annotation in animated GIF file

Burgholzer,Robert rwburgholzer at DEQ.VIRGINIA.GOV
Mon Jul 9 18:14:42 EDT 2007


I am trying to produce a time series animated GIF, with an annotation at
the bottom of the map that shows the time.  Thanks to an example from
Charlton Purvis found by a search of previous postings on making an
animated GIF (modified to use a single layer, changing the filter to
select for the data that is in my current time step):

http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0304/msg00482.h
tml

 

And a Wiki entry from Jeff McKenna about making a copyright notation:

http://mapserver.gis.umn.edu/docs/faq/copyright-layer

 

I have the basics, that is, an animated time series, with a statically
placed text entry at the bottom (at a map-specific point, rather than a
lat lon).  However, the annotation layer can only display a single
entry, not one that is updated with the time step.  I am wondering how
to do this, if I can modify the property of the annotation layer, or if
I need to create a point of some sort from a dynamic postgis call.  I
can't seem to set the TEXT portion of the feature via php mapscript.

 

Anyone have any ideas? (code and mapfile follow)

 

foreach ($gifmaps as $thismap) {

   $thislayer = $amap->map->getLayerByName('stream_stat');

   $filter = " projectid = $projectid and thismetric = '$thismap' ";

   $listobject->querystring = " select count(*) as numrecs from
proj_group_stat ";

   $listobject->querystring .= " where $filter ";

   $listobject->performQuery();

   $numrecs = $listobject->getRecordValue(1,'numrecs');

   #$annotlayer = $amap->map->getLayerByName('copyright');

   #$annotation = $annotlayer->getFeature(1,-1);

   if ($numrecs > 0) {

      $thislayer->setFilter($filter);

      $thislayer->set("status",MS_ON);

      #$annotation->set("TEXT", $filter);

      $image[$i]     = $amap->map->draw();

      $image_url[$i] = $image[$i]->saveWebImage(MS_GIF,1,1,0);

      $file_path[$i] = $amap->map->web->imagepath 

                       . substr(strrchr($image_url[$i], "/"),1);

      $anim_files   = $anim_files . '"' . $file_path[$i] . '"' . " ";

      $i++;

      print(" Adding <i>$filter</i>, $image_url[$i] <br>");

   }

 }

 

// Create a unique filename and URL for the animated GIF output

 $anim_name = "anim".substr(strrchr($image_url[1], '/'),1);

 $anim_path = '"' . $amap->map->web->imagepath . $anim_name .'"';

 $anim_url = $amap->map->web->imageurl . $anim_name;

 

 print("Creating $anim_path <br>");

 $cmd = $anim_gif_cmd . " -o " . $anim_path . " " .  $anim_files;

 print("Using: $cmd <br>");

 

 system($cmd);

 

# annotation layer

LAYER

  NAME copyright

  STATUS ON

  TYPE annotation

  TRANSFORM false

  FEATURE

    POINTS

      150 180 #this is the position of the text in image coordinates
(pixels)

    END

    TEXT "From 2007/01/01 to 2007/06/30" #this is your displaying text

  END   

  CLASS

    LABEL #defines the font, colors etc. of the text

      FONT "arial"

      TYPE TRUETYPE

      SIZE 10

      BUFFER 1

      COLOR 0 0 0

      BACKGROUNDCOLOR 255 255 255

      FORCE TRUE

    END

  END 

END

Robert W. Burgholzer

Surface Water Modeler

Office of Water Supply and Planning

Virginia Department of Environmental Quality

rwburgholzer at deq.virginia.gov

804-698-4405

Open Source Modeling Tools:

http://sourceforge.net/projects/npsource/

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070709/c28a4525/attachment.html


More information about the mapserver-users mailing list