1
Lab 9
(14-March-2011)
Web Mapping 2
Spatial Databases Course (DT249/DT211 & DT228)
Lecturer Pat Browne
This note describes how to:
1) Web Map and Feature Services
3) Web Feature Service
4) OpenLayers
5) Other clients
6) OpenLayers Examples
7) Web Process Services WPS on the Web
1) Web Map and Feature Services
For WMS the rendering takes place on the server side giving the client just an image.
The image file is no longer linked to the original digital map coordinate system (not
GeoTIFF). Once the image is rendered, it cannot be modified on the client side which is
usually browser but could be OpenJump or uDig.
Some clients such as uDig and OpenJump can do their own rendering.
WMS is fine for presentation and a delivery mechanism, but not good for user interaction
Web Feature Service (WFS) is designed to return pure geo-data complete with
coordinates. WFS does not contain any display or style instructions.
The results are similar to shapefiles or PostGIS tables via ODBC; however, WFS is a web
service, it is not a file format or database result set, it is a set of operations. Check the
WFS:
http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=GetCapabilities
The HTTP protocol specifies a GET if there are no side effects induced by the request.
When there is a side effect, then you should use POST. WFS requests use HTTP POST.
POST requests are generally associated with forms. A WFS request returns an XML (and
GML) document containing the following sections:
Service
Capabilities
Feature Type List
Filter Capabilities
The Service Section contains exactly the same sections as a WMS getCapabilities
document. This is because it is, in fact, defined in the OGC Common Implementation
Specification that both WMS and WFS extend.
Name is the service provider assigns a name to the web feature service instance.
Title is a human-readable title to briefly identify this server in menus.
Abstract is a descriptive narrative for more information about the server.
Keyword - contains short words to aid catalogue searching.
2
WFS uses Geography Markup Language (GML) which encodes geodata in XML.
GML enables the storage, transport, processing, and transformation of geographic
information.
OnlineResource - defines the top-level HTTP URL of this service. Typically the
URL of a "home page" for the service.
Fees - indicates any fees imposed by the service provider for usage of the service
or for data retrieved from the WFS. The keyword NONE is reserved to mean no
fees.
AccessConstraints - any access constraints imposed by the service provider on the
WFS or data retrieved from that service. The keyword NONE is reserved to
indicate no access constraints are imposed.
2.1)WFS DescribeFeatureType
There is FeatureType named Ireland:county
We will explore this type with a DescribeFeatureType request:
In the following if you do not have the FeatureType loaded into GeoServer then
substitutive one you do have loaded.
2.1.1)Examine the description of county
http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=Ireland:county
2.2)WFS GetFeature
To get the actual data, do a GetFeature request.
http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typeName
=Ireland:county
This gives us a large GML file
3)OpenLayers
Open Layers is an open source client-side JavaScript/AJAX framework for overlaying
various mapping services. It supports various mapping APIs such as Google, Yahoo,
Microsoft Virtual Earth, OGC WMS, OGC WFS, KaMap, Text layers, and Markers to
name a few. The JavaScript can be embed directly into a plain html file.
An OpenLayers.Layer.WMS object accepts four parameters in the constructor:
The first argument is the name of the layer. This shows up in the legend.
The second argument is the URL to the WMS server. You don’t need to include
any of the GetCapabilities parameters, but you do need to make sure you include
the trailing question mark.
The third argument specifies the layer(s). This is where you append any
name/value pairs to the QueryString.
The fourth argument (not shown below) is a set of OpenLayers specific
arguments. Again, you will see this in action in just a moment.
Here is an example showing how to display two data layers from GeoServer. Use the file
ol.html from student distrib
\\offaly.cs.dit.ie\student_distrib\PBrowne\SPATIAL-DATABASES-CD\Data
Lab7\\ol.html
and place it in
3
C:\Program Files\GeoServer 2.0.1\data_dir\www
Then call it from your web browser as
http://localhost:8080/geoserver/www/ol.html
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<style type="text/css" >
#map {
width: 500px;
height: 500px;
border: 1px solid black;
}
</style>
<script src="openlayers/OpenLayers.js" ></script>
<script type="text/javascript" >
//NOTE: center the map of Ireland
var lon = -8.0;
var lat = 53.833333;
var zoom = 7;
var map, us;
function init(){
map = new OpenLayers.Map('map' );
dublin = new OpenLayers.Layer.WMS( "dublin historical" ,
"http://localhost:8080/geoserver/wms?" ,
{layers: 'Ireland:dublin_historical'} );
counties = new OpenLayers.Layer.WMS( "counties" ,
"http://localhost:8080/geoserver/wms?" ,
{layers: 'Ireland:county'} );
map.addLayer(counties);
map.addLayer(dublin);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.LayerSwitcher() );
}
</script>
</head>
<body onload="init()" >
<div id="map" ></div>
</body>
</html>
5) Other client
5.1)Using OpenJump as WMS client
From main menu File | Open | WMS layer
Enter
http://localhost:8080/geoserver/wms?service=wms&version=1.1.1&request=GetCapabilities
4
Press Next, answer Yes.
Select a layer e.g. tasmania
5.2)Using uDig as WMS client (needs updating)
Install uDig from CD or from
http://udig.refractions.net/files/downloads/udig-1.1.1.exe
Add our WMS to the Catalog area at the bottom of the screen:
5
• Right-click the bottom pane, and choose Import.
• Add our WMS server by clicking Data.
• Choose Web Map Server.
• Enter the URL to our server’s GetCapabilities document:
http://localhost:8080/geoserver/wms?service=wms&version=1.1.1&request=GetCapabilities
5.3)Using uDig as WFS client
In general WFS is more useful for interactive use that WMS.
WMS just gives you an image WFS gives you the data.
I did not have time to look at this.
5.4)Using OpenJump as WFS Client
In OpenJump you can handle WMS but not WFS
http://localhost:8080/geoserver/wms?service=wms&version=1.1.1&request=GetCapabilities.
To do WFS you need a plugin from:
http://openjump.org/wiki/show/WFS+PlugIn+Description
6) WPS on the Web
Explore map services at;
http://geoserver.itc.nl/natatlas/
WEB MAP SERVICES (WMS):
View map with layers=nationalegrenzen,kust,provinciegrenzen
Explore WFS and WPS services at:
6
http://ccip.lat-lon.de/ccip-wps/client/client.html
WEB FEATURE SERVICES (WFS):
DescribeFeatureType request: request that a Web Feature Service generates a document
describing one or more feature types in detail.
TYPENAME= provencie
Explore the web services at:
See video at;
http://52north.org/maven/project-sites/download/wps/demos/AgileUdigDemo2007.html
See example at:
http://www.ordnancesurvey.co.uk/oswebsite/services/osondemand/Demo/intro1.html
Different WPS messages
http://ccip.lat-lon.de/ccip-wps/client/client.html
Download and Install uDig
Start uDig
Make new project with File | New Project
You make place the project file in any convenient directory
Select Layer | Add Layer | Web features Service
Use the following URL for the WFS service
http://geoserver.itc.nl:8080/geoserver/wfs
Select spanish_roads_types from the resource section
7
You should see a map like the following/
Select Layer | Add | Web Processing Service
8
There are many service available
You should select
org.n52.wps.server.algorithm.simpifiy..douglaspeukeralgorithm
Enter the parameters for the simplifying algorithm
9
After processing you should get a simplified or smoother road network
In uDig you can do both
http://geoserver.itc.nl:8080/geoserver/wfs
http://geoserver.itc.nl:8080/wps/WebProcessingService
OGC examples
http://schemas.opengis.net/wps/1.0.0/examples/
degree
http://ccip.lat-lon.de/
http://ccip.lat-lon.de/ccip-wps/client/client.html
Using OpenLayers together with Google Map API.
http://localhost:8080/geoserver/www/ol-demo.html
To see how this page works, look the source of the above page.
10
The OpenLayers class hierarchy is described at:
http://dev.openlayers.org/releases/OpenLayers-2.7/doc/apidocs/files/OpenLayers-js.html
Some good examples of OpenLayers usage is:
http://trac.openlayers.org/browser/trunk/openlayers/tests/manual
Provides intervisibility service
http://geo.sazp.sk/
Inspire Translation
http://dev.bnhelp.cz/inspire/client/
© Copyright 2025 Paperzz