[mapserver-users] php mapscript newbie

Mark Balman Mark.Balman at birdlife.org.uk
Fri Nov 29 05:23:21 EST 2002


Hi All

I have sucessfully created a simple app using mapserver and polished this up
using Maplab. I am now wanting to enhance the functionality using php
mapscript. I have read the PHP/Mapscript by example HOWTO document and have
tried unsuccesfully to get a simple world map to display.

I have tried the following (using Win98, Apache, mapserver 3.6)
------------------mapfile----------------------------------
MAP
 SIZE 600 300
 STATUS ON
 SYMBOLSET ./symbols/symbols.sym
 EXTENT  -180 -90 180 90
 UNITS DD
 SHAPEPATH "./data"
 NAME test
			
WEB
 IMAGEPATH "/tmp/ms_tmp/"
 IMAGEURL "/ms_tmp/"
END
		
LAYER
 NAME world
 TYPE POLYGON
 STATUS ON
 DATA world
 CLASS
  COLOR 110 50 100
  OUTLINECOLOR 200 200 200
 END
END
		
END

-------------phpmapscript-------------------------------

<?php
		
dl('php_mapscript.dll'); 
		
$map_path="/world/";			
$map = ms_newMapObj($map_path."test.map");
$image=$map->draw();
$image_url=$image->saveWebImage(MS_PNG,1,1,0);
		
?>
		
<HTML>
<HEAD>
<TITLE>Example 1: Displaying a map</TITLE>
</HEAD>
<BODY>
<IMG SRC=<?php echo $image_url; ?> >
</BODY>
</HTML>

----------------------------------------------------------------------------
----------------

When I try and open the file I get the following displayed in IE4 :(
draw(); $image_url=$image->saveWebImage(MS_GIF,1,1,0); ?> >

Can anyone enlighten me as to what I am doing wrong?
Thanks in advance
Mark 




More information about the mapserver-users mailing list