[The copyright of this article is owned by the xiaotie@vip.sina.com, reproduced by the author's consent.]
1. First install j2sdk-rj4_2_04-windows-i586-p.exe (assuming it is installed in c: \ j2sdk1.4.2 _ 04), set the environment variable java_home = c: \ drivers, and then install geoserver.
What about geotools? Why didn't we see geotools? You can see that geotools is already in the installation directory of geoserver. You can see from the geoserver API that geoserver accesses the data source through geotools and processes GEO queries.
2. Tomcat + geoserver Configuration:
Add a configuration line before the $ atathome/CONF/server. xml configuration file
<Context Path = "/geoserver" docbase = "D: \ Program Files \ geoserver \ Server \ geoserver "DEBUG =" 0 "reloadable =" true "crosscontext =" true "> </context>
Note: I installed geoserver on disk D.
In this way, you can access geoserver through http: // localhost: [port]/geoserver.
Geoserver is very easy to use. Just read the documentation for details. The interface is as follows:
3. Configure the Web Map Service in geoserver:
Place the desired shapefile in the $ geoserverhome/Server/geoserver/data/featuretype folder, and then modify catalog under the $ geoserverhome/Server/geoserver/WEB-INF folder. in the xml configuration file, add the configuration in the <datastores> </datastores> section:
<Datastore id = "bc_shapefile"
Enabled = "true"
Namespace = "Topp">
<Description> British Columbia sample road shapefiles </description>
<Connectionparams>
<! -- For now the URL value is relative to where geoserver moves the -->
<! -- Featuretypes directory. Everything in featuretypes moves to -->
<! -- Data, so just put the relative location. -->
<Parameter name = "url"
Value = "file: Data/featuretypes/bc_roads/bc_roads.shp"/>
</Connectionparams>
</Datastore>
In this way, an image configuration is added. Http: // localhost: [port]/geoserver/WMS? Request = getmap & layers = bc_roads & bBox = [Minx, miny, Maxx, maxy] & width = [width] & Height = [height] & SRS = [CRS] & styles = [style] & format = [mimetype] to access the image.
[] Content is configured according to the data source.
The demo provided in the geoserver document uses the configured SHP file. For example, http: // localhost: 8080/geoserver/WMS? BBox =-130,24,-66,50 & styles = Population & format = image/PNG & request = getmap & layers = states & width = 550 & Height = 250 & SRS = epsg: 4326, you can get: