[Mapserver-users] PostGIS fails with mapscript but not shp2img

Matthew Haines mhaines94108 at hotmail.com
Sun Nov 16 06:39:53 PST 2003


I am just starting to experiment with PostGIS and have run into a problem I 
can't solve.  I started with a non-PostGIS map file that renders fine 
whether called from mapscript or by shp2img.  Then I modified it to take its 
date from a database through PostGIS.  It still renders with shp2img but 
doesn't return an image when called from mapscript.

My system is as follows:
MapServer 4.0
PostGIS & PostgreSQL -- latest versions (downloaded yesterday)
Mandrake Linux 9.1
Apace web server

My perl/mapscript program is being invoked from Apache, and here is the code 
that draws the maps:

	my $map = new mapscript::mapObj($mapfile);
	print "Map:  $map<br>\n";
        ... [ set extent, height width]
	my $img = $map->draw ();
	print "Image:  $img<br>\n";
	my $return = mapscript::msSaveImage($map, $img, $imgfile);
	print "Return:  $return<br>\n";

Comparing the old map file to the new, I can see that the $map->draw() 
method is returning NULL with the new map file.

I have checked the PostgreSQL log and get nothing there.  The mapserver log 
doesn't seem to capture mapscript errors.  The apache logs aren't relevant 
here.  How can I debug something like this?  I can't find an angle from 
which to get diagnostic information.  Works fine from shp2img, and works 
fine when drawing from a .shp file directly, but I get nothing when I switch 
to PostGIS.

Thanks,

Matthew


Here is the layer that I changed in the .map file:

WEB
  ... [snip]
  LOG "/var/www/html/tmp/mapserver_access.log"
END

... [snip]

LAYER
	CONNECTIONTYPE postgis
	CONNECTION "user=matthew dbname=maps host=localhost"
	DATA "the_geom from brooklyn_taxlots"
	TYPE POLYGON
	NAME "bk_taxlots"
	MAXSCALE 25000
	STATUS DEFAULT

	CLASSITEM "bldgclass"
	CLASS
		NAME "Residential, 1-2 Fam"
		EXPRESSION /A|B/
		COLOR 192 192 255 # Blue
		OUTLINECOLOR 32 32 32
	END
        ... [etc, lot more classes]

_________________________________________________________________
Concerned that messages may bounce because your Hotmail account is over 
limit? Get Hotmail Extra Storage! http://join.msn.com/?PAGE=features/es




More information about the MapServer-users mailing list