Layer working in mapfile, not (fully) working within PHP
Hoeven, Maarten van der
Maarten.van.der.Hoeven at KNMI.NL
Sun Jun 26 13:57:21 PDT 2005
Hi list,
thanks for all your help; all suggestions are most useful!
My problem is, when I use the layer-definition from the mapfile, the countries as well as the country names are displayed. However, when I dynamically build my layer in PHP (commenting out the whole 'country_name' layer-definition in the mapfile, of course), the countries are displayed okay, but the country names are *not* displayed at all. I do want to display the country names from the layer I defined in the PHP script.
Any guru can see what's wrong?
All the best,
Maarten
=== mapfile ===
LAYER
NAME country_name
METADATA
"RESULT_FIELDS" "CNTRY_NAME"
END
TYPE POLYGON
STATUS ON
DATA country_eca
LABELITEM 'CNTRY_NAME'
CLASSITEM 'CNTRY_NAME'
CLASS
NAME 'CNTRY_NAME'
STYLE
OUTLINECOLOR 0 0 0
COLOR 255 255 191
END
LABEL
POSTLABELCACHE TRUE
MINFEATURESIZE 40
POSITION CC
PARTIALS FALSE
COLOR '#000080'
SIZE GIANT
END
END
END # layer
=== php script (part of it) ===
$layerObj1 = ms_newLayerObj($gpoMap);
$layerObj1->set("name","country_name");
$layerObj1->set("type",MS_LAYER_POLYGON);
$layerObj1->set("status",MS_ON);
$layerObj1->set("data","country_eca");
$layerObj1->set("labelitem","cntry_name");
$layerObj1->set("classitem","cntry_name");
$layerObj1->setMetaData("result_fields","cntry_name");
$classObj1 = ms_newClassObj($layerObj1);
$classObj1->set("name","cntry_name");
$styleObj1 = ms_newStyleObj($classObj1);
$styleObj1->color->setRGB(255,255,191);
$styleObj1->outlinecolor->setRGB(0,0,0);
$classObj1->label->set("size",MS_GIANT);
$classObj1->label->set("position",MS_CC);
$classObj1->label->set("minfeaturesize",40);
$classObj1->label->set("partials",MS_FALSE);
$classObj1->label->color->setRGB(0,0,80);
$layerObj1->draw($img);
More information about the MapServer-users
mailing list