Skip to content

Buildings

Required

Needed by every integration.

Overview

Building object represents a physical building. A building consists of one or several floors, each visually represented by a floor image. Each positioning session is going on a floor in a building. Coordinates of all the objects in the system (Device Position, Regions, Proximity Triggers, and Location Tags) are defined relative to a building Coordinate System.

Search buildings

You can search for available buildings by a search term or around a specific location. The results of the search are IPSBuildingsSearchResult objects containing the buildings names as well as unique IDs which can be used to request full building's metadata.

To initiate a search request, call one of the following methods:

  • IPSCore.searchBuildingsByName()

    let cancellable = IPSCore.searchBuildingsByName(searchQuery, 
        onSuccess: { results in
            // success
            // results: [IPSBuildingsSearchResult]
        }, onError: { (error) in
            //failure
        }
    )
    

  • IPSCore.searchBuildingsByLocation()

    let locationManager = CLLocationManager()
    if let location: CLLocation = locationManager.location {
        let cancellable = IPSCore.searchBuildingsByLocation(
            latitude: location.coordinate.latitude,
            longitude: location.coordinate.longitude,
            onSuccess: { (results) in
                // success
                // results: [IPSBuildingsSearchResult]
            },
            onError:{ [weak self] (error) in
                //failure
            }
        )
    }
    

Warning

The search is only possible if the IPSCore.ConnectionState is IPSCore.ConnectionState.online and a login was performed.

Client Building ID

If you maintain your own database of venues (stores, malls, office buildings), Oriient can associate each of your venue IDs with the corresponding Oriient building (set up by the Oriient Ops team during onboarding). All SDK APIs expect the Oriient building ID, so resolve your own ID to it first using IPSCore.getBuildingByClientId():

IPSCore.getBuildingByClientId(
    clientBuildingId: "[Your Client Building ID]",
    onSuccess: { building in
        // The Oriient building ID can now be used in other APIs, e.g. IPSPositioning.startPositioning()
        let oriientBuildingId = building.id
        let floors = building.floors
    },
    onError: { error in
        switch error.code {
        case .invalidInput:
            // This Client Building ID does not exist
        default:
            // Other error, e.g. bad network
        }

        switch error.recoveryStrategy {
        case .login:
            // Login is required before using this API
        case .retry:
            // Likely a network issue — safe to retry
        case .unrecoverable:
            // Do not retry — likely invalid input
        }
    }
)

Building's Metadata

The metadata of a building can be requested by ID using the IPSCore.getBuildingById() method. This method will load the IPSBuilding object representing the requested building.

Each IPSBuilding object contains the building's:

  • Unique ID, IPSBuilding.id;
  • Name, IPSBuilding.name;
  • Floors, IPSBuilding.floors;
  • Primary floor, IPSBuilding.primaryFloor;
  • Geographic coordinates of the building's Coordinates System origin, IPSBuilding.origin;
  • Angle from building's Coordinates System to ENU, IPSBuilding.rotationToENU;
  • Geographic coordinates of the point recommended to use as the building center for geofencing service, IPSBuilding.geofenceOrigin;
  • Radius recommended to use for geofencing service, IPSBuilding.geofenceRadius.

Important

The combination of IPSBuilding.origin and IPSBuilding.rotationToENU enables conversion between the building coordinates system and geographic coordinates. Define it using REST or Dashboard.

Info

The IPSBuilding.primaryFloor represents the floor which should be used as a starting point for positioning in case there is no information about the current floor the device is located on.

Floors

Floors in a building are represented by the IPSFloor object. The visual representation of a floor is its floor image, which you can request by calling IPSCore.getFloorMapById() with the building ID and floor ID.

Important

If while positioning a device moves from one floor to another the framework will notify about it reporting a floor change. (See Manage Floor Change for details).

Each IPSFloor object contains the floor's:

  • Unique ID, IPSFloor.id;
  • Name (for example: 'Parking lot', 'Reception', 'Lobby'), IPSFloor.name;
  • Short name (for example: '1', 'p1'), IPSFloor.shortName;
  • Order index among the other floors in the building, IPSFloor.order;
  • Height of the floor, IPSFloor.height;
  • Entrances of the floor (might be empty), IPSFloor.entrances.