Skip to content

Coordinate System

Optional

Needed if your app displays a map or uses geographic coordinates.

Introduction

Coordinates of all the objects in the system (Device Position, Regions, Proximity Triggers, and Location Tags) are defined relative to the corresponding building Coordinate System.

Building Coordinate System

Oriient uses a right hand coordinate system in meters for each building. A positive X coordinate goes to the right, and a positive Y coordinate goes upward. The origin of the Coordinate System is in the bottom left corner of the first image uploaded when creating a map related to a building.

Important

Android View Coordinate System starts from the top left; Oriient Coordinate System starts from the bottom left.

Geographic coordinates

To enable conversion between a building Coordinate System and geographic coordinates it is necessary to provide information about the building location.

Specifically, use REST to define:

  1. Geographic coordinates of the building coordinates system origin (IPSBuilding.getOrigin());

  2. Rotation of the building relative to ENU coordinates system (IPSBuilding.getRotationToENU()).

If these values are provided correctly every position update will contain geographic coordinates (as well as coordinates relative to the building coordinates system).

Floor Images

A floor image is the visual representation of a floor in a building. Request it using IPSCore.getFloorImageDataById() with the building ID and floor ID. The result is an IPSFloorImageData object, which contains the floor image's:

  • Unique ID, IPSFloorImageData.id;
  • Name, IPSFloorImageData.name;
  • Image, IPSFloorImageData.image — an IPSFloorImage, which is either an IPSFloorBitmapImage holding an Android Bitmap, or an IPSFloorSvgImage holding an IPSSvgImage with the SVG markup (svgString) and the image bounds (width, height);
  • Pixel-to-meter ratio (how many pixels of the image correspond to one meter), IPSFloorImageData.pixelToMeter;
  • Width and height of the area represented by the image, in meters, IPSFloorImageData.widthInMeters and IPSFloorImageData.heightInMeters;
  • Offset of the image's bottom-left corner from the building coordinate system origin, in meters, IPSFloorImageData.offset;
  • Preferred initial rotation of the image, in degrees (may be null), IPSFloorImageData.preferredInitialRotationDegrees;
  • Sign marks to present on the map, IPSFloorImageData.signMarks (see IPSSignMark).
IPSCore.getFloorImageDataById(building.id, floor.id, object : IPSListener<IPSFloorImageData> {
    override fun onSuccess(floorImageData: IPSFloorImageData) {
        when (val image = floorImageData.image) {
            is IPSFloorImage.IPSFloorBitmapImage -> {
                val bitmap = image.image // android.graphics.Bitmap
            }
            is IPSFloorImage.IPSFloorSvgImage -> {
                val svg = image.image.svgString
            }
        }
    }

    override fun onError(error: IPSError) {
    }
})

Deprecated APIs

IPSCore.getMapById() and the IPSMap it returns are deprecated since SDK 8.5.0, and IPSFloor.getMapId() since SDK 8.8.0. They will be removed in a future version — use IPSCore.getFloorImageDataById() with the floor ID instead.

Coordinates Conversion for Visualization

Using the floor image's pixel-to-meter ratio, height and offset, you can easily convert coordinates from meters relative to a building's coordinates system to pixels relative to the image, and use the resulting value to arrange correctly the objects on a mobile device screen.

// converts x coordinate in meters to offset from the left of the floor image, in pixels
fun getOffsetFromImageLeft(x: Double, floorImageData: IPSFloorImageData): Double {
    return (x - floorImageData.offset.x) * floorImageData.pixelToMeter
}

// converts y coordinate in meters (from bottom) to offset from the top of the floor image, in pixels
fun getOffsetFromImageTop(y: Double, floorImageData: IPSFloorImageData): Double {
    return (floorImageData.heightInMeters - (y - floorImageData.offset.y)) * floorImageData.pixelToMeter
}

Device Position

A device's position is always defined relative to a building Coordinate System. The contents of a position update are described in Manage Device's Position Updates.

Important

In case there is information about the building geographic location (See Geographic coordinates) each position will also contain valid latitude, longitude, altitude and azimuth values. Otherwise, the values will be equal 0.