[mapserver-users] Mapserver and PostgreSQL

Jan Hartmann jhart at frw.uva.nl
Thu Nov 21 12:50:54 EST 2002


Arjen Vrielink wrote:
 > Hello All,
 >
 > I was wondering if I could connect to a PostgreSQL database directly
 > from Mapserver. The problem is that we have SuSE 8.1 doing the
 > installation of PostgreSQL so we don't have the pg src code on our
 > machine which you need to install / compile PostGIS. Not being convinced
 > about the benefits of POSTGIS after reading the documentation I decided
 > I could live without it. That is, until I tried to get Mapserver connect
 > to my Postgres db --> There are no error messages but I don't get the
 > layer displayed either (I use an ESRI shapefile which I dumped to SQL
 > code for testing). So my basic question is: do I really need Postgis
 > (and what are the benefits of Postgis anyway)? if I really need postgis,
 > I will get the postgres source code and install it manually on my linux
 > box.
 >
 > Suggestions would be appreciated, thanks
 >
 > using:
 > Linux 2.4.something
 > PostgreSQL 7.2
 > Mapserver 3.6
 > (PHP 4.3.0RC1)
 >
 > arjen,
 > SarVision
 > Wageningen
 > The Netherlands
 >
 >

Arjen,

You are not obliged to use PostGIS . MapServer will run quite happily on 
its own (with great functionality). However, if you are on a Linux 
platform, I would certainly advise to add PostGreSQL with the PostGIS 
extension (you cannot connect MapServer to PostgreSQL without it). Reasons:

- You can import every database from Windows (including Access) into 
PostgreSQL by a few mouseclicks using pgAdmin. These data can be 
uniformly queried by full-featured SQL and combined with GIS maps
- You can import most vector GIS files by using shp2pgsql or ogr2ogr and 
let MapServer build maps based on them. Most important, you can create 
maps based on combinations of geographical queries (e.g. everything 
within a certain distance of selected objects), and regular attribute 
queries (e.g. everything with a certain name).

For this you need the PostgreSQL source code. Personally I don't use the 
locations of  standard distributions like SUSE for this: it's very 
difficult to remember where they put things. I download the source code 
under my $HOME directory and configure everything with ./configure 
--prefix=$HOME. After that you need to install the PostGIS extension. If 
you managed to compile and install MapServer, this should be no problem 
at all. Perhaps you should wait a few days until PostgreSQL 7.3 is released.

Hope this helps.


Vriendelijke groeten,

Jan

Jan Hartmann
Department of Geography
University of Amsterdam
jhart at frw.uva.nl




More information about the mapserver-users mailing list