Places API Reference

Contents

UI API

 
nokia

Data API

 
nokia

jsMotif

 
jsMotif

Namespace nokia.places.searchManager

Namespace Summary

The namespace searchManager defines functions that allow you to use the Places search service to search for places and to obtain search suggestions. Searches for places can be viewed as a preliminary step to selecting a particular place for which to retrieve detailed information, using the functions defined on nokia.places.placesManager.

Method Summary

findPlaces (params)
This function searches for places on the basis of the parameters specified by the caller.
This function searches for places by category.
findRecommendations (params, includeRichContent)
This function retrieves recommendations for the location indicated by the caller.
getCategories (params)
This function retrieves the available (main) categories.
reverseGeoCode (params)
This method runs a reverse geocoding query based on the coordinates provided by the caller.
suggestPlaces (params)
This function retrieves suggestions that can be used with nokia.places.placesManager.findPlaces().

Method Detail

findPlaces (params)
This function searches for places on the basis of the parameters specified by the caller.
Parameters:
{Object} params
An object containing a number of parameters that define a search request:
  • {String} searchTerm - search term, required
  • {Function} onComplete - a function to be called when the request has been completed, required; the function must accept as arguments responseData, which is a place object containing data returned by the Places back-end, and status, which is a {String} constant with the value of 'OK' to indicate success or 'ERROR' to indicate request failure or time-out
  • {Object} searchCenter - an object containing the latitude and longitude of the starting point for the search ({latitude:'',longitude:''}); optional, if provided, useGeoLocation is ignored
  • {Boolean} useGeoLocation - if true and searchCenter is not provided, Places search tries to use the W3C Geolocation API to get the client location and use it as the search center; if this parameter is false and searchCenter is not provided, a global search is executed
  • {Number} start - the starting offset for results, optional
  • {Number} limit - maximum number of results to be returned, optional
Returns:
The return value is made available asynchronously as arguments passed to the onComplete handler; the responseData argument contains a response view (nokia.places.objects.SearchResponseView)
findPlacesByCategory (params)
This function searches for places by category.
Parameters:
{Object} params
An object containing a number of parameters that define a search request:
  • {String} category - required; a string constant containing the valid name of a category or a category id; you can obtain category names and ids from the list of available categories returned by the method nokia.places.searchManager.getCategories()
  • {Function} onComplete - required; a function to be called when the request has been completed; the function must accept as arguments responseData, which is a place object containing data returned by the Places back-end, and status, which is a {String} constant with the value of 'OK' to indicate success or 'ERROR' to indicate request failure or time-out
  • {Object} searchCenter - optional; an object containing the latitude and longitude of the starting point for the search ({latitude:'',longitude:''}); if this parameter is provided, useGeoLocation is ignored
  • {Boolean} useGeoLocation - if true and searchCenter is not provided, Places search tries to use the W3C Geolocation API to get the client location and use it as the search center; if this parameter is false and searchCenter is not provided, a global search is executed
  • {Number} start - optional; the starting offset for results
  • {Number} limit - optional; the maximum number of results to be returned
Returns:
The return value is made available asynchronously as arguments passed to the onComplete handler; the responseData argument contains a response view nokia.places.objects.SearchResponseView
findRecommendations (params, includeRichContent)
This function retrieves recommendations for the location indicated by the caller.
Parameters:
{Object} params
An object containing request parameters:
  • {String} placeId - id of a place (from nokia.places.objects.Place)
  • {Function} onComplete - a function to be called when the request has been completed, required; the function must accept as arguments responseData and status described below
  • {Object} searchCenter - an object containing the latitude and longitude of the starting point for the search ({latitude:'',longitude:''}); the parameter is required if boundingBox is not provided and vice versa
  • {Number} radius - radius in kilometers (default 3)
  • {Number} limit - maximum number of recommended places to return (default 3)
  • {Array | String} categories - an array of {String} objects containing category ids or one {String} containing a category id; you can get category ids via the function nokia.places.searchManager.getCategories()
  • {Object} boundingBox - can be specified instead of searchCenter; it is an object with the structure: {topLeft: {latitude:'', longitude:''} , bottomRight: {latitude: '', longitude:''}}
{Boolean} includeRichContent
If this argument is true, rich content for the recommended places is retrieved provided that rich content is available and limit is lower than 15 items; if false no attempt to retrieve rich content is made
Returns:
The return value is made available asynchronously as arguments passed to the onComplete handler; the responseData argument contains a response view, which is an instance of nokia.places.objects.SearchResponseView
getCategories (params)
This function retrieves the available (main) categories. Each category object returned contains of the category id, its localized name and the URL of the category icon - see also nokia.places.objects.Category.
Parameters:
{Object} params
An object containing the following element:
  • {Function} onComplete - a caller-defined function to handle incoming results
Returns:
The return value is made available asynchronously as arguments passed to the onComplete handler; the responseData argument contains a tree like hash-map of instances of nokia.places.objects.Category each object may have additional field categories where subcategories might be found
reverseGeoCode (params)
This method runs a reverse geocoding query based on the coordinates provided by the caller. A default radius is applied.
Parameters:
{Object} params
an object containing the coordinates to be used in a reverse geocoding query:
  • latitude - {Number}, latitude in degrees in the range [-90 .. 90]; values outside this range result in failed queries
  • longitude - {Number}, longitude in degrees in the range [-180 .. 180]; values outside this range result in failed queries
  • onComplete - {Function}, a function to be called when the request has completed, required; the function must accept as arguments:
    • responseData - an instance of nokia.places.objects.Place containing data returned by the Places back-end
    • status - {String}, a constant, with the value of 'OK' to indicate success or 'ERROR' to indicate request failure or time-out
Returns:
The return value is made available asynchronously as arguments passed to the onComplete handler; when status is 'OK', the argument responseData contains a place object, which is an instance of nokia.places.objects.Place
suggestPlaces (params)
This function retrieves suggestions that can be used with nokia.places.placesManager.findPlaces().
Parameters:
{Object} params
An object containing parameters that define a request for suggestions:
  • {String} searchTerm - required; a suggestion query term
  • {Function} onComplete - required; a function to be called when the request has been completed; the function must accept as arguments responseData, which is a place object containing data returned by the Places back-end, and status, which is a {String} constant with the value of 'OK' to indicate success or 'ERROR' to indicate request failure or time-out
  • {Object} searchCenter - optional; an object containing the latitude and longitude of the starting point for the search ({latitude:'',longitude:''}); if this parameter is provided, useGeoLocation is ignored
  • {Boolean} useGeoLocation - if true and searchCenter is not provided, Places search tries to use the W3C Geolocation API to get the client location and use it as the search center; if this parameter is false and searchCenter is not provided, a global search is executed
  • {Number} start - optional; the starting offset for results
  • {Number} limit - optional; the maximum number of results to be returned
Returns:
The return value is made available asynchronously via the argument responseData passed to the handler function onComplete as a response view object (nokia.places.objects.SearchResponseView)

Copyright © 2011 Nokia. All rights reserved. Terms and Conditions