Hikar (see github repository) is an augmented reality app for Android (4.0+) 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):
- green = footway
- brown = bridleway or anything with designation=public_bridleway
- red = byway
- orange = track
- blue = cycleway
- white = road, or anything else
These were taken early September 2013 just before SOTM; further work has been done since so it may not look exactly like this.
Hikar basically "works, but with issues" at the moment, with acceptable performance on a Samsung Galaxy SIII and a Nexus 7, though is not optimised for densely-mapped urban areas and may well crash (it is stable in Southampton but crashed in Birmingham, for instance). Seeing as it is geared at countryside users I do not consider this a massive problem. The main issues at the moment are:
- GPS inaccuracy leading to the OSM way being offset from its true position
- Difficulty in aligning OSM data with the camera feed when climbing hills due to the difficulty of holding the device steady
- Occasional compass inaccuracies. On the SIII the compass appears to be stable, but slightly offset from where it should be. I think this is simply down to inherent inaccuracies in smartphone compass hardware. To counter this you can now offset the bearing using the volume keys; thanks to ShowMeHills for inspiration!
- Rendering needs improvement and some debugging; some odd artefacts overlaying the OSM data on the (near-transparent) height data, particularly noticeable when SRTM data is used rather than OS LandForm PANORAMA.
- Possible out-of-memory issues when parsing the GeoJSON on low memory devices or when data is dense. In tests, JSON has so far given significantly faster loading/parsing times than either XML or a spatialite database, though if anyone does know of optimisation tricks for the latter, please let me know!
Please note that Hikar is "researchware" and intended for people who want to play around with the technology, and other interested people. It is not yet 100% intended for end-users. It can be downloaded here. Please prepare for the possibility of the app crashing if you run it!
Source code is available here. Ensure you set your device up to allow installation from non-trusted sources.
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 run your own Freemap server - see below.
Hikar and Google Glass
The combination of Hikar and the up-coming Google Glass leads to some potentially exciting possibilities - imagine wearing a Google Glass headset and being able to navigate with it! This should hopefully also resolve the problems with being able to hold your device steady when using a smartphone.
Setting up hikar for your own country
If you are interested in getting Hikar to work in your own country, you will need to setup your own Freemap server: a tile- or bbox-based server of OSM data from a PostGIS database as GeoJSON. You will also need appropriate NASA SRTM height files on your server.
Installing a Freemap server
- Populate a standard OSM PostGIS database via the standard procedure (see here)
- Download appropriate NASA SRTM height files (see here)
- Check out the github repository (see here and install to your server.
- Change the path to HGTDIR in Freemap/common/defines.php so that it points to the directory containing your SRTM data.
- The PHP scripts assume that the PostGIS dbname and user are both 'gis'. Please edit the values of PG_DBNAME and PG_USER in Freemap/common/defines.php if not.
- Remove the line "require_once('/home/www-data/private/defines.php')" in Freemap/lib/functionsnew.php. This is used internally on Freemap's own server and not needed elsewhere - in fact, if you do not remove it an error will be generated.
- I *think* that should give you a working installation!
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:
- LandForm PANORAMA directory URL (location of LandForm PANORAMA files, irrelevant if you're not in the UK)
- SRTM web service directory URL (location of the PHP script which generates SRTM tiles covering areas less than one square degree. Location in the repository is Freemap/ws/srtm2.php)
- OSM GeoJSON web service directory URL (location of the web service generating OSM GeoJSON data; in the repository it is Freemap/0.6/ws/bsvr.php)
Changing the display projection
The display projection is by default 27700 (OSGB projection). However it can be changed to 3857 (Google Spherical Mercator) or theoretically, any projection supported by the Java version of proj.4. So theoretically it should support other countries' national projections. This is untested, however. 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.
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.