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.

step-by-step instruction:

Prepare ESRI and geoJSON shapefiles

SAP HANA

Import the lowest-level ESRI

(File > Import > ESRI Shapefiles)

Prepare organizational hierarchy

Create calculation view

SAP Lumira

Import geojson shapes

(array of shapes)

giphy (1).gif

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

Once you prepare all your shapes, import the lowest-level (the most detailed) one to SAP HANA. You may import the ESRI shapefile using either SQL commands or SAP HANA Studio menu functions.

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.:


L3 L2 L1
Poland MEE CEE
Germany DACH CEE
Bulgaria SEE CEE

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.

geojson_js.PNG

Be aware, that array keys should matchyour dimensions and NAME attribute your data.

Download

You may find the extension at https://github.com/michalkorzen/CustomChoropleth

Acknowledgements

This extension would not be available without the contribution of Mustafa Aydogdu: Lumira Geo Maps Extension with Custom Regions/Shapes and Data Points

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Vincent Dechandon

    I’m currently surprise there is no comment yet in there.

    Michal, this a great job as well as a great start for someone who’d want to get his hands dirty with extension development.

    However, I have several questions about what you’ve done but this would be quite painful to write it in the comments.

    Still, seems like I can’t send you direct messages (because we’re not both-way linked on SCN?), would be cool if I could do so 🙂 .

    Br,

    Vincent

    (0) 

Leave a Reply