Locations

An MPILocation represents a specific area of interest such as a store location, meeting room or washroom. They contain a rich amount of metadata about a location such as a its name, description, operating hours, logo, phone number and more.

A complete class that uses the code snippet in this guide can be found in the Mappedin Android Github repo: ListLocations.kt

An MPILocation's MPINodes and MPIPolygons can be on multiple MPIMaps, or in multiple non-adjacent places on the same MPIMap. For example, all washrooms at a given venue could belong to one MPILocation. A washroom location might a have a few MPIPolygons spread throughout the venue for each washroom that exists. On the other hand, a department store could live on multiple floors. A single store can just have one presence, and therefore one MPIPolygon. Some Locations have a single point with MPINodes.

Location Types

Each location has a single MPILocation.type, which allows filtering or grouping locations of interest to the user. Location types can be unique for each venue. For example a mall may use types of amenity, landmark and tenant. A stadium could use gate, seat and restaurant. An office could use desk, meeting room and washroom.

Location Categories

Each location has 0 to many MPILocation.categories. Categories provide another way to filter and group locations. Location categories are also unique for each venue. Examples of categories for a mall could be Clothing, Electronics, Footwear and Food & Drink.

Code Sample

The code sample below retrieves all locations for a venue, filters those that have a type of tenant, a description, a small logo and sorts them alphabetically by name.

// sortedLocations is a listOf<MPINavigatable.MPILocation>()
sortedLocations = mapView.venueData?.locations?.filter {
it.type == "tenant" && // Filter locations with a type of tenant.
it.description != null && // Filter locations with a description.
it.logo?.small != null // Filter locations with a small logo.
}?.sortedBy { it.name }
?: listOf()

A complete class that uses the code snippet in this guide can be found in the Mappedin Android Github repo: ListLocations.kt

Was this page helpful?

Next Topic

A-B Wayfinding