Database Reference
In-Depth Information
Creating WMS and WFS services with
GeoServer
In the previous recipe, you created
Web Map Services
(
WMS
) and
Web Feature
Services
(
WFS
)fromaPostGISlayerusingMapServer.Inthisrecipe,youwilldothat
usinganotherpopularopen-sourceweb-mappingengine—
GeoServer
.Youwillthen
usethecreatedservices,asyoudidwithMapServer,testingtheirexposedrequests,
firstusingabrowserandthentheQGISdesktoptool(youcandothiswithothersoft-
ware, as well, such as uDig, gvSIG, OpenJUMP GIS, and ArcGIS Desktop).
Getting ready
While MapServer is written in the C language and uses Apache as its web server,
GeoServer is written in Java, and you therefore need to install the
Java Virtual
Machine
(
JVM
) in your system; it must be used from a servlet container such as
Jetty and Tomcat. After installing the servlet container, you will be able to deploy
the GeoServer application to it. For example, in Tomcat, you can deploy GeoServer
by copying the GeoServer
WAR
(
Web archive
) file to Tomcat's
webapps
directory.
Forthisrecipe,wewillsupposethatyouhaveaworkingGeoServerinyoursystem;
if this is not the case, follow the detailed GeoServer installation steps for your OS
at the GeoServer website (
http://docs.geoserver.org/stable/en/user/installation/
)
and
then return to this recipe. Follow these steps:
1. Download the USA counties shapefile from the
nationalatlas.gov
website at
archive is included in the topic's code bundle). Extract the archive to
work-
ing/chp09
and import it to PostGIS using the
ogr2ogr
command, as fol-
lows:
$ ogr2ogr -f PostgreSQL -a_srs EPSG:4326
-lco GEOMETRY_NAME=the_geom -nln
chp09.counties
PG:"dbname='postgis_cookbook' user='me'
password='mypassword'" co2000p020.shp
.