[Mapserver-users] php mapscript + labelobj
Marcel Koopman
publiek at home.nl
Thu May 6 04:43:46 PDT 2004
Hello,
I've written a php function to add classes to a layer.
------------------------------------------------------------
function addClass ($naam, $expr, $red, $green, $blue) {
$class = ms_newClassObj($this->$layer);
$class->set(name, $naam);
$class->setexpression($expr);
$class->settext($this->$layer,"titel");
$class->label->color->setRGB(0,0,0);
$class->label->size = 8;
$class->label->antialias = 1;
$class->label->font = "arial";
$style = ms_newStyleObj($class);
$style->color->setRGB($red,$green,$blue);
}
------------------------------------------------------------
This works, except for the label part. In the mapfile there is no label.
Generated part:
------------------------------------------------------------
LAYER
CONNECTION "user=postgres dbname=testdb"
CONNECTIONTYPE POSTGIS
DATA "the_geom from gem_gron_poly"
LABELITEM "perc_studenten_man_roc"
NAME "perc"
SIZEUNITS PIXELS
STATUS ON
TOLERANCE 0
TOLERANCEUNITS PIXELS
TYPE POLYGON
UNITS METERS
CLASS
NAME "Percentage mannelijke studenten ROC"
EXPRESSION ([PERC_STUDENTEN_MAN_ROC])
STYLE
COLOR 0 0 0
MAXSIZE 100
MINSIZE 1
SIZE 1
SYMBOL 0
END
TEXT "titel"
END
END
------------------------------------------------------------
What i want to have is:
------------------------------------------------------------
LAYER
CONNECTIONTYPE postgis
NAME perc
CONNECTION "user=postgres dbname=testdb"
DATA "the_geom from gem_gron_poly"
STATUS off
TYPE POLYGON
PROJECTION
"init=epsg:28992"
END
LABELITEM "PERC_STUDENTEN_MAN_ROC"
CLASS
NAME "Percentage mannelijke studenten ROC"
EXPRESSION ([PERC_STUDENTEN_MAN_ROC])
LABEL
COLOR 0 0 0
SIZE 8
ANTIALIAS TRUE
FONT ARIAL
TYPE TRUETYPE
END
END
END
------------------------------------------------------------
How do i get the label part with php mapscript?
Thanks.
Marcel
More information about the MapServer-users
mailing list