point query and new layer
Sven Kroemeke
geotux at yahoo.com
Mon Nov 13 11:41:50 PST 2000
Hello everybody,
I have some questions, most of them were posted before, but
unfortunately I couldn't find answers - so I am not sure
if there are answers and how the current state is!
1) the point query problem:
I read many questions about it, but is it solved?
I recompiled mapserver in order to advance to
mapscript (php) because I want to use a real database
(mysql). Since now I didn't try the mapscript query functions,
because of the existing problems with other functions.
But in both "mapserv" versions (browsing, querying without
mapscript) I had problems querying points!
- In the original version (gif instead of png, no ttf, etc.)
the server hanged on point queries, causing a not terminating
process with high cpu usage.
- the recompiled version (png, ttf, with mapscript support)
causes a segmentation fault with apache returning an empty
document.
I already have read the advice to use a different type
(lines) e.g. a box around the point, but is there not
a more sophisticated solution?
(in fact mapserver does something, because if the queried
point is out of range it returns that it couldn't find
an item, but if it is in range then there is no answer
just as described above)
2) how can I create a new shape? (php, please)
(Since I use a real DB I want to get more independend
from the map file and use a DB-table with some information
about the layers, classes etc. I only want to use the map
file as dummy, almost empty - but some important information
is still needed in the map file)
In this case I want create a new (annotation) layer when my
layer in the DB has the property: annotation.
I tried the following...
if (isset($HTTP_GET_VARS["$row[0]"])) {// is it turned on within
FORM
$layer=$map->getLayerByName($row[0]);
if ($row[4]) { // is labelitem set
$layer->draw($img); // write layer
$annotationlayer=ms_newLayerObj($map); //NEW LAYER
$annotationlayer->set("name",$row[0]."_annotation");
$annotationlayer->set("type",MS_ANNOTATION);
$annotationlayer->set("status",MS_DEFAULT);
$annotationlayer->set("data",(string)$row[6]);
$annotationlayer->set("labelitem",(string)$row[5]);
$annotationlayer->set("labelcache",MS_ON);
$annotationlayer->set("classitem",(string)$row[4]);
if ($row[10])
$annotationlayer->set(labelminscale,$row[9]);
if ($row[11])
$annotationlayer->set(labelmaxscale,$row[11]);
$l_class=ms_newClassObj($annotationlayer);
$l_class->set("name",$row[0]);
$l_class->label->set("color", $map->addColor(0,0,0));
$l_class->label->set("shadowcolor",
$map->addColor(218,218,218));
$l_class->label->set("type", MS_BITMAP);
$l_class->label->set("size", MS_TINY);
$l_class->label->set("position", MS_CC);
$l_class->label->set("partials", MS_FALSE);
$l_class->label->set("buffer", 2);
$annotationlayer->draw($img);
}//end of labelitem
2)How is the php mapscript syntax?
(this question is related to the two others)
I never used objects in php before, so I just took some
examples and used them, and it seemed to work. The
variables are set! Most of the examples are Perl, so I
used $layer->set(property,value);
but also $layer->property=value; seemed to work!
Further more I found that $layer->getclass() is not documented
in mapscript(PHP) (maybe more functions??)!
To set an annotation I found a description how to annotate
a layer using the property (annotate), but it doesn't work
with the set(,) function, because it doesn't seem to exist!?
3) How can I change properties in the mapfile on the fly?
Due to the problems above I also couldn't change existing
layers, class properties ... the variables are set but
nothing changes on the map - I tried size (of a symbol),
color and outlinecolor but only outlinecolor works!
$old_class->set("size",40);
$old_class->set("color",$map->addColor(218,218,218));
//DOESN'T WORK??
$old_class->set("outlinecolor",$map->addColor(218,218,218));
//WORKS!!
$layer->draw($img); // draw layer
I have Mandrake Linux 7.1 running Mapserver Version (3.3.011)
PHP version (3.0.13). Thanks in advance!!
S. Kroemeke
PROCERGS
Brasil
__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/
More information about the MapServer-users
mailing list