Newer
Older
# **Assignment report**
## **Task A: system setup & administration**
### _Work done_
1. Installed and configured Tomcat
* Used ``tomcat7`` and ``tomcat7-admin`` packages.
* Added ``manager`` user with the ``admin-gui`` and ``manager-gui`` roles.
* Configured Tomcat to only serve requests through AJP connector on ``127.0.0.1:8009``.
(See Apache section below for explanation.)
2. Installed and configured GeoServer
* Used the latest stable release (version ``2.7.0``).
* Chose to stick to Java 7, because of Java 8 not being “officially” recommended for production with GeoServer AFAIK.
* Modified the password of the ``admin`` user.
* Imported a Shapefile into a new assignment-specific workspace, in order to provide a WFS layers with data over NL.
3. Installed and configured Apache
* Used ``apache2`` package.
* Set up a AJP reverse proxy, to behave as a frontend to Tomcat.
Explanation of this choice:
• Setting Tomcat to serve on port 80 requires additional configuration.
• In my experience, Apache is more versatile and powerful in terms of configurations (access control, URL rewriting, SSL/TLS configuration, etc).
• Apache can be used to load balance between several GeoServer instances.
• It can be handy for serving outage pages in cases where you need to upgrade the webapp and wait for a restart.
4. Configured and activated the firewall
* Allowing only HTTP (port 80) and SSH (port 22) incoming connections.
5. Carried out common tasks
* Kept all packages on the server up to date (security best practice).
* Configured and activated a swap file, due to the limited amount of RAM
available.
### Application usage
#### Java server backend
* Running the application with Maven's Tomcat plugin: `mvn tomcat7:run`
Then point your web browser to ``http://localhost:8080``
* Building the application WAR file: `mvn package`
(will also run unit tests in the process)
#### JavaScript client frontend
On startup, the user is presented with a full-screen map view. At that point, it
is possible to zoom, pan and move around the map.
Via a control in the top left corner, the creation / edition of user
features can be made.
A “feature” is made of several properties : an ID, a label and a geometry.
While the ID is automatically generated by the server, the user is responsible
of setting the value of the label (form field) and the geometry (WYSIWYG editor).
All features can be deleted at once with a dedicated button, while individual
features must be deleted in the edit popup window.
In this application, background layers are tile-based MapQuest and OSM sources.
On the other hand, foreground layers are (hand-selected) WFS resources.
The application provides an “intersection mode”, which can be switched ON/OFF
via a checkbox at the top-right corner.
When this mode is ON, data from foreground / WFS layers is restricted to areas
which intersects with user features.
This is achieved through an OGC ``Intersects`` filter within the WFS
``GetFeature`` request.
This data filtering could have been done at the client side, using OpenLayers
capabilities. However, it would have incurred lots of data transfer and put a
strain on the web browser memory usage.
##### Known issues
Having user features which geographically overlap breaks WFS requests made
This is due to how the WFS ``GetFeature`` query + ``Intersects`` filter is constructed
(``MultiPolygon`` made of the combination of all ``Polygon`` features).
### _Software libraries selected_
#### JavaScript client frontend
Apart from having a lot of experience with OpenLayers (__2__), I've chosen
OpenLayers over, say Leaflet, because of the need to have a full-featured
library, handling in particular GML and WKT formats, the WFS protocol
and providing an API to manipulate features and geometries.
Third-party plugin to overcome the lack of built-in layer selector in OpenLayers 3.
I've slightly modified it to be more compatible with Bootstrap (conflicting
CSS style names) and to always keep the panel open.
Provides useful UI widgets (e.g. popup) with an elegant look and feel.
Used as a general purpose library for common tasks (DOM nodes manipulation,
event handling, etc).
#### Java server backend
The application is built using Maven and make uses of Maven Tomcat plugin in
particular, to ease the development process.
1. Application foundation
* _Spring framework core API_
Dependency injection, tests, servlet, etc.
* _LogBack_
Modern and powerful logging framework compatible with SLF4J API.
2. Data persistence
I made my selection with the goal to have a pluggable and extensible solution
that makes possible to (almost) transparently switch between DB implementations
simply by modifying configuration files.
* _Spring Data JPA_
Provides an easy yet powerful way to implement a data access layer, build
on top of repositories with automatic default methods.
* _EclipseLink_
Full-featured reference implementation of the JPA specification that is
compatible with lots of databases (including HSQLDB).
* _HSQLDB_
Embedded database that can be run either with a filesystem backend or
fully in memory (this mode being used in this application).
3. Data validation
The application code contains a ``javax.validation``-based solution that
validates input data before saving entities.
In this case, the ``geometry`` field of the ``Feature`` entity is validated
through a WKT parser.
* _javax.validation_
* _GeoTools_ (WKT parser)
4. REST
* _Jersey_
Reference implementation of the JAX-RS specification, that easily plugs
into _Spring_ dependency injection features via a dedicated module.
4. Tests
* _TestNG_
Unit test framework compatible with both _Spring_ and _Jersey_.
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
```
WebViewer displaying a map (of the Netherlands).
Viewer has standard functionalities as zooming, panning, layer selection.
Viewer has possibility to draw a own geometry on the map.
Viewer has ability to send a user drawn geometry to the server.
Server does a check if the user drawn geometry has intersections with (server side defined) wfs layers and returns result of these checks.
What has to be build:
Server Component
- build with Java (7 or 8)
- usage of build management tool (preferable maven, but gradle or ant is also ok)
- War file (to be deployed in Apache Tomcat) or Standalone application (Spring Boot (jetty, tomcat))
- Make use of libraries (geotools, spring framework, jersey, dropwizard)
- Rest interface for
- receiving geometry and sending back if geometry intersects defined wfs layers
- defining wfs layers
- getting list of defined wfs layers
- checking if wfs layer is available
- add wfs layer
- view available wfs layer
- delete wfs layer
- update wfs layer
- check intersections between geometry and defined wfs layers
- server component persists wfs layers in file database (hsql, h2)
Client component
- build with HTML, Javascript
- Zoom
- Pan
- Layer selection
background (these are only options, feel free to add your own layers)
http://geodata.rivm.nl/geoserver/ows?
forground (options, feel free to add your own layers)
http://geoservices.rijkswaterstaat.nl/nwb_wegen
http://ahn.geodan.nl/ahn/viewer3/cgi-bin/tilecache/tilecache.py/1.0.0/
http://www.spatineo.com/ is a good place to find free services
- Drawing an editing of geometry in viewer
- Sending Geometry to server component
What do we expect:
- working example
- unit tests
- source code
- motivation for decisions (why usage of geotools or H2 database)
What do we provide:
- accessible linux server
- login credentials for server
- email adress for questions