[Mapserver-users] help with python mapscript (no image)

Christoph Spoerri spoerri at duke.edu
Tue Dec 30 08:55:44 PST 2003


Hi there, 

After using the php mapscripts for over a year now, I started to look into the 
python mapscripts. It seems to provide more functionality and doesn't have to 
have to be run as cgi (I'm using mod_python).

The compilation, installation and setup went pretty smoothly. Now, I would 
like to create my first map, but for some reason I do not get an image in my 
output directory. I can create an image of the map by saving the image 
(imgObj::saveImage() ), but the mapObje::draw() doesn't seem to work. 

I run also the following from the python prompt:

>>> from mapscript import *
>>> myMap = mapObj('/var/www/htdocs/mapserver/obis_test/testing.map')
>>> mapImg = myMap.draw()
>>> mapImg.imageurl
'/output/'
>>> mapImg.save('/tmp/test.png')

As you can see the imageurl only points to the directory where the image 
should be and doesn't include the image name.

I spent the last 4 hours search the mailing list, google, etc, yet wasn't able 
to find a solution. Any ideas? I have attached my map file.

thanks, and a happy new year

Christoph

************** my map file ************************

MAP
	NAME PYDEMO
	EXTENT -180 -90 180 90
	SIZE 400 300
	SHAPEPATH "/usr/local/ims_data/"

	UNITS DD
	RESOLUTION 72
	IMAGETYPE PNG24
	IMAGECOLOR 245 245 245
	WEB
		IMAGEPATH "/var/www/htdocs/ims_output/"
		IMAGEURL "/output/"
	END

	LAYER
		NAME "Background"
		STATUS DEFAULT
		DATA "datalib/global/ocean_log.tif"
		TYPE RASTER
		OFFSITE 0 0 0
	END

	LAYER
		NAME "Continents"
		STATUS DEFAULT
		DATA "datalib/global/world_usa_canada"
		TYPE POLYGON
		TRANSPARENCY 0
		CLASS
			COLOR 180 210 170
			OUTLINECOLOR 150 190 140
		END
	END
END




More information about the MapServer-users mailing list