SAPUI5 meets #GeospatialTuesday: plotting a GPS tracking route from IoT on GeoMap
So, last week I published a blog Calculating a path from IoT GPS data on calculating the route using geospatial SQL based on data from SensorPhone app collected via IoT service of SAP Cloud Platform Neo environment and stored in SAP HANA. At the end I used an export to GeoJSON to visualize the path on the map using http://geojson.io service.
But what a coincidence: the new openSAP course “Maps and 3D Made Easy with SAPUI5” with Michael Murray started that same day! I must say I am the data guy, not a UI/Web developer. But by the end of the week 1 of this new course I was able to code my snippet visualizing the same IoT data set on SAPUI5’s GeoMap now! You can find it at: https://embed.plnkr.co/kEzGKiJtuyPKGru5XdL0/
First of all I needed access to that data set with GPS data points of my walk from a hotel to QCon conference in JSon format. Great news, IoT service in SCP Neo exposes it via OData 2.0 API.
I want the data set to be restricted to particular time frame (the day of March 5, 2018), sorted by the
G_CREATED timestamp, and in JSon format. The final URI was like this:
https://iotmmsi076835trial.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/app.svc/SYSTEM.T_IOT_A7B01790F3E80BC544A3?$format=json&$orderby=G_CREATED asc&$filter=G_CREATED gt datetime'2018-03-05T00:00:00' and G_CREATED lt datetime'2018-03-06T00:00:00'
In my case I wanted data for the offline scenario, so I saved the output to file
iot.json. You can find this file with data in the plunk (link above), if decide to experiment with this data as well.
Now based on the examples provided as part of the openSAP course I just:
- set the map to the OpenStreetMap (OSM), because it does not need API key to be used
- set the model to my JSon file:
var oModel = new sap.ui.model.json.JSONModel("./iot.json");
- update Route and Spot calculations to reflect my JSon paths for proper IoT data (this took me the longest, but hopefully now you can benefit from it)
And that was it! I certainly recommend this openSAP course, if you haven’t started it yet!!
‘Till next #GeospatialTuesday,
-Vitaliy, aka @Sygyzmundovych