This article defines the NokiaMaps API for JavaScript, explains its purpose, summarizes its features and outlines how it supports third-party application development.
The Nokia Maps API for JavaScript (the Maps API) is a set of programming interfaces that enable developers to build Web applications with feature rich, interactive Nokia Maps at their center. The API consists of libraries of classes and methods with which to implement the functionality of an interactive application.
The associated API Playground offers ready-made working examples, whose code the developer can modify and view the effect immediately.
The main features offered by the Maps API are summarized in the table below:
| Feature | Description |
|---|---|
| Nokia Maps map data | The API provides full access to world-leading map data in three different modes: satellite, terrain and hybrid. |
| Points of interest | The map data to which the API offers access, include millions of different places, landmarks, places and addresses located on maps. Their visibility on the map can be controlled via the API. |
| Searches | The API allows you to build search functionality into you application. Users can searches for places, using keywords, addresses, or geographic coordinates. |
| Geocoding | The API provides full access to geocoding and reverse geocoding services. |
| Routing | The API allows you to define and render routes between a start and a destination point. It supports many navigation options such as toll road preference and transport type. |
| W3C positioning | The API includes built-in functionality that takes advantage of the W3C Geolocation API supported by many browsers. |
| Custom items | The API allows you to modify existing markers or create custom ones, using SVG or bitmap images. You can also add geo shapes based on coordinates to the map: polygons, polylines, circles or rectangles, and make these custom map object interactive by assigning UI events to them. |
The Nokia Maps API is modular and contains separate packages for maps, places, positioning, directions (routing) and data rendering. If an application does not require certain packages, you can reduce the footprint and load time by excluding them.
The entry point to the API is the JavaScript file "jsl.js" (see also Quick Start). It contains a package loader and an environment detection mechanism. To load the API, set the "src" attribute of a <script> element to the base URL followed by the name of this file. You can alter the packages loaded by the <script> element by appending the parameter with, followed by the equals sign (=), followed by a comma-spearated list of packages. If you do not specify any packages (that is if you use the URL only without the with parameter), the Maps library package is loaded by default.
The table below shows the packages you can select, using the query parameter with and the default loading behavior.
| URL Parameter | Allowed Values [1] | Default |
|---|---|---|
| with | maps, positioning, places [2], placesdata [2], directions, datarendering, all [4] | maps [3] |
The following notes relate to this table:
| [1] | values can be combined in a comma-separated sequence, but specify either places or placesdata (not both); all must not be used if any other package is specified |
| [2] | places means that the complete Places library is loaded (both UI and data); to load the data-only Places library, use placesdata |
| [3] | equivalent to "with=maps,placesdata", which loads the Maps library package and the Places data-only library package, not the Places UI library |
| [4] | all loads all the available libraries |
The example below shows an HTML page that loads the following library packages: Maps, Places (complete), Rouging and Positioning.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7;
IE=EmulateIE9" />
<script type="text/javascript"
src="http://api.maps.nokia.com/2.2.4/jsl.js?
with=maps,places,directions,positioning">
</script>
</head>
<body>
...
</body>
</html>
Please note that the last part of the URL before the name of the JavaScript file is the release version number for the Maps API, which means that the URL changes, depending on which version you wish to use.
The Maps API is a multi-purpose and cross-platform API, targeting all JavaScript-enabled Web browsers, whether desktop or mobile, as well as all HTML5 environments (see the next section for information about HTML5 support).
Because the number of possible browser and platform combinations is too large, we limit our support to the following list of browsers:
| Browser | Support |
|---|---|
| Internet Explorer 7+ | desktop, Windows Phone with Mango update or later on mobile* |
| Firefox 3.6+ | desktop |
| Google Chrome 12+ | desktop, Android 2.2+ on mobile/tablet* |
| Apple Safari 5+ | desktop, iOS 4+ on mobile/tablet |
| Opera 10+ | desktop and mobile* |
* support does not extend to all multi-touch gestures
The table above does not imply that the Maps API can be used only on the platforms it lists. If you are developing for a platform not shown in the table, we suggest that you test your application thoroughly in the target environment and report any issues via our Discussion Board.
Although HTML5 is a new emerging HTML standard, and as such it is still undergoing continual improvement, the Nokia Maps API is committed to supporting it.
For information regarding the latest features of HTML5 please visit the official HTML5 Specification page of the W3C. Details on HTML5 compliance in different Web browsers, are available on THE HTML5 TEST.
The built-in support for HTML5 in the Maps API enhances the user experience in browsers that implement the following aspects of the HTML5 specification:
The Nokia Maps API has been designed to meet the demands of modern Web application development. The common development patterns it implements help improve efficiency and shorten the development cycle.
Nokia's Maps API for JavaScript is free to use under the Nokia Maps API terms and conditions and subject to limitations set out on the Nokia Location Platform page http://www.developer.nokia.com/Develop/Maps/Quota/. This site also outlines alternative licensing options for developers. Please note that the use of any of the Nokia Location Platform APIs must be accompanied by authentication credentials. For information on how to obtain the credentials, please see Acquiring Credentials.