Trouble rendering map from PostGIS

Keerati Inochanon unselfishly at GMAIL.COM
Fri Apr 22 19:42:43 PDT 2005


Hi,

I am new, and having problems rendering a layer from PostGIS. Here is the 
map file:

==
MAP
NAME US_EAST_COAST
STATUS ON
SIZE 800 500
IMAGETYPE PNG
IMAGECOLOR 240 240 240
SHAPEPATH "/home/www/testing/maps/countries"
EXTENT -180.0000 -90.0000 180.0000 90.0000
UNITS DD
PROJECTION
"proj=latlong"
"ellps=GRS80"
"datum=NAD83"
END
OUTPUTFORMAT
NAME png
DRIVER "GD/PNG"
MIMETYPE "image/png"
IMAGEMODE PC256
EXTENSION "png"
END
LAYER
NAME "countries"
TYPE POLYGON
STATUS ON
DATA "cntry98"
CLASS
NAME "Countries"
COLOR 255 255 180
OUTLINECOLOR 0 0 0
END
PROJECTION
"proj=latlong"
"ellps=GRS80"
"datum=NAD83"
END
END
LAYER
NAME "cities"
TYPE POINT
STATUS ON
DATA "cities"
CLASS
NAME "Cities"
COLOR 0 0 0
OUTLINECOLOR 0 0 0
END
PROJECTION
"proj=latlong"
"ellps=GRS80"
"datum=NAD83"
END
END
LAYER
CONNECTIONTYPE postgis
NAME "random"
CONNECTION "user=xxx password=yyy dbname=testdb host=localhost"
DATA "location from gtest"
STATUS ON
TYPE POINT
CLASS
NAME "random"
COLOR 255 0 0
OUTLINECOLOR 255 0 0
SIZE 50
END
PROJECTION
"proj=latlong"
"ellps=GRS80"
"datum=NAD83"
END
END
END
==

In python, I do
==
import mapscript
mapObject = mapscript.mapObj('/path/to/map/file/mapfile')
image = mapObject.draw()
image.save('test.png')
==

The result (test.png) is a map image with only the first two layers 
(countries and cities), which seem to be rendered correcly. However, I do 
not see anything from the postgis layer. I have a single entry in the gtest 
table, which was inserted using the command "insert into gtest (id, 
location) values (0, GeomFromText('POINT(40.791723 -77.857340)', -1))". The 
entry was inserted with no error. I can do a select to retrieve the entry 
back.

Please let me know what I have done wrong. Any help or suggestions will be 
much appreciated. Thank you very much in advance.

Best regards,
Keerati Inochanon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050422/e2c8ebd5/attachment.htm>


More information about the MapServer-users mailing list