Mapscript, SVG and Annotations

kk+w - digitale kartografie GmbH mweinelt at PLANIGLOBE.COM
Mon Jul 9 11:54:15 PDT 2007


Hi,

I am using addFeature to dynamically add site locations with a label to a map.
It's Perl mapscript. 

@sites is an array of hash references, $sitesLyr is from the map file:

###############
 foreach my $site (@sites) {
   my $site_pt = $$site{'site_loc'};
      $site_pt =~s/.*\((.*)\)*./$1/;  # extract the points x and y
   my $line     = new mapscript::lineObj();
   my $siteShp  = new mapscript::shapeObj($mapscript::MS_SHAPE_POINT);

   my $point = new mapscript::pointObj();
   my($x,$y) = split(/ /, $site_pt);
      $point->setXY($x,$y);
      $line->add($point);
      $siteShp->add($line);
      $siteShp->{text} = $$site{'site_name'};
      $siteShp->setBounds();
      $sitesLyr->addFeature($siteShp);
  }
 
 my $img = $map->draw();

#############

This works perfectly for the usual PNG output map. Using the same routine for a
SVG 'image' results in the symbols/markers getting plotted, but the labels are
missing. If I switch to a static shapefile for this layer, the labels do appear
in the SVG. 

Is there anything special with SVG output and the 'addFeature' method for layers
that I am missing? 

Thanks,

Martin



More information about the MapServer-users mailing list