To search for locations using the MapsIndoors JS library, you can use the search
method of the mapsindoors.LocationsService
object. Here's an example code snippet:
index.tsx489 chars18 lines
In this example, we first create a mapsindoors.Map
object for displaying the map. Then, we instantiate a mapsindoors.LocationsService
object for performing the location search.
We define the search query as the string "restaurant". We then call the search
method of the locationsService
object with the query
parameter. This method returns a promise that resolves with an array of search result objects.
Finally, we handle the search results in the then
callback of the promise. In this example, we simply log the results to the console. If there's an error during the search, we handle it in the catch callback.
gistlibby LogSnag