[mapserver-users] highlight of query ? using php

David Armstrong david.armstrong at ntlworld.com
Wed Feb 27 04:33:41 EST 2002


I am trying to query then highlight the given object using php under
windows,
but i just cannot get the highlight to work ! .

below is  the snipp of code thats's bugging me !

the application can be seen here Based on DM Solutions Excellent  Demo
GMAP75
http://trackitdirect.com/track4/track4.php

my logic is as follows

I have a map-file with 2 layers. The first is the 'park' layer with status
as ON, and the other is 'parklight' with status set to OFF.
 From a database-query using PHP the row of the object is found. Zooming
into the extents of the found shape works fine.

Maybe the logic of creating the highlight should be something like:

1) Create new MapObject
2) Find index of shape (works fine here, no problem)
3) Copy that shape to a new ShapeFileObject   ( i think this is where i
screwd up ! )
4) Add this ShapeFileObject to an empty/dummy layer ( here also )
5) Change status of that dummy layer to ON
6) Show new created map

Like the option QueryPoint there does not seem to be an option/function to
show the object in highlight using only it's index.( would be nice to have i
think )
( or at least i can't find one )


here's the offending code !


                  $TESTMap = ms_newMapObj("track4.map");

                   $TESTshapeFileObj =
ms_newShapeFileObj($ShapefileName, -1 );


                   // Show the queried object, by turning ON a dummy layer:
                   // Default layername for this is --> layer + 'Query' -->
eg. parkQuery

                   //$QueryLayerName = $qlayer . 'Query';
                   //$poLayer = $TESTMap->getlayerbyname($QueryLayerName);


                   // Create shape object.
                   $oShape = ms_newShapeObj(-1);

                   // Retrieve shape into shape object.
                   $oShape = $TESTshapeFileObj->getShape($value -1);

                   // Add shape
                   $TESTshapeFileObj->addShape($oShape);




                   //$poLayer = $TESTMap->GetLayer($qlayer);
                   //$oRes = $poLayer->getResult(1);
                   //$oShape =
$poLayer->getShape($oRes->tileindex,$oRes->shapeindex);


                   $poLayer->set("status", 1);


 //$poLayer = $map->getLayerByName('park');

 # Turn it on.
//$sellayer->{status} = $mapscript::MS_ON;
$poLayer->set("status", 1);
#
# Set the data path to the new shapefile.
$poLayer->data = "C:\\phpdev\\www\\aweb\\track4\\data\\park";


                   // Draw the queried object
                   $imgXX = $TESTMap->drawQuery();
                   $urlXX = $imgXX->saveWebImage($imgXX, 0, 0, -1);
                   echo"<INPUT TYPE=image SRC=$urlXX NAME=zoommap
WIDTH=$QueryMap->width HEIGTH=$QueryMap->height>\n";

//end of code







More information about the mapserver-users mailing list