Locations
Using Mappedin SDK for iOS with your own map requires an Enterprise license. Try a demo map for free or refer to the Pricing page for more information.
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 iOS Github repo: ListLocations.swift
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 an array of MPILocations
sortedLocations = mapView?.venueData?.locations.filter {
$0.type == "tenant" && // Filter locations with a type of tenant.
$0.description != nil && // Filter locations with a description.
$0.logo?.small != nil // Filter locations with a small logo.
} ?? .init()
sortedLocations.sort { $0.name < $1.name }
A complete class that uses the code snippet in this guide can be found in the Mappedin iOS Github repo: ListLocations.swift