PHP/Mapscript + Postgis

Philippe Gondek philippe.gondek at GMAIL.COM
Wed May 11 05:43:42 PDT 2005


Hi,

I'm a beginner with mapscript...

I try to draw a map with php/mapscript with data comming from postgis.
I tried several ways, the problem is the construction of my layer...

I try like this

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

$map = ms_newMapObj($Nom_Mapfile);
$map->setextent($xmin,$ymin,$xmax,$ymax);
$map->web->set("imagepath",$mapserver_imagepath);
$map->web->set("imageurl",$mapserver_imageurl);
$map->set("width",$longueur_image_mapfile);
$map->set("height",$hauteur_image_mapfile);

	// Ajout d'une couche
	$layer = ms_newLayerObj($map);

with this mapfile
MAP
	NAME MAMAPAMOI
	
	EXTENT 0 0 1 1

	SIZE 1 1

	IMAGECOLOR 255 255 255

	IMAGETYPE PNG
	
END

-----------------------------------------------------------------------------------------
and like this
-----------------------------------------------------------------------------------------
$map = ms_newMapObj("miam.map");

$map->setextent($xmin,$ymin,$xmax,$ymax);
$map->web->set("imagepath",$mapserver_imagepath);
$map->web->set("imageurl",$mapserver_imageurl);
$map->set("width",$longueur_image_mapfile);
$map->set("height",$hauteur_image_mapfile);

	// Ajout d'une couche	
	$layer = $map->getLayerByName(REGIONS);

MAP
	NAME MAMAPAMOI
	
	EXTENT 0 0 1 1

	SIZE 1 1

	IMAGECOLOR 255 255 255

	IMAGETYPE PNG

	LAYER
	
		NAME REGIONS
		
		TYPE POLYGON
		
		CONNECTIONTYPE POSTGIS
		
		CONNECTION "host=localhost port=5432 dbname=lemiam user=phil
password=1707loulou442"
		
		DATA "the_geom from regions"
		
	END
END
-----------------------------------------------------------------------------------------

Each time, I have an 

>>Internal Server Error

>>The server encountered an internal error or misconfiguration and was
unable to >>complete your request.

>>Please contact the server administrator, root at localhost and inform
them of the >>time the error occurred, and anything you might have
done that may have >>caused the error.

>>More information about this error may be available in the server error log.

I don't understand why because I can completely read the script
http://localhost/phpinfo_mapscript.phtml

Do you already have a problem like this one???



More information about the MapServer-users mailing list