The Swiss portal for the historical sciences


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 an Augmented Reality web app optimized for smartphones, allowing the user to get information about his surroundings (such as place names, peak and hilltop names, cultural heritage sites). Like Toposwiss, it is based on an open-data digital elevation model (DEM) published by the Swiss federal office of topography, as well as on 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 nearby.

In the center a compass will indicate your current heading by means of a compass needle and a degree indicator. 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 in order to recalibrate the app if needed.


To avoid the camera and locations 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 by means of the Javascript framework 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 optimized for mobile use and will not work on desktop computers properly due to the lack of a rear camera or motion sensors.


In order to work properly, swissAR requires access to GPS by means of the HTML 5 geolocation API. The data output in the world geodetic format (decimal degrees) have to be converted into Swiss coordinates (zero point in Berne, see below). The Javascript processing 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 observatory of the University of Berne
  • → Chur, Canton of Grisons
  • → Zurich
  • → Wengen, Canton of Berne



Thomas Weibel

6th Swiss Open Cultural Data Hackathon
6. June 2020
Multimedia tags: