Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you are looking to make multiple concurrent reverse geocode requests. There is no problem in doing this, since the calls are asynchronous, you just need to keep a count on which requests have completed, and call your "do-after-all-completed" stuff once at the end:</p> <p>e.g:</p> <pre><code>function concurrentSearch(map){ // we will put our address markers into this container addressContainer = new nokia.maps.map.Container(); managersFinished = 0; //Locations to be displayed latLngs= [[10,30], [-117.5, 15.3] ... etc]; var i = latLngs.length; while(i--) { nokia.places.search.manager.reverseGeocode({ latitude: latLngs[i][0], longitude: latLngs[i][1], onComplete: processResults }); } } </code></pre> <p>With a callback function as shown:</p> <pre><code> function processResults(data, requestStatus) { if (requestStatus == "OK") { // if we are finished, we add a marker for the mapped position var marker = new nokia.maps.map.StandardMarker(data.location[0].position); marker.content = data.location[0].address.text; // add your content here addressContainer.objects.add( marker); //increment the counter to notify another manager has finished managersFinished++; } else if(requestStatus === "ERROR") { // we'll also increment in case of an error managersFinished++; } // if all managers are finished, we call the final function if(managersFinished === latLngs.length) { onAllManagersFinished(); } } </code></pre> <p>And the final clean up:</p> <pre><code> 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.objects.add(addressContainer); map.zoomTo(bbox); } else { // otherwise we'll pop up an error message alert("There are no addresses to show :("); } } </code></pre> <p>Futhermore, you could add a single event handler on the <strong>container</strong>, which could open the infobubbles for all of your locations:</p> <pre><code>addressContainer.addListener( "click", function (evt) { infoBubbles.openBubble(evt.target.content, // content is your own stuff... evt.target.coordinate); } ); </code></pre> <p>If you need to pass in more of your information when reverse-geocoding, you can do it in the manner described in the question <a href="https://stackoverflow.com/questions/18190043/is-there-a-way-to-associate-the-reponse-and-query-while-invoking-nokia-reverse-g">here</a> </p> <p>The solution to a similar problem (multiple geocoding requests) can be found <a href="http://rawgithub.com/heremaps/examples/master/maps_api_for_javascript/demos/concurrent-search-requests/index.html" rel="nofollow noreferrer">here</a>. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload