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.

HERE Maps API - Performing multiple concurrent search requests

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleTested with
Devices(s): Internet Explorer, Google Chrome , Firefox, Opera
Platform(s): Web
Dependencies: HERE Maps API 2.5.3
Keywords: HERE Maps, JavaScript, Search
Created: Maveric (25 Oct 2011)
Last edited: jasfox (28 Nov 2013)



In this article we will examine the following usage of the HERE Maps API.

  1. Multiple addresses exist, a total of 10 for this example.
  2. A Map Marker is needed to be displayed for each of the addresses.
  3. Finally the ZoomLevel needs to be set to cover all of the Markers.

This article enforces the correct use of the search.Manager in case of multiple concurrent requests.


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

Important note about maps credentials

Nokia provides several services options within the Maps API offering. The service is free to use, but you must obtain and use authentication and authorization credentials to use the services. Please read the Terms and Conditions and check the Pricing Plans page to decide which business model best fits your needs. Authentication requires unique Maps API credentials, namely an AppId and a token. You can get these credentials free for free following the instructions here


function concurrentSearch(map){
// we will put our address markers into this container
addressContainer = new;
managersFinished = 0;
//Addresses to be displayed
addresses = ["Helsinki, Finland", "Zaragoza, Spain", "Berlin, Germany",
"Colorado Springs, USA", "Houston, TX", "London, UK", "Vancouver, Canada",
"Hyderabad, India", "Beijing, China", "Ilomantsi, Finland" ];
var i = addresses.length;
// iterate over all addresses, create a manager for each of them,
// add the observer and call the geocode method
while(i--) {{
searchTerm :addresses[i],
onComplete: onSearchComplete
function onSearchComplete(data, requestStatus) {
if (requestStatus == "OK") {
// if we are finished, we add a marker for the mapped position
//increment the counter to notify another manager has finished
} else if(requestStatus === "ERROR") {
// we'll also increment in case of an error
// if all managers are finished, we call the final function
if(managersFinished === addresses.length) {
function onAllManagersFinished() {     
//we get the bounding box of the container
var bbox = addressContainer.getBoundingBox();
// if the bounding box is null then there are no objects inside
// meaning no markers have been added to it
if (bbox != null) {
// we have at least one address mapped
// so we add the container and zoomTo it
map.zoomTo(bbox, true);
} else {
// otherwise we'll pop up an error message
alert("There are no addresses to show :(");


A fully working example can be found at:

This page was last modified on 28 November 2013, at 11:46.
122 page views in the last 30 days.