Goal of this practical assignment is to set up the server-side of the Geoweb services architecture.
You will use the open source product GeoServer to publish geodata via a WMS (map service) and a WFS (data service).
The software needed for this assignment is:
For the web server: Apache Tomcat (installed in Lab 1)
For the data storage: PostgreSQL / PostGIS
For the WMS and WFS services: GeoServer
A web browser
The geodata that is needed:
A PostGIS table with cadastral parcels of Delft.
For this there is a zipped SQL script delft_parcels.sql available with insert statements (in the git repo, under the folder: data/lab3/ ).
đĄ Tip
It may be a good idea after data loading to create a spatial index on the geometry column. Check for example here.
In the text there are 6 questions. Answer these questions in your report.
â Question / Result #1
This is more a âmetaâ question as a start (which will not give you any points), about the computer you use for this assignment:
What kind of operating system does your computer have (Windows, Mac OS or Linux)?
If you know other specifics (version of the operating system, whether it is 32 or 64 bits) please also include that.
This is for us to know if the software works well on different systems.
In GEO1006 (GeoDBMS course) most / all of you have installed PostGIS. You can use that same database, same user and same schema for the GEO1007 practical assignments.
Note: if you did not follow GEO1006, then contact the supervisor present at the Geolab.
If you do not have a PostgreSQL installation anymore, or you want to re-install PostgreSQL with PostGIS, you can follow the instructions for Windows or Mac / Linux.
Download and install GeoServer by following the guideline how to install GeoServer.
To get a fast introduction to what GeoServer is meant for, read the âOverviewâ and âHistoryâ pages on their web site.
đĄ Hint
There are several ways to install GeoServer, but we choose to deploy it on our Apache Tomcat server which supports web archive files (.war). This makes deployment generally quite straightforward.
â Question / Result #2
What is the purpose of GeoServer (what is it meant for?), and what are the differences and similarities between GeoServer, a web server (such as Apache Tomcat) and the database server (PostgreSQL with PostGIS)? Also, in your answer include a drawn diagram in which you explain how these components relate to each other.
Start your web server (Apache Tomcat) if it is not running already, and go to the GeoServer âWeb Administration Interfaceâ: http://localhost:8080/geoserver
Log in with (default) username admin and password geoserver.
Goal of this part of the assignment is to set-up an OGC WMS and WFS web service. This is done by defining a WMS/WFS layer in GeoServer that, in this case, connects to your PostGIS database. How to do that is explained step-by-step in the GeoServer user manual It offers two tutorials on how to set up a WMS/WFS service, one for geodata stored in ESRI shapefiles and one for PostGIS tables respectively.
â ď¸ Important
Skip the shapefile tutorial, only do the âPublishing a PostGIS tableâ tutorial, but with other data than mentioned in the tutorial, instead use the
delft_parcels.zipthat is on the git repo of the course.
Now execute the following steps:
Sync your fork on Github and pull the latest changes to your laptop.
First unpack the data in geoweb/data/lab3 and run the delft_parcels.sql
script to load the âparcelsâ table into your PostGIS database.
đĄ Refresher
If you are using pgAdmin4, use the
Query Toolto open and rundelft_parcels.sql. Make sure you havePostGISinstalled as an extension to your database or the commands will not work.
đĄ Tip
Confirm your database port (usually 5432) from pgAdmin 4 by right clicking on PostGresQL 16 and selecting properties. If it differs from the standard 5432, take a note, you will need it later.
Now follow the âPublishing a PostGIS tableâ tutorial:
Start with the section âCreating a new workspaceâ and take note of the following:
It is important to create your own âworkspaceâ (or ânamespaceâ), to be able to distinguish layers you have defined from the existing example layers.
Choose a short name, for example your first name (if that is unique among this courseâs students), and make that workspace the default one.
Move on to âCreating a storeâ After creating the workspace, you continue with defining your PostGIS âstoreâ.
Finally, tackle the âCreate a layerâ section.
After creating the âstoreâ, the next step is: Creating the âparcels layerâ.
The Spatial Reference System for the âparcelsâ data is: EPSG:28992 (= value for âDeclared SRSâ in the âEdit Layerâ form).
The result should be: One new layer in the layer overview, with the workspace name you created for yourself, and with the layer name âparcelsâ.
â Question / Result #3
Why is it essential to specify the correct SRS (Spatial Reference System also known as Coordinate Reference System or CRS) for a dataset, that is published as WMS/WFS layer via GeoServer?
The test can be done in GeoServer itself with âLayer previewâ. It is a useful way to test whether layers have been defined correctly. Note: The âLayer previewâ is in fact a âclientâ within GeoServer (it sends requests to the âweb servicesâ part of GeoServer).
Go to the âparcelsâ layer in âLayer previewâ, and select (from the âSelect oneâ list): WMS, with PNG or JPEG as output.
The result should be a second browser window (or tab), with:
the generated WMS GetMap request visible as url in the browser address bar
the response (the output) to the request: a map of the Delft parcels, retrieved via GeoServer at http://localhost:8080, where the data comes from your PostGIS enabled PostgreSQL database.
â Question / Result #4
4.1: Copy the
GetMapurl to your report4.2: Save the output map, and include it in your report (as image in the text, or as separate file)
4.3: List (in your report, create a table with) the parameters (Key Value Pairs) in the GetMap url after the â?â sign, and give a short explanation for each of these parameters with focus on: What is each parameter used for?
Again in âLayer previewâ request the same layer but now as data service, via a WFS request with GML 3.1 output, and secondly also with GeoJSON output.
â Question / Result #5
Include in your report:
The HTTP requests that is generated (this time it is a WFS
GetFeaturerequest)And save the GML output as (XML) text file
Also save the GeoJSON output as text file
5.1: Which differences do you see between the WFS request and the WMS request for the same âparcelsâ layer? Relate these differences to the different purpose of WFS and WMS.
5.2: Compare the GML 3.1 output with the GeoJSON output. Are there - besides the differences in âencodingâ (XML versus JSON) - also differences in data model (the way the data content is structured, and maybe details in one encoding that are not in the other encoding)?
In the âLayer Previewâ there is also the option to have a preview in OpenLayers. Choose that option to look at the âparcelsâ layer.
When you click on a parcel this results in a table row with information about that parcel (below the map).
â Question / Result #6
6.1: Use the Web developer tools of your browser (Firefox or other) to discover which web request is used to get that parcel information. What is that web request (copy the url to your report)?
6.2: In that web request: Is a unique identifier of the parcel used to get the parcel information? Or is another mechanism used? If so, what mechanism / method?
Your report with answers should be in one zip-file containing:
A short report with the answers to the 6 questions. Please include your names in the report, to prevent mix-up.
The image output of the WMS request (made in section 4) (as image in the text, or as separate file)
The GML output of the WFS request (made in section 5) (as separate text file)
The GeoJSON output of the WFS request (made in section 5) (as separate text file)
Bundle all source files in one zipfile, and name it as follows: lab3_lastname1_lastname2 (so two names if you work in a team of two).
Submit (together with the files and report for Lab 4) via Brightspace.