Dealing with floor images
Dealing with the Floor
Entity, you'll be able to get the uploaded floor plan image of a given floor.
It can be accomplished using the following endpoint URL:
GET https://api.omniaccess-stellar-asset-tracking.com/api/v1/sites/{siteId}/buildings/{buildingId}/floors/{floorId}
You will get in response a JSON body representing the floor:
HTTP Response: 200 OK
{
"status": 200,
"message": "The floor has been successfully fetched.",
"data": {
"createdAt": "2019-10-05T10:52:37.874Z",
"updatedAt": "2019-10-05T10:52:37.874Z",
"id": "5d9875f5e1a0bd06ba5085c3",
"name": "Foor test 1",
"description": "Floor test",
"floorNumber": 1,
"relativeAltitude": 3,
"map": "data:image/png;base64,iVBUhEUg...AABEQzAAAAAXNSR0",
"mapFileName": "floor1.png",
"mapUrl": "/images/floors/1116b59d-a0d9-491b-a3cb-058112b27fe8.png",
"mapCoordinates": {
"type": "MultiPoint",
"coordinates": [
[
-4.412909913808108,
48.44125100249419
],
[
-4.41273292992264,
48.44194600894336
],
[
-4.412645731936209,
48.441220381776006
],
[
-4.412468522787095,
48.44191539559465
]
]
},
"building": "5d9875d4e1a0bd06ba509e7611"
}
}
To embed the floor plan image in your application, you can use 2 mechanism:
-
Use the base64 encoded floor plan image
The
map
key in JSON response, contains the floor plan image encoded in base64 format. -
Use the direct link to floor plan image
The
mapUrl
key contains the full url to your image uploaded on our servers. Simply prefix this url with the server url to access to your image.
https://api.omniaccess-stellar-asset-tracking.com/images/floors/1116b59d-a0d9-491b-a3cb-058112b27fe8.png
The main difference between the two mechanisms is that with the second one (direct link), an outgoing HTTP request will be made from your application to display the floor plan image.