I've just installed MapServer on a linux server and I am trying to understand how to display a basic map using a PostGIS database. I have displayed a shapefile in the browser, so I know that the mapserver setup works. My mapfile is as follows:
MAP
NAME "sample"
EXTENT -180 -90 180 90 # Geographic
SIZE 800 400
LAYER
CONNECTIONTYPE postgis
NAME "roads"
CONNECTION "user=username password=**** dbname=databasename host=hostdb.com port=5432"
DATA "geom from public."MLSOA""
STATUS ON
TYPE LINE
CLASS
STYLE
COLOR 0 0 0
END
END
END
END # end of map file
I then call this by using a url string:
http://mysite.com/mapserv.cgi?map=/home/user/webapps/htdocs/mapfile_pg.map&layer=roads&mode=map
However, I get the error:
loadLayer(): Unknown identifier. Parsing error near (MLSOA_London):(line 11)
I have also tried calling my database just MLSOA
and 'MLSOA'
. If I use the line
DATA "geom from MLSOA"
I get the following error:
msDrawMap(): Image handling error. Failed to draw layer named 'roads'. msPostGISLayerWhichShapes(): Query error. Error (ERROR: relation "mlsoa" does not exist ) executing query: select encode(ST_AsBinary(ST_Force_2D("geom"),'NDR'),'hex') as geom,"gid" from MLSOA where geom && GeomFromText('POLYGON((-180.225563909774 -90,-180.225563909774 90,180.225563909774 90,180.225563909774 -90,-180.225563909774 -90))',find_srid('','MLSOA','geom'))
I think that the problem is with the table name, but I'm not sure how it should be named. Using pgAdminIII, if I want to run a query on this table I use the following syntax:
select getsrid(the_geom) from public."MLSOA" limit 10
What is the correct syntax for my mapfile?
GEOMETRY_COLUMNS
. I imported a projected shapefile using the GUI importer, and just ranSELECT Probe_Geometry_Columns();
but I still have the same problem. I'll try updating this table manually. – djq Oct 19 '11 at 15:28