Error generating imagemaps

Rob P. rob at DATAFLOWDESIGN.COM
Fri Apr 1 15:09:27 EST 2005


I have put code into a php mapscript (4.4.1) to generate an imagemap
on a layer using:

$img->saveImage("", $mapImg)

The map file contains the OUTPUTFORMAT options documented in
mapimagemap.c and generates correct <map> pixel coordinates
</map>. This works great as long as the map contains at least 1
feature from the layer. It seems that if the map is zoomed out too far
(LabelMaxScale or MaxScale in effect) or the area of interest does not
overlap any features from that layer I get this fatal error:

Fatal error: Failed writing image to stdout in
/usr/local/www/data/myscript.phtml on line 875

Attempt to suppress the error by preceding the function call with an
ampersand: [@$img->saveImage("", $mapImg)] still allows the script to
end prematurely

How can I solve this problem? Testing the scale before calling
saveImage could be a partial solution. Perhaps there is a layer or map
property that I can check before calling saveImage()?

Thanks for your help
Rob



More information about the mapserver-users mailing list