Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Revision as of 11:40, 14 March 2013 by jasfox (Talk | contribs)

Using the RESTful Map API together with HERE Maps API

From Wiki
Jump to: navigation, search

In short the Nokia Maps APIs allow you to integrate Nokia maps into your web pages. The Nokia Maps API offers a variety of essential map functionality out of the box like, panning, zooming and support for W3C positioning built in to modern browsers. However in some situations it is just enough to show the map image. This is where the RESTful Map API comes into play.

The RESTful Map API is light weight, but full-blown, offering for easy access of map data. Map data is served as a single image, which makes it highly compatible with variety of devices. You don’t even need JavaScript so show the map.

To maximize the compatibility and to potentially reduce initial page load time, you can combine these two APIs. JavaScript is not supported on some mobile devices browsers which is not ideal if you are creating content for a mobile friendly website. One way to circumvent this problem is by having a plain map image served up on the page initially. Then only after the user clicks on the map the interactive Map is loaded. In this way you can potentially save on initial load time and be reassured that all of your visitors are able to see the map.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9" />
<title>RESTful Map API Image with Nokia Map API for JavaScript</title>
<!-- No additional support required here. -->
<script type="text/javascript" charset="UTF-8" src=""></script>
<script type="text/javascript">
// Don't forget to set your API credentials
// Replace with your appId and token which you can obtain when you
// register on
nokia.Settings.set( "appId", "YOUR APP ID GOES HERE");
nokia.Settings.set( "authenticationToken", "YOUR AUTHENTICATION TOKEN GOES HERE");
<script type="text/javascript">
function showFullMap(){
var mapContainer = document.getElementById("mapContainer");
mapContainer.innerHTML = "";
// Create a map inside the map container DOM node
var map = new, {
zoomLevel: 4, //zoom level for the map
center: [50.5,15.5], // center coordinates
components : [
<div id="mapContainer" style="width:540px; height:334px;">
<img src=",15.5&amp;h=334&amp;w=540&amp;z=4&amp;nord&amp;nodot&amp;sb=k&amp;appId=YOUR APP ID GOES HERE&amp;token=YOUR AUTHENTICATION TOKEN GOES HERE" onclick="showFullMap();" alt="Map of Europe" />

Note.pngNote: In the example above, the following RESTful Map API parameters have been set to match the definition of the dynamic Nokia Map

  • c - Centre Point 50.5° latitude 15.5 ° longitude
  • h - Height 334 pixels, same as the height style of the map container <div>
  • w - width 540 pixels, same as the width style of the map container <div>
  • z - zoom level 4, same as the map.
  • nord, nodot, sb - The image should not attempt to redirect, no dot is required over the centre point and a scale bar is required.
  • appId and token - standard authentication parameters

Article Metadata
Tested with
Devices(s): Internet Explorer, Google Chrome , Firefox, Opera
Platform(s): Web
Dependencies: Nokia Maps 2.2.4
Keywords: Nokia Maps, JavaScript, Map Image, RESTful
Created: isalento (17 Jan 2011)
Updated: jasfox (05 Jan 2012)
Last edited: jasfox (14 Mar 2013)
99 page views in the last 30 days.