jmckenna at gatewaygeomatics.com
Tue Nov 18 18:28:40 EST 2008
Attila Borbás wrote:
> I ve got a big problem with php/mapscript.I ve tried a simple "hello
> world" example (from Beginning MapServer Open Source GIS Development)
> and I didn't get any error message, but the browser couldn't generate
> the rendered pic. I don't know what the problem could be, but all codes
> what I ve made had the same problem. I attached the bad codes. Thx for
> ur help and I'm looking forward to your answer.
> _The php/mapscript file:_
> $image_name = sprintf("phpms-hello%0.6d",rand(0,999999)).".png";
> $map = ms_newMapObj("c:/ms4w/Apache/htdocs/hello_world/hello.map");
> <head><title>PHP MapScript Hello World</title></head>
> <form action="hello.php" method="POST">
> <input type="image" name="img"
> src="c:/ms4w/tmp/ms_tmp/<?php echo $image_name; ?>">
> _The map file:_
> # "Hello World" mapfile
> NAME "Hello World"
> SIZE 400 300
> IMAGECOLOR 249 245 186
> IMAGETYPE png
> EXTENT -1.0 -1.0 1.0 1.0
> IMAGEPATH "c:/ms4w/tmp/ms_tmp/tmp/"
> IMAGEURL "/tmp/"
> STATUS default
> TYPE point
> POINTS 0.00 0.00 END
> TEXT "Hello World"
> END # end feature
> COLOR 255 0 0
> TYPE bitmap
here are some comments:
- MS4W is pre-configured for the following settings:
Make sure to use those settings in all of your MS4W mapfiles.
- you can test that your mapfile generates a map image properly by using
the shp2img commandline utility, that is included in MS4W
- MS4W also comes with a small PHP file that can generate a map image
FOSS4G Consulting and Training Services
More information about the mapserver-users