Custom choropleth map extension with drill-down for SAP Lumira
Many companies and various organizations want to visualize their data on choropleth maps with native-like drill-down capability to switch between organization hierarchy levels. However, native built-in political boundaries of the world often make no sense to their business, as ones usually differ from their business units/regions…
The presented extension is a solution proposal for the given common problem – it was prepared after hours for a demo purposes, so it’s far away from being perfect, but seems to work, that is why I decided to share it. The core functionality is based on Mustafa Aydogdu’s Leaflet.js map extension for SAP Lumira. The main differences are:
- only choropleth shapes are provided (no circles/markers)
- custom regions hierarchy is supported with native-like drill/filter capability
Let me explain how it works on a business-case: imagine, we’d like to visualize coming data (flying objects with GPS coordinates only) with SAP Lumira and SAP HANA Platform with spatial option.
Prepare ESRI and geoJSON shapefiles
Import the lowest-level ESRI
(File > Import > ESRI Shapefiles)
Prepare organizational hierarchy
Create calculation view
Import geojson shapes
(array of shapes)
1. Prepare ESRI and geoJSON shapefiles
The first step concerns defining and exporting custom shapes to ESRI and geoJSON format. I suggest keeping the same geodesy standard (EPSG:4326) in both cases. At the moment Leaflet.js supports EPSG:3857/4326/3395 out of the box. The shapes may be prepared with QGIS (free and open source), which makes creating, editing and publishing very easy. Each layer should have a unique identifier (“NAME” attribute).
2.1.1 Import the lowest-level ESRI shapefile
2.1.2 Prepare organizational hierarchy
To optimize HANA workload, we execute spatial join only within the uploaded shape, remaining less detailed layers will be handled by cheaper inner/reference join condition. To achieve that we need to create auxiliary structure acting as a level or parent-child hierarchy, e.g.:
2.1.3 Create and activate calculation view
The last step concerns creating graphical calculation view, which gonna be used in HANA live connection in SAP Lumira. First, define your spatial join. Then, join the dictionary (created hierarchy in 2.2). On a semantic level don’t forget do set hierarchy. Pay attention to the names of dimensions as they are crucial at the moment of loading particular map in SAP Lumira.
2.2.1 Import geoJSON shapes
Copy & paste created geoJSON shapes / layers to geojson.js file.
Be aware, that array keys should matchyour dimensions and NAME attribute your data.
You may find the extension at https://github.com/michalkorzen/CustomChoropleth
This extension would not be available without the contribution of Mustafa Aydogdu: Lumira Geo Maps Extension with Custom Regions/Shapes and Data Points