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

Michael Roach burntmage at yahoo.com
Sun Nov 16 23:54:34 PST 2003


--0-1404347193-1069055674=:40365
Content-Type: text/plain; charset=us-ascii

Check to make sure you can open a standard connection to the PostGIS DB from Perl (Just a general select from any table) when running as a CGI not as a user. 

Matthew Haines <mhaines94108 at hotmail.com> wrote: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
\n";
... [ set extent, height width]
my $img = $map->draw ();
print "Image: $img
\n";
my $return = mapscript::msSaveImage($map, $img, $imgfile);
print "Return: $return
\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

_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users


---------------------------------
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
--0-1404347193-1069055674=:40365
Content-Type: text/html; charset=us-ascii

<DIV>Check to make sure you can open a standard connection to the PostGIS DB from Perl (Just a general select from any table) when running as a CGI not as a user. <BR><BR><B><I>Matthew Haines <mhaines94108 at hotmail.com></I></B> wrote:
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">I am just starting to experiment with PostGIS and have run into a problem I <BR>can't solve. I started with a non-PostGIS map file that renders fine <BR>whether called from mapscript or by shp2img. Then I modified it to take its <BR>date from a database through PostGIS. It still renders with shp2img but <BR>doesn't return an image when called from mapscript.<BR><BR>My system is as follows:<BR>MapServer 4.0<BR>PostGIS & PostgreSQL -- latest versions (downloaded yesterday)<BR>Mandrake Linux 9.1<BR>Apace web server<BR><BR>My perl/mapscript program is being invoked from Apache, and here is the code <BR>that draws the maps:<BR><BR>my $map = new mapscript::mapObj($mapfile);<BR>print "Map: $map<BR>\n";<BR>... [ set extent, height width]<BR>my $img = $map->draw ();<BR>print "Image: $img<BR>\n";<BR>my $return = mapscript::msSaveImage($map, $img, $imgfile);<BR>print "Return:
 $return<BR>\n";<BR><BR>Comparing the old map file to the new, I can see that the $map->draw() <BR>method is returning NULL with the new map file.<BR><BR>I have checked the PostgreSQL log and get nothing there. The mapserver log <BR>doesn't seem to capture mapscript errors. The apache logs aren't relevant <BR>here. How can I debug something like this? I can't find an angle from <BR>which to get diagnostic information. Works fine from shp2img, and works <BR>fine when drawing from a .shp file directly, but I get nothing when I switch <BR>to PostGIS.<BR><BR>Thanks,<BR><BR>Matthew<BR><BR><BR>Here is the layer that I changed in the .map file:<BR><BR>WEB<BR>... [snip]<BR>LOG "/var/www/html/tmp/mapserver_access.log"<BR>END<BR><BR>... [snip]<BR><BR>LAYER<BR>CONNECTIONTYPE postgis<BR>CONNECTION "user=matthew dbname=maps host=localhost"<BR>DATA "the_geom from brooklyn_taxlots"<BR>TYPE POLYGON<BR>NAME "bk_taxlots"<BR>MAXSCALE 25000<BR>STATUS DEFAULT<BR><BR>CLASSITEM
 "bldgclass"<BR>CLASS<BR>NAME "Residential, 1-2 Fam"<BR>EXPRESSION /A|B/<BR>COLOR 192 192 255 # Blue<BR>OUTLINECOLOR 32 32 32<BR>END<BR>... [etc, lot more classes]<BR><BR>_________________________________________________________________<BR>Concerned that messages may bounce because your Hotmail account is over <BR>limit? Get Hotmail Extra Storage! http://join.msn.com/?PAGE=features/es<BR><BR>_______________________________________________<BR>Mapserver-users mailing list<BR>Mapserver-users at lists.gis.umn.edu<BR>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users</BLOCKQUOTE></DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
<a href="http://antispam.yahoo.com/whatsnewfree">Protect your identity with Yahoo! Mail AddressGuard</a>
--0-1404347193-1069055674=:40365--



More information about the MapServer-users mailing list