Refreshing Search Properties

You can perform a new search at any time after the Local Context Library has initialized. This is useful any time you need to refresh Local Context data, such as when the user pans to a new area, or if you have postponed the initial loading of Local Context data by setting maxPlaceCount to 0.

To trigger a search and refresh Local Context data, do either of the following:

  • Call localContextMapView.search() to manually refresh Local Context data when no changes to current search properties are needed. If locationRestriction is set to null (the default value), a call to search() will refresh the places based on the current viewport.

The following example shows calling search():

    localContextMapView.search();
  • Update one or more localContextMapView search properties (maxPlaceCount, placeTypePreferences, locationRestriction, locationBias). Updating one or more of these properties will automatically trigger a new search.

This example shows updating maxPlaceCount and placeTypePreferences:

    localContextMapView.maxPlaceCount = 10;
    localContextMapView.placeTypePreferences: ['bar', 'drugstore']

Multiple consecutive property changes in the same call stack will be grouped and called simultaneously. Updating a property to its same current value will typically not trigger a search; updating non-search properties will not trigger a search.