×
Namespaces

Variants
Actions

HERE Maps API - Reading and displaying Map Features

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code ExampleTested with
Devices(s): Google Chrome 20.0 x, Firefox 13.0
Dependencies: HERE Maps 2.5.3
Article
Keywords: HERE Maps, JavaScript, features
Created: Maveric (27 Jun 2011)
Updated: avnee.nathani (18 Jan 2012)
Last edited: jasfox (28 Nov 2013)


This article features an example on how to read, display and load Map Features

Contents

Introduction

This example uses the HERE Maps API Feature manipulation functionality, described in the API Reference here:

http://developer.here.net/docs/maps_js/topics_api_pub/nokia.Features.html

Please check it out for detailed description on the subject.

Prerequisites

HERE Maps API supported web browser (basically any modern web browser will do).


Example code

This example loops through and displays all supported features/sets and features of the current map. It also attempts to load features and handles success and failure, and in this example the load should be a success.

function retrieveMapFeatures(map){
 
var list = nokia.maps.Features.getFeatureMap();
 
// Loop through the features and show them in an alert
// Returns a map of implementations for each registered feature.
for( var i in list ) {
if ( list.hasOwnProperty(i) ) {
alert("Feature Map: "+list[i]);
}
}
 
var list = nokia.maps.Features.getLoadedMap();
// Loop through the features and show them in an alert
// Returns a map of the names of fully loaded feature
// implementations per feature.
for( var i in list ) {
if ( list.hasOwnProperty(i) ) {
alert("Loaded Map:" +list[i]);
}
}
 
var load_Successful =function (result){
alert("SUCCESSFUL FEATURE LOADING");
}
var load_Failed =function (result){
alert("FEATURE LOADING FAILED");
}
 
nokia.maps.Features.load(
{"map": "auto", "routing": "auto"}, load_Successful, load_Failed);
nokia.maps.Features.load({"map": "auto", "search": "auto"}, load_Successful, load_Failed);
}

A fully working example can be found at:

https://github.com/heremaps/examples/blob/master/maps_api_for_javascript/advanced-examples/reading-map-features.html

Summary

Feel free to modify the code for your own purposes.

For more on the HERE Maps API

Please check out the HERE Maps API full documentation and API reference here:

You may also access the interactive API explorer

Tested with

  • Google Chrome 20.0 x
  • Firefox 13.0
This page was last modified on 28 November 2013, at 11:49.
132 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×