[Mapserver-users] Geting Image X and Y for dynamically-added points

Erich Schroeder erich at museum.state.il.us
Tue Sep 16 14:47:08 EDT 2003


Hi,
  I expect that this is a FAQ, but I can't find it in a search of the 
archives.

I'm adding points dynamically in phpMapscript for centroids of counties 
that match my query, here is the code snippet:

// submit $taxon to MySQL query, return a
// array with FIPS, X-coord, Y-coord for county
// centers
$countiesToShow = getCountiesToShow($taxon);
//view_values($countiesToShow);
$map_path="/var/www/html/herbarium/";
$map = ms_newMapObj($map_path."base.map");
// map file has two layers, 
// 1. base map of counties
// 2. empty point layer with a style for filled circles
$image=$map->draw();

$layer = $map->getLayer(1);
$layer->set('status', MS_ON);
foreach ($countiesToShow as $county) {
	$pt = ms_newPointObj();
	$x = $county['x-coord'];
	$y = $county['y-coord'];
	$pt->setXY($x, $y);
	$pt->draw($map,$layer,$image, 0, "");
}
$image_url=$image->saveWebImage();

And it is working well. However, I was wondering if there is a mapscript
method for translating the $x and $y in the $pt->setXY($x, $y) step to the
image.x and image.y values so I can include them in dynamically created
html imagemap code. In this particular application I'm not sure that I
need to go through the mapserver query stuff, all I need is a url called
from an image click (simple hotlink) so I can do my mysql stuff.

Erich

-- 
---------------------------------------------------------------------
Erich Schroeder                    Phone: (217)785-0033
Curator, Information Technologies  FAX:   (217)785-2857
Illinois State Museum GIS Lab      email:erich(at)illinois.state.museum
                 http://illinois.state.museum/
---------------------------------------------------------------------




More information about the mapserver-users mailing list