Everything Java Apache Geospatial Open Source. Hello Shinning Stars!!! Vincent Massol, Raphael Luta, Santiago Gala, Carsten Z.

Thursday, December 01, 2005

Here is a simple script that I found using ms4w from maptools.org. It helped me get a grasp on MapScript PHP for MapServer.


Application: QuickMap
Purpose: Use this file to test mapfiles
Authors: Bill Bronsema (bbronsema@dmsolutions.ca)
Philip Donaghy (philip.donaghy@gmail.com)
Copyright: 2005, DM Solutions Group Inc.
Instructions: - modify the MAPFILE path and the name of the phpmapscript
MODULE (lines 16 & 17)
- in a web browser goto
- an image of your data should be displayed in your browser, or
a MapServer error

// define variables
define( "MAPFILE", "map/MorganCo.map" );
define( "MODULE", "php_mapscript_44.dll" );

// load the mapscript module
if (!extension_loaded("MapScript")) dl(MODULE);

// open map
//$oMap = ms_newMapObj( MAPFILE, dirname( MAPFILE ) );
$oMap = ms_newMapObj( MAPFILE );

// set projection

// set size
$oMap->setsize(1200, 700);

// set image format

// draw map
$oImage = $oMap->draw();

// set header
header("Content-type: image/png");

// output map
$url = $oImage->saveImage("");


No comments: