Challenge Project


swissAR is an augmented reality web app displaying relevant information about the user's surroundings.

swissAR is a project based upon Toposwiss, a Virtual Reality model of Switzerland. swissAR is a mobile web app providing geographical information about the user's surroundings. Like Toposwiss, it is driven by an open-data digital elevation model (DEM) published by the Swiss federal office of topography and by toponymy databases listing Swiss city and village names, postcodes, mountain peaks, cultural heritage sites, bus and railway stations, sports facilities etc.


Launch your camera app, hold your smartphone upright and point it towards the QR code. Confirm website access, camera access, geolocation and motion sensor access. Hold still during calibration. As soon as swissAR displays the information you can turn around and discover any point of interest within a range of 10 kilometers.

In the center a compass will indicate your current heading. The buttons at the bottom allow for adjusting the height of the virtual camera. Tap on the arrow-up button in order to lift the cam by 1000 meters or the arrow-down button to lower it respectively; on the bottom left a cam height indicator will display your current virtual height above ground level. Hit the reload button to recalibrate the app if needed.


To avoid the camera and geolocation confirm dialogs on startup you can adjust your smartphone settings.

  • iOS Safari: Go to
    • Settings > Safari > Location Services > Allow
    • Settings > Safari > Camera > Allow
  • Android Chrome: Go to
    • Chrome > Settings > Location > Allowed
    • Chrome > Settings > Camera > Allowed


On startup swissAR will launch the camera, retrieve geolocation data, current compass heading and access motion sensor data. It will then process the elevation model in order to determine the user's height above sea level and any relevant point of interest within a given distance. swissAR will work anywhere in Switzerland; outside Switzerland it will take you to Berne (or any other place when using parameters, see below). swissAR does not store any kind of user or session data, neither on the device nor on the web server.

swissAR has been built with A-Frame and the Augmented Reality component AR.js. A-Frame XR projects are rendered by any major web browser and on any platform. Yet, swissAR has been designed for mobile use and will not work on desktop computers properly due to the lack of a rear camera or motion sensors.


swissAR makes use of the HTML 5 geolocation API. The output (world geodetic format, in decimal degrees) must be converted into Swiss coordinates (zero point in Berne, see below), the javascript processing of which is as follows:

navigator.geolocation.getCurrentPosition(function(position) { // HTML 5 geolocation API
   var n, e;
   var b1=position.coords.latitude∗3600; // conversion algorithm
   var l1=position.coords.longitude∗3600;
   var b2=(b1-169028.66)/10000;
   var l2=(l1-26782.5)/10000;

The coordinates will then be rounded and matched against the DEM grid (further information on Wikipedia). Finally the scenery is aligned to the current compass heading which can be retrieved as follows (cross-platform solution):

window.addEventListener("deviceorientation", function(e) { // get current compass heading
   var heading;
   if (e.webkitCompassHeading) heading=e.webkitCompassHeading; // get webkit compass heading
   else heading=e.alpha; // get android compass heading


swissAR is parametrizable in order to access locations other than the current one. Valid parameters are place names (case sensitive), postcodes or plain coordinates.

  • (geolocation accepted) → current location
  • (geolocation denied, or outside Switzerland) → zero point of the Swiss coordinate system (600 000 E/200 000 N) at the old astronomical observatory of the University of Berne
  • → Chur, Canton of Grisons
  • → Zurich
  • → Wengen, Canton of Berne



Thomas Weibel


29.08.2020 14:15 ~ twb

Event finished


Event started

Contributed 4 years ago by twb for GLAMhack 2020

Connect to our community on: | twitter | facebook

All attendees, sponsors, partners, volunteers and staff at our hackathon are required to agree with the Hack Code of Conduct. Organisers will enforce this code throughout the event. We expect cooperation from all participants to ensure a safe environment for everybody. For more details on how the event is run, see the Guidelines on our wiki.

Creative Commons LicenceThe contents of this website, unless otherwise stated, are licensed under a Creative Commons Attribution 4.0 International License.