[mapserver-users] Annotations not appearing on map with phpMapscript

NVohra at eq-technologic.com NVohra at eq-technologic.com
Tue Nov 26 04:00:36 EST 2002


Hello,
     I have PHP ver4.0.6 with MapScript Version (Nov 27, 2001) and
MapServer version 3.5 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG
     OUTPUT=WBMP SUPPORTS=PROJ SUPPORTS=TTF SUPPORTS=WMS_SERVER
SUPPORTS=WMS_CLIENT INPUT=EPPL7 INPUT=OGR INPUT=GDAL
     INPUT=SHAPEFILE on WinNT.

     I need to put annotations in the map, after user zooms-in to some
level.
     My map file looks like this :

     LAYER
          NAME line3
          TYPE annotation
          DATA linedata
          STATUS DEFAULT
          LABELCACHE on
          LABELITEM "LABEL"
          CLASSITEM "LABEL"
          CLASS
               EXPRESSION ([ID] == 0)    #to avoid showing annotation on
start
               NAME "lblclass"
               OUTLINECOLOR 199 216 252
               COLOR 199 216 252
               LABEL
                    ANGLE AUTO
                    BUFFER 3
                    FONT arial
                    TYPE truetype
                    SIZE 8
                    COLOR 0 0 0
                    OUTLINECOLOR 199 216 252
                    POSITION cc
                    FORCE true
                    BACKGROUNDCOLOR 255 255 255
               END
          END
     END

     My php file has code like this :

     if ($zoomlevel >= 4)
     {
          $layer = $map->getLayerByName('line3');
          $layer->annotate = 1;

          $class = $layer->getClass(0);
          $class->setExpression("([ID] == 15004 || [ID] == 14683)");
          $class->color = "255 136 136";
          $layer->classitem="LABEL";

          $class->label->autoangle = 1;
          $class->label->buffer = 3;
          $class->label->font = "aerial";
          $class->label->type = MS_TRUETYPE;
          $class->label->size = 8;
          $class->label->color = $map->addColor(0,0,0);
          $class->label->outlinecolor = $map->addColor(199,216,252);
          $class->label->position =  MS_CC;

          $layer->draw($image);
     }

     I went through mailing list and did changes like
     $layer->annotate = 1; and
     $layer->classitem="LABEL";

     But still annotations are not coming on map. They work if loaded
directly from map file by keeping
     status of layer "ON", but then they stay on always and I am unable to
control them.

Nischal Vohra
- - - - - - - - - - - -
That one last shot's a Permanent Vacation
And a how high can you fly with broken wings
Life's a journey - not a destination
And I just can't tell just what tomorrow brings -
Aerosmith
- - - - - - - - - - - -





More information about the mapserver-users mailing list