[Mapserver-users] query a dynamic layer...

Rainer Spittel rasp at tzi.de
Mon Jul 21 07:47:40 PDT 2003


Hi,

     I have a funny problem and I don't know what 'I' am doing wrong. I 
have a map file, called "test.map", containing two layers. The user 
shall append a new layer to the mapserver on the fly (e.g. 
"grp_points"). I am using MapServer 3.6.6 and PHP/MapScript and do the 
following stuff:

<?php
[...]

function GMapDrawMap()
{
     [...]
     $colorId = $gpoMap->addColor(22,222,222);

     $objLayer = ms_newLayerObj($gpoMap);

     $objLayer->set("name",   "gro_layer");
     $objLayer->set("type",   MS_LAYER_POINT);
     $objLayer->set("status", MS_ON);
     $objLayer->set("data",   "./gro_points");

     $objLayer->set("template", "ttt.html");

     $objLayer->setMetaData("DESCRIPTION","Custom features (Points)");
     $objLayer->setMetaData("RESULT_FIELDS","PROG_IN ATTRIBUTE CLASS");

     $objClass = ms_newClassObj($objLayer);
     $objClass->set("name","test");
     $objClass->set("color", $colorId);
     $objClass->set("symbol",1);
     $objClass->set("size",10);
     $objClass->set("template", "ttt.html");

     if ($gbShowQueryResults)
         $img = $gpoMap->drawQuery();
     else
         $img = $gpoMap->draw();

     $url = $img->saveWebImage($gAppletImgFmt, 0, 0, -1);
[...]

I inserted this code to the MSMapDrawMap function of the GMAP demo. This 
new layer will be displayed correctly, but I am not able to query (!) 
objects on this layer :-(
When I store this map-file with the command:

     $gpoMap->save("./test.map");

and open it again and the new point-layer is queryable. Hmmm, what did
I forget?
Why do I have to "append" these layers each time when the map will be 
redrawn? Or am I wrong with this presumption...


Thx,
Rainer
---------------------------------------------------------------
Dipl. Inf. Rainer Spittel
TZI - Center for Computing Technologies
Intelligent Systems
University of Bremen
Universitaetsallee 21-23, D-28359 Bremen, GERMANY
Tel: 0421/218-7091 Fax: 0421/218-7196
E-Mail: mailto:rasp at tzi.de




More information about the MapServer-users mailing list