Trouble rendering map from PostGIS

Keerati Inochanon unselfishly at GMAIL.COM
Sat Apr 23 13:08:37 EDT 2005


Hi all,

Thank you very much everyone who tried to help. I have found the problem. 
The map was actually rendered correctly, but since it was only a "POINT", it 
is only 1 pixel big, and thus I did not see it in the map. I defined a 50 
pixel circle symbol for the class, and render it again, and things appear 
correctly.

Best regards,
Keerati

On 4/23/05, Newland <newland at vt.edu> wrote:
> 
> Below is an example of how to access a postgis layer. take a careful look 
> at the DATA parameter.
>  The general format for the DATA parameter is "<GEOMETRY_COLUMN_NAME> from 
> <TABLE_NAME> using UNIQUE <UNIQUE_ID_COLUMNNAME> using SRID 
> <SRID_OF_LAYER>". 
>  In my example, 
>  the GEOMETRY_COLUMN_NAME is shape. the TABLE_NAME is stlouis_base. the UNIQUE_ID_COLUMNNAME 
> is oid. the SRID_OF_LAYER is 4326.
>  Hope this helps.
>    -------------------------------Begin 
> example-----------------------------------------------------------
>   DATA "shape from stlouis_base using UNIQUE oid USING SRID=4326"
>  LAYER
> NAME "stlouis_roads"
> TYPE LINE
> CONNECTION "user=john password=doe dbname=stlouis host=192.168.1.111port=5432"
> TOLERANCEUNITS pixels
> CONNECTIONTYPE postgis
> TOLERANCE 5
> CLASS
> LABEL
> COLOR 0 255 0
> SIZE tiny
> ANGLE AUTO
> END
> NAME "Roads"
> COLOR 255 0 0
> SIZE 1
> SYMBOL "circle"
> END
> LABELITEM "name"
> STATUS on
> CLASSITEM "frc"
> METADATA
> WMS_TITLE "St. Louis County Roads"
> END
> PROJECTION
> "init=epsg:4326"
> END
> DATA "shape from stlouis_base using UNIQUE oid USING SRID=4326"
> END
>  -------------------------------End 
> example-----------------------------------------------------------
>  
> -----Original Message-----
> *From:* UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]*On 
> Behalf Of *Keerati Inochanon
> *Sent:* Friday, April 22, 2005 7:43 PM
> *To:* MAPSERVER-USERS at LISTS.UMN.EDU
> *Subject:* [UMN_MAPSERVER-USERS] Trouble rendering map from PostGIS
> 
> 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/20050423/43ef419e/attachment.html


More information about the mapserver-users mailing list