Searching on a Map for iOS

  1. Developing on the new Arm-based Apple Silicon (M1) Macs requires building and running on a physical iOS device or using an iOS simulator running iOS 13.7, e.g. iPhone 11. This is a temporary limitation in Google Maps SDK for iOS, and as such also a limitation in MapsIndoors, due to the dependency to Google Maps.
  2. Note: Due to a bug in CocoaPods it is necessary to include the post_install hook in your Podfile described in the PodFile post_install wiki.

Use the MPLocationService class to search for content in your MapsIndoors Solution.

This example shows how to setup a query for the nearest single best matching Location and display the result on the map:

let filter = MPFilter.init()
let query = MPQuery.init()
query.query = "Office"
query.near = MPPoint.init(lat: 57.057964, lon: 9.9504112)
query.take = 1

MPLocationService.sharedInstance().getLocationsUsing(query, filter: filter) { (locations, error) in
if error == nil {
let location = locations?.first
self.mapControl?.go(to: location)
}
}

This example shows how to setup a query for a group of Locations and display the result on the map:

let filter = MPFilter.init()
let query = MPQuery.init()

query.categories = ["Office"]
query.max = 50

MPLocationService.sharedInstance().getLocationsUsing(query, filter: filter) { (locations, error) in
if error == nil {
self.mapControl?.searchResult = locations
let firstLocation = locations?.first
self.mapControl?.currentFloor = firstLocation.floor
}
}

Please note that you are not guaranteed that the visible floor contains any search results, so that is why we change floor in the above example.