I am trying to setup a web map service (WMS) for rendering a few shape files that I have stored in a PostGIS database. I decided to use MapServer for rendering engine and has installed it on my Ubuntu machine with support of PostGIS. I have setup a virtual host in Apache for my project and I have found a partial setup from (http://postgis.refractions.net/docs/ch05.html), which shows connecting to PostGIS from Mapserver, e.g.
LAYER
CONNECTIONTYPE postgis
NAME "widehighways"
# Connect to a remote spatial database
CONNECTION "user=dbuser dbname=gisdatabase host=bigserver"
PROCESSING "CLOSE_CONNECTION=DEFER"
# Get the lines from the 'geom' column of the 'roads' table
DATA "geom from roads using srid=4326 using unique gid"
STATUS ON
TYPE LINE
END
However, I cannot find a complete example that shows serving tiled map from the mapserver. Can someone help with how to render png tiles from the map-server or point to an example. Thanks.
2 Answers 2
Well for the connection between mapserver and postgis you should check mapserver documentation at http://mapserver.org/input/vector/postgis.html
That's for the data connection, then you have to style your data (MapServer docs are great) and then decide which client to use.
You are asking for tiled pngs so I assume you are looking for a web mapping client. There are tons, depending on your context and requirements so I won't recommend one now.
The mapserver documentation has an example on using mapserver in tile mode here.
For the styling this is a basic example of a class and style for LINE layer type:
CLASS
NAME 'BLUELINES'
STYLE
WIDTH 7.0
COLOR 0 0 255
END
END
which renders lines in blue with a width of 7 SIZEUNITS. Sizeunits are defined at layer level and default to pixels, but can be miles, meters, etc. Refer to the mapserver documentation and wiki for the details and examples. This page has loads of cartographic symbols examples that should get you started easily.
[off topic] Since you are running portgres as a backend I should recommend you upgrade (if not already) to the latest version as the previous ones had a nasty SQL injection vulnerability as described here. [/off topic]