This post intends to be an introduction to the use of web services provided by Osiris. These services, are available through REST protocol and provide response data in JSON format. For further details see the API reference section of this site.
As a tool for making requests to a REST service we will use Advanced REST Client (ARC), which is a plugin for Google Chrome.
For the example calls, all services will be available from our local server using the following address:
Another important point is that we need an application key that identifies the data set to use in all our requests. This identifier is the same you have used to upload the map. In example, if uploaded your map using a command similar to this one:
Then, the application identifier will be Aachen.
Now, let’s imagine we have our map already uploaded and we want to retrieve some information. In order to do that, we will invoke the search method. The query to perform this operation has the same syntax defined by MongoDB’s reference manual. So, to get all the indoor elements which are within a set of coordinates that compound a polygon and belong to the second level, we can write something like this:
Note that the first and the last point (or coordinates) of the polygon are the same.
At this time we can try this query in ARC. Just translating everything we have shown before, the form can be filled as follows:
Analyzing the image, we can see the following:
The URL of the service is shown below. It is the one corresponding to the search method and we are specifying that we want to look in the MAP layer and limiting the quantity of results to 1000.
We are making a POST call using “Aachen” as an application identifier and telling the server that the content type will be json.
Our query is the same that we explained before.
On the other side, the server has responded with a 200 HTTP code, this means that our petition was well formed and has been processed correctly. Moreover the body of this response is the result of the query in json format.
Let’s go into detail for one of the items of the returned array:
The structure is quite readable and corresponds to a corridor in the second level that can be drawn using the coordinates from the collectionPointDTO property. Moreover, in your applications you can use different border and fill colors depending on the indoor tag value.