IOT Garden Project-Maps
Azure Maps
This is the fifth instalment of my IoT Garden Project.
The first introductory instalment is found here.
In my garden project I thought it would be interesting to get geospatial information on my garden within Azure Maps. The ability to present analytical data over a map is a good way to visualise my IOT garden status.
The diagram above is the Azure Maps overlay of my vegetable garden. If I zoom into this GPS location In my project I will see it display moisture levels for the garden plots. A colour reference from light blue for dry to dark blue for moist will present a quick visual indicator in a pleasant visual map context.
The above diagram is azure maps view drilled down to scale excluding the surrounding roads. Azure Maps is a collection of geospatial services and SDKs that use live mapping data to provide geographic context to web and mobile applications. One of Azure maps services is the Creator service, that allows me to create and render maps based on private indoor map data. In my IOT garden project each plot of land is rendered very similar to building structures.
This design of the garden was created in AutoCAD. It is a collection of rectangles and labels that looks much like a floor plan.
A structure or model created in a CAD design program is uploaded into the Azure maps service. The file format of the design is in a .DWG format. Once the design is uploaded into Azure maps, I need to run the Azure maps conversion API utility which converts the DWG file into an Azure resource.
My garden model design is a collection of rectangles created in a CAD program with the layout and dimensions of my actual garden. After I have converted the design into an Azure map resource, I need to then create a dataset from the resource. The dataset is a collection of map features, such as garden plots, buildings, levels, and rooms.
To create a dataset, use the Dataset Create API. The dataset Create API takes the conversion-Id for the converted Drawing package and returns a dataset-Id of the created dataset. The dataset process analyses the design, determines the rectangles defined as buildings, rooms, and plots and creates a set of data attributes to define the design layout.
Next i create a tile set which is a set of vector tiles that render on the map. Tile sets are created from existing datasets. However, a tile set is independent from the dataset from which it was sourced. If the dataset is deleted, the tile set will continue to exist. The tile set is the rendered attributes that reflect visualised data in colour for example.
The tile-set information for plot 117 is an example below. You will notice that the properties of the plot contain GPS vector information. The GPS info is used to render this tile set on an Azure map.
{ "type": "Feature", |
Next Use the Feature State service to support dynamic map styling. Dynamic map styling allows applications to reflect real-time events on spaces provided by IoT systems. In the example below I have shown how a moisture content between 1 and 100 is translated into an assigned colour. The state data is divided into several bands and a colour hex code is assigned for the band.
{ "keyName": "moisture", |
When the digital Twin of my vegetable garden is updated with a new moisture reading it receives from the IOT device an Azure function will trigger. The event is received in the IOT Hub and triggers an azure function to update the digital twin properties and then send a POST API call to my Azure maps subscription. The role of the function will update the Azure Maps feature state for the specified plot. The value of the moisture reading is mapped to a tile set colour. The feature state is then updated to reflect high r low moisture. The Azure Maps feature set tile on the MAP will automatically update on the next refresh. The data flow logic is described in the diagram below.
The Azure function will change the moisture value of the specified plot through an API post message. The post looks like below.
The post message contains the subscription key, the state-set ID and the featureId which is the plot ID. In the payload the
state of moisture is set to 1 for unit22.
The payload is { "States": [ { "keyName": "moisture", "value": 1, "eventTimestamp": "2020-10-18T11:45:33" } ] }
In conclusion the real benefit of Azure Maps and delivering geospatial content through a mapping service is that you can overlay important data content over a MAP. If your environment has data to visualise over a large geographical area to a global scope, then the Azure maps service is an excellent tool to use.
For an agricultural view it is a great visualisation tool to compare data from farm sites with other farms in different locations.
In my next blog I will present Augmented reality over IOT where I can display real time garden sensor data and control systems over AR devices. For an agricultural view it is a great visualisation tool to compare data from farm sites with other farms in different locations.