Lumira Geo Maps Extension with Custom Regions/Shapes and Data Points
After creating my first spatial extension with google maps, I realised that cost of google maps api for commercial use may be an obstacle for productive use. Then I decided to create a second extension with leaflet.js library. There are several reasons behind selecting leaflet; it is mobile friendly, easy to use, flexible and has lots of features. I created below extension as the first version, I guess there are still several bugs that I didnt realize. I will be fixing bugs and adding new features if I can find time.
This first version of extension has below abilities;
Custom Regions/Shapes With Geojson Files
This is what my customers has always requested. Usually people want to have their own region definitions which is sometimes different than regular city or region shapes. Standart Lumira maps has this kind of fixed region definitions but, sometimes it doesnt include shapes for small cities.
This is where geojson works great. Geojson is a spatial json format which stores polygons, lines and points. It is easy to create geojson files from existing shape files. There are a lot of online services for this purpose. I am using mapshaper and geojson.io in order to convert my shape files to geojson. Additionally, you can google to find geojson files as well.
After converting or finding a geojson file you have to insert variable definition “var mapdata =” at the begining of file.
Second important point about geojson is, it has names for shapes. Values of “name” field must correspond to name of regions in your data file.
You have to name your file “geojson.js” and place it under “C:\Users\[YOURUSERNAM]\.sapvi\extensions\bundles\sap\viz\ext\geomapsleaflet” for Lumira 1.25+ and for the previous versions, you can place file under “C:\Program Files\SAP Lumira\Desktop\extensions\bundles\sap\viz\ext\geomapsleaflet”.
With the extension you will get us states geojson, but if you want to use a world map, it is also included.
Circles and Markers
In order to use circles and markers you must have data in latitude and longtitude format. Your field names must start with “lan” and “lon”, remaining letters are neglected. For the shape name, you can use what ever name you want. Extension determines dimension names dynamically.
When you go to layers button, you will see circles and markers selection. You can either select them together or use only one.
Circles are sized and colored according to data. Markers are only showing the place of data, you can click and see related data within a pop-up.
Tile Providers (Basemaps)
One of the best features of leaflet is, it is compatible with lots of tile providers. For my extension, I used only a couple of them to keep selection screen simple. However you can add others as well easily. Full list and demo can be found here.
Shapes and circles are colored according to your color palette settings under preferences. Thanks David Dalley for his blog about color palettes.
You can download here and try with your own data. Enjoy geo maps extension.