[Mapserver-users] annotating multiple inline features

Dylan Keon keon at nacse.org
Fri Mar 21 10:00:25 PST 2003


Yeah, I call drawLabelCache() right before saveWebImage().

That bug report from the 3.5 era mentions the shape->draw() method no 
longer takes class index and text string arguments.  The documentation 
hasn't changed, though.  What's the status of shape->draw() in 3.6.x and 
3.7?

Seems like another way to do this might be to add an annotation layer to 
the mapfile, then for each line create a new shape containing one point, 
and use shape->set('text', 'test') to set annotation for that feature. 
I'll give this a shot.  Anyone else tried this?

Thanks,
Dylan


Steve Lime wrote:
> Are you drawing the label cache further down in your code?
> 
> 
>>>>Dylan Keon <keon at nacse.org> 03/20/03 06:22PM >>>
> 
> Hi,
> 
> I'd like to label multiple inline features with text from user input. 
>  From the 3.7 PHP MapScript docs it sounds like the ShapeObj draw() 
> method should do this ("The text string is used to annotate the
> shape"). 
>   I figured I could label each feature this way as long as each feature
> 
> was put in a separate shape.  The features are created just fine, but I
> 
> don't get any labels.  I'm using 3.7 from a week ago.
> 
> Is it related to this old bug?
> http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=36 
> 
> If this method is no longer available, can someone recommend a way to 
> label inline features in a similar manner?
> 
> Thanks,
> Dylan
> 
> 
>    $image = $map->draw();
>    $layer = $map->getLayerByName('flightlines');
> 
>    for($i = 0; $i <= (count($beginlat) - 1); $i++) { 
> 
>      $shape = ms_newShapeObj(MS_SHAPE_LINE); 
> 
>      $line = ms_newLineObj(); 
> 
>      $line->addXY($beginlon[$i], $beginlat[$i]);
>      $line->addXY($endlon[$i], $endlat[$i]);
>      $shape->add($line); 
> 
>      $shape->draw($map, $layer, $image, 0, $label[$i]); 
> 
>      $line->free(); 
> 
>      $shape->free(); 
> 
>    }
> 
> 
> LAYER
>    NAME flightlines
>    STATUS ON
>    #DATA #not needed, dynamic layer
>    TYPE LINE
>    CLASS
>      COLOR 255 0 0
>      SYMBOL 'circle'
>      SIZE 4
>      LABEL
>        TYPE TRUETYPE
>        FONT ARIAL
>        SIZE 14
>        COLOR 0 0 0
>      END
>    END
> END




More information about the MapServer-users mailing list