Database Reference
In-Depth Information
ofMapServer.Inthebeginningofthemapfile,itisnecessarytodefinegeneralprop-
ertiesforthemap,suchasitstitle,extent,spatialreference,output-imageformats,
and dimensions to be returned to the user.
Then,itispossibletodefinewhichOWS(OGCWebServicessuchasWMS,WFS,
and WCS) requests to expose.
Then, there is the main section of the mapfile, where the layers are defined (every
layerisdefinedinthe
LAYER
directive).YouhaveseenhowtodefineaPostGISlay-
er. It is necessary to define its connection information (database, user, password,
and so on), the SQL definition in the database (it is possible to use just a PostGIS
table name, but you could eventually use a query to define the set of features and
attributes defining the layer), the geometric type, and the projection.
Awholedirective(
CLASS
)isusedtodefinehowthelayerfeatureswillberendered.
Youmayusedifferentclasses,asyoudidinthisrecipe,torenderfeaturesdifferently,
basedonanattributedefinedwiththe
CLASSITEM
setting.Inthisrecipe,youdefined
three different classes, each representing a population class, using different colors.
See also
YoucanfindmoreinformationaboutusingMapServer,usingitsextensivedocument-
ation at its project home page (
http://mapserver.org/it/index.html
). You will find the
mapfiledocumentationat
http://www.mapserver.org/mapfile/
veryusefultoread,as
well.
A good tutorial to understand how to generate mapfiles can be found at
ht-
If you want to gain a better understanding of the WMS and WFS standards, check
their specifications at the OGC website. For the WMS service, go to
ht-
tp://www.opengeospatial.org/standards/wms
,
whereas, for WFS, go to
ht-