[mapserver-users] Mapscript Sample

boesiii boesiii at yahoo.com
Wed Nov 16 23:51:55 EST 2011


I am trying to learn PHP MapScript and was starting with this webpage
http://mapserver.org/mapscript/php/by_example.html but when I try to load
the first example with my modifications I get an "undefined function dl()"
error, so I commented that line out because I think php is already
initialized but when I reload the file I get a broken image symbol on the
screen, but when I check the tmp folder I find the image file.  Why is the
image not being displayed on my screen?  Thanks for your help.

My php file is below:

   <?php

    dl('php_mapscript.so');

    $map_path="C:/ms4w/apps/ftmagisapp_v2/maps/shapefiles/";
    $map = ms_newMapObj($map_path."ftma.map");
    $image=$map->draw();
    $image_url=$image->saveWebImage();

    ?>

     <HTML>
      <HEAD>
          <TITLE>Example 1: Displaying a map</TITLE>
      </HEAD>
      <BODY>
          <IMG SRC=&lt;?php echo $image_url; ?> >
      </BODY>
     </HTML>

Below is my MAP file:

MAP
	NAME 'ftma'
	SIZE 800 650
	STATUS ON
	EXTENT  1245367 413891 1294441 444067
	UNITS FEET
	MAXSIZE 10000
	TRANSPARENT TRUE

	OUTPUTFORMAT
		NAME 'agg/png'
		DRIVER AGG/PNG
		IMAGEMODE RGBA
		FORMATOPTION "TRANSPARENT=TRUE"
	END 

	SHAPEPATH "C:/ms4w/apps/ftmagisapp_v2/maps/shapefiles"
	IMAGETYPE agg/png

    WEB
		IMAGEPATH "/ms4w/tmp/ms_tmp/"
		IMAGEURL "/tmp/"
	END

	LAYER
		NAME ftma
  	    DATA './ftma_waterlines2.shp'
  	    STATUS ON
  	    TYPE LINE
  	    CLASS
			#NAME 'ftma'
  	        STYLE
				WIDTH 3
				COLOR 0 0 255
  	        END
		END
	END
  
END ## end Map

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Mapscript-Sample-tp7002818p7002818.html
Sent from the Mapserver - User mailing list archive at Nabble.com.


More information about the mapserver-users mailing list