Store location coordinates on an NFC Geo Tag.
you’re playing a treasure hunt game in your home town. At one station, you touch an NFC tag with your Nokia phone; this opens Nokia Maps to reveal the location of the final place where to collect the treasure. Similar scenarios are possible if you’d like to use Nokia Maps to navigate to the point of interest that you just read about; for example, the St. Stephen’s Cathedral in Vienna, after reading about it in a tourist brochure.
To implement this, you need to store the longitude and latitude of the landmark on the NFC tag (you could also call them “GPS coordinates”). But how to store them? This use case hasn’t been specified by the current NDEF URI record specification of the NFC Forum, so there isn’t necessarily a solution that works across all NFC enabled phones.
However, there are two alternatives:
- geo: URI scheme (RFC 5870): In the most simple and short form (important due to the limited space on a tag), the URI to write to the tag could look like the following: “geo:60.17,24.829”. This encodes the decimal coordinates with latitude of 60.17 and longitude 24.829 in WSG-84 (the location of the Nokia House in Finland, by the way). This works fine with the N9 and directly opens the Nokia Maps client showing the correct location, given that you have PR 1.1+, which is required for default NFC tag handling by the phone. However, Symbian currently can’t understand Geo URIs.
- Nokia Maps: write a URL according to the Nokia Maps Rendering API. For example: “http://m.ovi.me/?c=60.17,24.829”. When opening this URL on a Symbian phone, it automatically opens the Nokia Maps client at the correct location. On other devices like the PC or Android, it redirects to the full Nokia Maps web client or the HTML5 version of it. However, on MeeGo Harmattan it just shows the static map image and doesn’t start the Nokia Maps client.
So, those two approaches don’t work across the Nokia portfolio. However, there is a simple solution: store the URI of a small script on a server, which then redirects a MeeGo (or Android) phone to the Geo URI, and every other device to the Nokia Maps URI. You can retrieve the operating system by checking the user agent of the browser.
Hosted Cross-Platform Geo-Tag Service
NfcInteractor.com is hosting this generic script, which you can use to create platform-independent geo tags. Usage is simple – pass latitude and longitude to the script, similar to both examples above:
This script checks the user agent, and will either redirect to a URL following the Geo URI scheme for phones that support it (e.g., the Nokia N9), or to the Nokia Maps URL, which opens the Nokia Maps client on Symbian or the web / HTML5-version of it on other products.
For terms and conditions of using the web service, see the general Web Services page.
The script hosted on NfcInteractor.com is released under the open source BSD license, so you can download it and host the web service on your own site. This is recommended for real-world deployment of your services.
Additionally, hosting the service on your own web server allows you to add custom-named places to the script, so that the link on the tag doesn’t need to contain the coordinates, but you can link to a custom place-name instead. See the source code of the script for details on how you can add your own places. Example:
The source code of the geo tag redirection PHP script is available through the SVN server at Nokia Developer Projects!