[Mapserver-users] [PHP] dynamic point data query (again) HELP PLEASE!!!!!

Gijs Epping gijs at gijs.com
Tue Apr 20 10:33:51 EDT 2004


Hello poeple,

Is there really nobody that creates point shapes on the fly and then
wants to query on them with php, I Asked this before last week but I
only got some reactions from perl people and they can do it because they
can set the index from a shape.

I can't set the index with php because it is only readable see the url:

http://mapserver.gis.umn.edu/doc40/phpmapscript-class-guide.html#ShapeOb
j

There must be a work around for his problem because if you can do it
with perl why can't you do it with php?????

Here is the code again.

$layerObj = $gpoMap->getLayerByName('virtpoint');
$shp =ms_newShapeObj(MS_SHAPE_POINT);
$line = ms_newLineObj();
$line->addXY($point_lookup[0], $point_lookup[1]);
$shp->add($line);
//$shp->set(index, $i); // the problem!!!!!
$layerObj->addFeature($shp);


if you want to do the following you get the script say's "index is only
readable" error:

$shp->set(index, 1); 
In perl you would write this as following: $shp->{index}=2 And this
works I think

The point is created, and when you query the point it is marked as
"queryd" but the result I get back from "$oRes =
$oLayer->getResult($iRes);" is:

stdClass Object ( [shapeindex] => -1 [tileindex] => -1 [classindex] => 0
)

The following code gets the queryd shape from the layer:

$oShape = $oLayer->getShape($oRes->tileindex,$oRes->shapeindex);

The error I get is:
Fatal error: [MapServer Error]: msLayerGetShape(): Cannot retrieve
inline shapes randomly.

The shape index should be set but it is not. 

I hope somebody can help me I am really stuck at the moment and I really
need this to work.

Thanks in advance.
Gijs




More information about the mapserver-users mailing list