[postgis-users] how to use postgis db with mapserver

Vinko Vrsalovic vinko at cprsig.cl
Tue Dec 10 04:21:31 PST 2002


On Tue, Dec 10, 2002 at 09:50:41AM +0100, Alessandro Ceccotti wrote:
 
> Hello,
> I've imported my .shp map in Postgresql/postgis using shp2pgsql.
> Now, how can use it with mapserver?

If you're using plain MapServer and just want to display a PostGIS
layer, you must set the appropriate parameters in the .map file.

For instance:

  LAYER
      CONNECTION "user=XXXX dbname=YOURDB host=localhost port=5432 password="
      CONNECTIONTYPE POSTGIS
      DATA "the_geom from chile_poly"
      LABELITEM "NOMBRE"
      LABELMAXSCALE 1e+06
      LABELMINSCALE 10000
      NAME "Chile"
      SIZEUNITS PIXELS
      STATUS ON
      SYMBOLSCALE 200000
      TEMPLATE "VOID"
      TOLERANCE 10
      TOLERANCEUNITS METERS
      TYPE POLYGON
      UNITS METERS
      CLASS
        NAME "División Administrativa"
	COLOR 255 255 204
	MAXSIZE 100
	MINSIZE 1 
	OUTLINECOLOR 255 255 204
	SIZE 1
	SYMBOL 0
      END
  END 

As you can see, it's almost the same, with the exception of CONNECTION,
CONNECTIONTYPE and DATA.

You can use arbitrary SQL queries to obtain your data, also.

You can read more about this at:

http://postgis.refractions.net/docs/x549.html

and at: 

http://mapserver.gis.umn.edu/doc36/mapfile-reference.html

-- 
Vinko Vrsalovic <el[|- at -|]vinko.cl>
http://www.cprsig.cl



More information about the postgis-users mailing list