[mapserver-users] Highlighting a found shape through it's index

Azimuth, Erwin Perik perik at azimuth.nl
Mon Feb 25 03:40:29 PST 2002


Hi All,

i'm still having difficulties showing only the queryd object (highlighted).

 From a database-search i have the index of the shape.
Creating new extents so new created image is zoomed in to the object is no 
problem, but i do not seem to see the logic of the mapscript objects.

Now i have the following:

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
/*
This is supposed to be showing a map with the queried object highlighted.
In the map file (see below) i have a dummy layer which should be used for 
the highlight

Input (GLOBAL) is:
--> qlayer  (name = park)
--> index (the dbf-file index of the queried object)

*/

// Start with default map
$NewMap = ms_newMapObj("track4.map");

// Create shapefile object.
$shapeFileObj = ms_newShapeFileObj($ShapefileName, -1 );

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

// Show the queried object, by turning ON a dummy layer:
// Default layername for this is --> layer + 'Query' --> eg. parkQuery
$QueryLayerName = $qlayer . 'Query';
$poLayer = $NewMap->getlayerbyname($QueryLayerName);

// Retrieve shape into shape object.
$oShape = $shapeFileObj->getShape($value -1);   // index from dbf-file (-1 !)

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

// Turn dummy layer on
$poLayer->set("status", 1);


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


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
MAP FILE: Dummy-layer
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

LAYER
   NAME "parkQuery" # This layer is to Highlight the queried object!
   TYPE POLYGON
   STATUS OFF
   DATA park
   CLASS
     NAME "parkQuery"
     COLOR 0 0 255
     OUTLINECOLOR 120 120 120
     TEMPLATE "ttt_query.html"
   END
END # Layer

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

In the list and in the original Gmap example i have not found a way to get 
the wanted result.

Maybe the outcome (hopefull ;-) ) could be interesting for the HOW-TO 
section of mapscript.

Thanks in advance for any input,

Erwin







More information about the MapServer-users mailing list