Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
B.P. edited this page Aug 18, 2014 · 2 revisions

The information about this project consists of this wiki, an initial blogpost, a mid-term blogpost, a final blogpost and a screencast

Introduction

The Gatherer app was a project of the Google Summer of Code 2014. It was hosted by the organisation 52° North. At 52° North it is part of the ILWIS community which mainly consists about people from ITC Enschede. Rob Lemmens, Martin Schouwenburg and Bas Retsios from ITC were the mentors for this project.

The idea was born out of the need to extend ILWIS objects to the mobile platform. In the end it should be possible to use the functions of an ILWIS server from the mobile app. For this connection to be convenient the app should be written in C++.

This app would be the first step in that direction. The starting point was to make it possible to digitize geographical points with information connected to it. So it would be possible to make certain observations on a specific position which would be stored on a remote server. For this there would be two preconditions; it should be possible to make and save an observation without internet connection (and then upload it later), and it should be possible to easily (down)load another template for another kind of observation. The initial templates we had in mind were landuse mapping, health mapping – cholera, health mapping – tuberculosis and water point mapping.

Set-Up Development Environment for Windows

To program the gatherer the QT environment is used. QT has a paid version and an open source version. The free version has been used and is sufficient. A handy guide to set up QT for Android can be found on their website. This one is extended here:

  • First QT should be downloaded and installed. It can be downloaded here4. The downloading and installation takes quite a long time (for me some hours).

The following extra downloads and installations are needed:

  • The Android SDK Tools, downloaded here. You can use the SDK for an existing IDE but if you like Eclipse for Java development you can also download the Eclipse version and use the SDK included for QT as well. No installation is needed.
  • The Android NDK, downloaded here. I suggest to save the folder in your QT installation folder and unzip it there (no installation needed).
  • Apache Ant v1.8 or later. Download here, unzip it also in your QT installation folder (not necessary there but it keeps organized that way).
  • Java SE Development Kit (JDK) v6 or later. You can download it here, install. Set the JAVA_HOME environment variable to the JDK install directory path.
  • On Windows, you need the following additional installations:
    • MinGW v4.8.0 revision 2, this was not needed in my case so probably I already had it.
    • Android Debug Bridge (ADB) driver on the Windows platform to enable USB debugging. The default USB driver on Windows does not allow debugging. For details about how to get the USB driver, see here. Check which driver is needed for your phone.

Now QT Creator has to be set up for android. Open Qt Creator, open Tools>Options>Android and set the paths for the JDK, SDK and NDK (to the folder), and for ant to /bin/ant.bat. For me it gave a warning: Qt versions for architechtures x86, mips are missing. But it still worked. OK and you are ready to go!

Structure of the code

The App is programmed with QT in a combination of QML and c++. QML is used to define the gui component and the logic is defined in C++.

The C++ part consists of five classes. I will summarize them.

The main class starts the app. It initiates objects of the other classes and connects them to the gui part.

The Options class stores the global settings (observer name, server address and last used template) and saves it to 'options.ini'. When it is initiated it reads the file to set the settings again as it was.

The DownloadTemplate class is responsible for all the downloads from the server. It has methods for downloading the template, the basemap and the historical observations. First it gets from the server the subjectlist as well. It keeps track of which templates there are locally and provides them as a model for a listview. When It is initiated it checks which templates there are already.

The CurrentObservation class handles all the logic for the current observation(s) and template. It saves, loads, deletes or uploads observations. It also parses the historical templates to show them on the map as well as reading the corner coordinates and the resolution of the map. It keeps also a list of all the observations made which are also loaded in when it is initiated.

The DataObject class is used to show the listviews with the required data. A DownloadTemplate object has two lists of DataObjects with templates available on the server and with local templates and a CurrentObservation object has one list with the saved observations. The class has fields to store the needed info for the listviews.

How these classes are related can be found in the Class Diagram below.

Class Diagram for the Gatherer

How to use the app

This is mostly described in the finalblog post (…) and the screencast but you should follow the following workflow: When the download template screen is opened the subjectlist is requested from the server and shown. When then a template is selected and chosen to download the template on the server is downloaded and cut in two; the metadata (saved as templatename.gatherer) and the gui (saved as templatename.qml). The basemap is saved as templatename.png and the historical observations as templatename.xml.

Recommendations

Recommendations for the code for future work:

  • Make the app flexible for different resolutions.
  • Read the gps in a different way or a different thread since on some phones it makes the loading of a template very slow.
  • Check upload all function.
  • Make the xml parser work correctly for templates with more than one field.
  • Add a "go to my location" button, that pans to the current GPS location.
  • Select the location of an observation through the map.
  • Include an option to use a bigger basemap as WMS or even a Google Maps or OSM layer.