[mapserver-users] help

Alexander Petkov greenkov at gmail.com
Tue Nov 18 20:50:29 EST 2008


On 11/18/08, Jeff McKenna <jmckenna at gatewaygeomatics.com> wrote:
> Attila Borbás wrote:
>
> > Hello,
> >
> > 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:_
> >
> > <?php
> > dl('php_mapscript.dll');
> >
> > $image_name =
> sprintf("phpms-hello%0.6d",rand(0,999999)).".png";
> >
> > $map =
> ms_newMapObj("c:/ms4w/Apache/htdocs/hello_world/hello.map");
> >
> > $image=$map->draw();
> >
> > $image->saveImage("c:/ms4w/tmp/ms_tmp/".$image_name);
> >
> > ?>
> >
> > <html>
> > <head><title>PHP MapScript Hello World</title></head>
> > <body>
> > <form action="hello.php" method="POST">
> >    <input type="image" name="img"
> >        src="c:/ms4w/tmp/ms_tmp/<?php echo $image_name; ?>">
> > </form>
> > </body>
> > </html>
> >
> > _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
> > WEB
> >     IMAGEPATH "c:/ms4w/tmp/ms_tmp/tmp/"
> >     IMAGEURL "/tmp/"
> > END
> > LAYER                         STATUS default
> >     TYPE point
> >     FEATURE
> >          POINTS  0.00 0.00 END
> >          TEXT "Hello World"
> >     END # end feature
> >     CLASS
> >          STYLE
> >               COLOR 255 0 0
> >          END
> >          LABEL
> >               TYPE bitmap
> >          END
> >     END
> > END
> > END
> >
> >
> >
>
>  here are some comments:
>
>
>  - MS4W is pre-configured for the following settings:
>
>   IMAGEPATH "/ms4w/tmp/ms_tmp/"
>   IMAGEURL  "/ms_tmp/"
>
>  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
> (http://mapserver.gis.umn.edu/docs/reference/utilityreference/shp2img)
>
>  - MS4W also comes with a small PHP file that can generate a map image (see
> /ms4w/Apache/htdocs/quickmap.php)
>
>  --
>  Jeff McKenna
>  FOSS4G Consulting and Training Services
>  http://www.gatewaygeomatics.com/

On a related note--I wasted about 2hrs last night scratching my head
as to why php/mapscript wasn't working... It turned out the
php_mapscript library was from the 5.0.2 mapserver release, while the
mapserver executable was 5.2.0.

Alex


More information about the mapserver-users mailing list