Hikar - Augmented Reality for Walkers and Hikers


Hikar (see github repository) is an augmented reality app for Android (4.1+) which overlays OpenStreetMap ways on the device's camera feed. Its aim is to help navigation for walkers/hikers (hence the name) and other outdoor users. For example, imagine you are entering a large field and it's not clear where the exit is. Hikar will overlay the course of the footpath on your phone's camera feed allowing you to navigate across the field. Or, you're at a junction of paths and it's not clear which is the correct way. Again, Hikar will indicate which path is correct by overlaying the course of the path on the camera feed. Or, you're having to make your way across a pathless moor. Again, Hikar will show you the way.

The colour scheme used is (referring to the highway tag):

Using Hikar

When Hikar starts, choose your mode (UK or International, see below). Data will then be downloaded from the Freemap server (or from the device storage; once downloaded, data is cached on the device). If the download fails (e.g. no network connection), it will try again shortly. You can also pre-download data for a certain area before you go out (to avoid relying on poor network connectivity in the countryside); to do this select the "Download data at a given location" menu option and enter the latitude and longitude of where you are going. A 30x30km area containing this latitude and longitude will be downloaded.

Hikar will automatically work out the horizontal field of view of your camera and your device's compass. However if these are inaccurate you may change them as follows:

Demos

These were taken early September 2013 just before SOTM; further work has been done since so it may not look exactly like this.

Current status

Hikar basically works at the moment, with acceptable performance on a Samsung Galaxy SIII, a Nexus 5, and a Nexus 7, though is not optimised for densely-mapped urban areas and may well crash in very large cities (on a SIII, for instance, the then-current version was stable in Southampton but crashed in Birmingham at the time of SOTM 2013). Seeing as it is geared at countryside users I do not consider this a massive problem. Nonetheless it can be considered a prototype version currently, rather than a polished end-product. The main issues at the moment are:

Obtaining Hikar

Please note that Hikar is, to some extent, "researchware" and the current version can be considered a prototype. Nonetheless it is reasonably usable, though note the issues above. It can be downloaded here.

Source code is available here. Ensure you set your device up to allow installation from non-trusted sources. It will shortly be available on Google Play.

Coverage

As the data is obtained from the Freemap server, coverage of Hikar as it stands is restricted to the areas covered by the Freemap server, namely England and Wales. However in theory it is possible to set it up for your own country if you are prepared to set up your own OSM and SRTM servers, or use someone else's publicly-available servers - see below. If using someone else's server, you must of course abide by their usage policy!

Setting up Hikar for your own country or region

If you are interested in getting Hikar to work in your own country or region, you will need:

The OSM GeoJSON server must take a "bbox" parameter of bounding box coordinates (in degrees, order w,s,e,n) and return the data as lat/lon in standard 4326. The "bsvr.php" from the Freemap source repository (here) will work as long as you have a standard OSM PostGIS database installed as well as the entire Freemap server-side source code from the repository. This script is in the directory 'fm/ws' within the repository. You will need to edit 'fm/ws/ws_defines.php' to use your correct PostGIS database and username.

For the SRTM height data, the easiest thing is to get hold of srtm2.php from the Freemap repository (ws/srtm2.php within the repository). As long as you have appropriate SRTM data installed on your server and you have a full installation of the Freemap server-side source code (srtm2.php needs a couple of library functions from the Freemap PHP library), this will work. You will need to edit the source code of srtm2.php so that HGTDIR refers to the directory holding the SRTM data. Again, srtm2.php takes a bounding box; it is capable of extracting bounding boxes within a .hgt file, rather than having to download the whole thing.

Setting the hikar preferences to point to your server

In Hikar itself, there are three preferences to set so that it talks to your server, not mine:

Changing the display projection

Hikar has two modes, UK and International. The former uses 27700 (OSGB) by default; the latter uses 3857 (Google Spherical Mercator) . However, theoretically, this can be changed to any projection supported by the Java version of proj.4 (see GitHub repository of Android-compatible version here). So theoretically it should support other countries' national projections. Projections should be metres-based (eastings and northings measured in metres) as equal x, y and z dimensions are assumed by the OpenGL renderer and heights are in metres. So Google Spherical Mercator, while supported, will actually be a little inaccurate, away from the equator at least, as Google eastings are measured in metres at the equator. However in tests it's reasonably acceptable here in the UK.

How it works (briefly)

Hikar uses the Android location and sensor APIs to obtain the location and orientation of the device, then loads OSM data (as GeoJSON, produced from a PostGIS database) and height data (either SRTM or Ordnance Survey LandForm PANORAMA) from the Freemap server. The data is then cached on the device to avoid network access next time you're in that area. The height data is used to position the OSM data in 3D, e.g. overlay a footpath on the slope of a hill so that it appears correctly. The sensor API is used to obtain an orientation matrix which is then used with OpenGL to display the OSM data overlaid on the device's camera feed.

Any questions, please email me (Nick Whitelegg)

Note: Much of this text was taken from the Hikar OpenStreetMap wiki page.

Privacy policy

Hikar uses the camera to show the real world on the phone screen. It does NOT use the camera for any privacy-violating actions such as taking unwanted pictures of yourself or your surroundings. No camera images are stored on the device or uploaded to a remote server.

Hikar also tracks the device's location as this is necessary for the correct footpaths to be overlaid on your current camera feed. Again, personally-identifiable location data is not sent to the server or stored anywhere else. The current latitude and longitude is sent to the Freemap server for the purposes of finding the correct OpenStreetMap data for your current location only.