[mapserver-users] PostGIS as data source
Paul Ramsey
pramsey at refractions.net
Fri Jul 20 17:59:42 PDT 2001
As announced earlier, PostGIS/PostgreSQL can now be used as a MapServer
datasource. You'll need the 3.5 CVS version in order to do it, as well
as PostgreSQL. The URL below is an example of a working PostGIS
datasource.
http://mapserver.refractions.net/cgi-bin/mapserv?map=/home/www/mapserv/maps/postgis.map
I have attached the map file used for this example as a template.
Mostly, things work just like normal. The only differences are in the
connection string (which is just a standard postgresql connection
string) and in the way 'FILTER' works: if you want a filter it should be
expressed using the kind of syntax you would use for a SQL 'where'
clause.
I hope some folks give this a try!
Paul
-------------- next part --------------
NAME BCB
EXTENT 167053 354794 1941047 1737909
SIZE 600 480
SHAPEPATH "/home/www/mapserv/data"
UNITS meters
FONTSET "/home/www/mapserv/fonts/fonts.lst"
SYMBOLSET "/home/www/mapserv/maps/symbols.sym"
WEB
TEMPLATE postgis-template.html
IMAGEPATH "/home/www/mapserv/tmp/"
IMAGEURL "/tmp/"
END
LAYER
NAME "bc"
DATA border_poly
STATUS DEFAULT
TYPE POLYGON
CLASS
COLOR 212 212 212
OUTLINECOLOR 100 100 100
END
END
LAYER
CONNECTIONTYPE postgis
NAME "highways"
DATA "geo_value from tcn_roads"
FILTER "type = 6"
CONNECTION "user=pramsey dbname=postgis_test"
STATUS DEFAULT
TYPE LINE
MAXSCALE 900000
MINSCALE 200000
CLASS
COLOR 255 22 22
TEMPLATE postgis-query.html
END
END
LAYER
CONNECTIONTYPE postgis
NAME "mypostgis"
DATA "geo_value from tcn_roads"
CONNECTION "user=pramsey dbname=postgis_test"
STATUS DEFAULT
TYPE LINE
MAXSCALE 200000
CLASS
COLOR 255 22 22
TEMPLATE postgis-query.html
SYMBOL "solid2"
SIZE 2
EXPRESSION ([type] = 6)
END
CLASS
COLOR 205 92 82
TEMPLATE postgis-query.html
EXPRESSION ([type] < 6)
END
END
END
More information about the MapServer-users
mailing list