
Build a Spatially Indexed Data Store #87
Chapter 8, Building the Geospatial Web
|
437
HACK
HACK
#87
Build a Spatially Indexed Data Store Hack #87
Spatial extensions to the PostgreSQL database are useful in many
applications.
A spatial database allows you to make lots of interesting statistical and geo-
metrical queries. Find things within a bounding box, or within a distance;
calculate the areas of shapes, and have data types for points, lines, and
shapes in your database tables.
PostgreSQL, the popular free SQL database, has spatial extensions called
“Geographic Objects For PostgreSQL.” PostGIS, an open source project by
Refractions Research, includes data types to handle geometrical “simple fea-
tures”—such as points, lines, and shapes—many kinds of spatial queries,
and different geographical datums. PostGIS can be used as a backend for
GRASS, Mapserver, GeoServer, and QGIS, among other open source GIS
projects.
PostGIS is available from http://postgis.refractions.net/. Debian packages,
RPMs, and SRPMS for Fedora and Mandrake Linux are provided at this site.
You will probably find it safer to build the RPMs on your own system from
the SRPMS using
rpmbuild --rebuild; we had to do this to avoid library
loading problems. (You can download our RPMs from http://mappinghacks.
com/rpm.) For Windows users, there is a CygWin binary available for Post-
GIS. The rest of these instructions in this hack assume a