Hikar see gitlab 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. 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
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.
Hikar basically "works, but with issues" at the moment, 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 slightly offset from its true position
- Uses a lot of battery power (but this is perhaps inevitable for this sort of app)
- 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, to some extent, "researchware" and therefore might be more interesting to people who want to play around with the technology, including developers, rather than casual end-users. Nonetheless it is reasonably usable, though note the issues above. Consequently the most up-to-date version is only available as source code. However an apk is occasionally produced, see here.
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 it is possible to setup a server which works with Hikar anywhere in the world. For instance, as a test I set up a server to cover the Mount Olympus area of Greece, and it worked in the field. To do this, see below.
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:
- A server which serves GeoJSON data by bounding box
- A server which serves SRTM height data
The 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 (https://gitlab.com/nickw1/Freemap) will work as long as you have a standard OSM PostGIS database installed. This 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:
- 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 SRTM server, see above)
- OSM GeoJSON web service directory URL (location of the web service generating OSM GeoJSON data)
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: https://gitlab.com/nickw1/javaproj)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.
See the Hikar page on the Freemap server.
Author Nick Whitelegg (nickw), last update 03/10/18