[mapserver-users] ogr/mysql layer & imagemap template using php mapscript?

P.Romero romero619 at hotmail.com
Mon Apr 13 23:57:31 EDT 2009


Ive asked this question several times already, but have never received a
useful response. If there are any php-mapscript experts reading this, please
help...

Im trying to create an imagemap based on an html template and a "points"
layer, which uses an ogr/mysql connection to query a database table and
retrieve a set of points.

It's based on a combination of the following two examples:

http://mapserver.org/input/vector/mysql.html?highlight=ovf
http://mapserver.org/output/imagemaps.html?highlight=imagemap

As described in the 2nd example, I can access successfully access my
imagemap html& png output using a url like the following:

http://myurl/cgi-bin/mapserv?map=myfile.map&mode=nquery&searchmap=true

The problem is that I want to use php-mapscript, instead of using the
cgi-bin url. The main reasons for this are to be able to post-process the
raw imagemap html code & control how & when the html and the png image are
sent back to the user's browser.

I tried doing this:

//Read & draw the map file
$map = ms_newMapObj("myMapFile.map");
$img=$map->draw();

//pass the resulting map png's url back 
//to the html template through $tmparray variable
$tmparray["img_url"] = $img->saveWebImage();

//Process the query template 
$html=$map->processquerytemplate($tmparray);

//Now, echo or process the raw html as necessary
echo $html;

This almost seemed to work. The 'processquerytemplate()' function *did*
return the imagemap html, but the actual data points from my layer were
absent in the html; i.e., there were no 'area' tags in the imagemap code, so
the imagemap was empty. However, my layer WAS correctly executing the
mysql/ogr data query & drawing my points, as the points WERE visible in the
png output.

So the basic question is:
How do I go about correctly processing the template using php-mapscript, so
that the data from my points layer will be included in the imagemap html?

I hope this is the info you'll need to help figure this out.
Please let me know if you have questions, or if I need to include more
details.

Thanks again,
P.Romero



More information about the mapserver-users mailing list