Skip to main content

@mapgear/geoapps > Search

Search class

Provides access to the address search functionality of GeoApps. Can be accessed through the Map.Search-property.

Signature:
export declare class Search 

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the Search class.

Example

An example of the usage, using a reference to a DOM-element with the id '#Search' which is an input field #Search' is purely illustrative for the example and not a definitive requirement for the functionality.

// Connect as anonymous user to a geoapps environment
geoapps.Initialize("<specified tenant>");

// Add the map to a div with element id `map`
var map = geoapps.AddMap("map", "<mapId>");

// Wait till the map loaded, before starting search functionality
map.onLoaded.add(() => {
// Autocomplete functionality
$("#Search").on("input", function () {
var val = $("#Search").val();
map.Search.AutoComplete(val, (data) => {
console.log(data);
})
});

// Select search result value
map.Search.Select(<value>);
});

Methods

MethodModifiersDescription
AutoComplete(searchTerm, callback)Generate an autocomplete list for the search results
Select(value)Select the search result and zoom map to location