ajakl | 22 March, 2012 10:37
Imagine the following: 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 set by the current NDEF URI RTD specification of the NFC Forum, so there isn't necessarily a solution that works across all NFC enabled phones.
One approach is using the 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.
An alternative is to write the URL to Nokia Maps to the tag, 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, it redirects to the full Nokia Maps web client or the HTML5 version of it. However, MeeGo Harmattan 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.
On MeeGo, you can directly send out an HTML header to redirect the browser to the Geo URI (causing it to open Nokia Maps), without loading and rendering the actual web page. On Symbian, a JavaScript redirect can put the browser on the right track and trigger it to open the Nokia Maps client.
To make this easier for you, the new Nfc Interactor app (available for Symbian and the Nokia N9) lets you conveniently write geo tags by just entering the coordinates. In the tag compose view, you can also choose which of the three variants you want to write to the Nfc tag. The app will take care of formatting the actual NDEF message for the tag.
For your experiments, the maps redirection PHP script explained above is hosted on http://nfcinteractor.com/m.php and can be used with a URI on the NFC tag like this:
http://nfcinteractor.com/m?c=60.17,24.829
Note that there is no service or uptime guarantee for the hosted script at nfcinteractor.com – it's intended for testing purposes only and could be removed at any point. You should host the script on your own server for real-world deployment. See the web services information page for more details.
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:
http://nfcinteractor.com/m?l=nokia
The source code of the Geo Tags redirection script is now also available under the open source BSD license, so that you can adapt it to your needs, add custom locations (instead of specifying the coordinates as parameters) and upload the script to your own web server.