Labels using shape index

Eric Shuman erics at AMERI-TITLE.COM
Tue Jul 26 20:05:07 EDT 2005


So for anyone interested in my final solution...
I ended up just using a blank annotation layer from my map file and adding
the shapes from the query results then assigning the counter (+1) to it.
The relevant PHP code and layer deffinition are below.

  ...

  $Results = $Layer->getNumResults();
  $Anno_layer = $map->getLayerByName('QUERY_ANNO');

  for ($x=0; $x<$Results; $x++)
  {
    $Result = $layer->getResult($x);
    $Layer->open();
    $Shape = $Layer->GetShape($Result->tileindex,$Result->shapeindex);
    $Shape->set('text', $x+1);
    $Anno_layer->addFeature($Shape);

  }

  ...


  LAYER # Query Annotation
    NAME "QUERY_ANNO"
    TYPE ANNOTATION
    STATUS default
    CLASS
      LABEL
        COLOR 132 31 31
        BACKGROUNDCOLOR 235 235 235
        BACKGROUNDSHADOWCOLOR 0 0 0
        SIZE 6
        TYPE TRUETYPE
        FONT SANS
        POSITION CC
        BUFFER 2
 FORCE TRUE
      END # end of label
    END
  END



More information about the mapserver-users mailing list