Analyzing Global Earthquakes on Lumira with Google Heatmap Extension
In this blog, I wanted to analyze significant earthquakes from 2150 BC to present. Data is downloaded from data.gov. This dataset is important because of including latitude and longtitude information of earthquakes. Latitude and longtitude information will be used on google maps in order to visualize exact geo location of earthquakes. We will start with cleaning data and end with identifying a fault line.
1. Cleaning Data
Since the data is starting from 2150 BC, it is a little bit dirty. After visually discovering data, it can be clearly seen that, a lot of earthquakes doesn’t have magnitude information. Gray squares at below images shows years with no magnitude information. Since there were no measurement technology in the past, this is normal. The strange part is, there is an earthquake in 1580 with a magnitude of 6.2, I wonder how this earthquake has been measured in 1580.
Anyway, I filtered non-empty magnitudes and got all the earthquakes with a magnitude information. It seems that 2007 was not a good year for world.
2. Heatmap Extension
Next step is to visualize these earthquakes on a map. For this purpose, I developed an extension using Google Maps Javascript API.
Most challenging part of developing this extension is loading Google API into Lumira. Since we cannot modify html document directly, we have to insert js into HTML document via render.js file. This can be achieved either via requirejs or appending script into HTML like below. Important point is Google API js file must be edited as well. For this reason, I am using a modified version of script file, instead of URL.
We end up with a heatmap, that shows most dangereous parts of World in terms of earthquakes.
3. To Move or Not To Move to California
Now we can analyse different parts of world in a more detailed fashion. I wanted to drill down into California. Map dynamically resizes and focuses according to selected region. Below picture shows a very nice snapshot of dangerous parts of California. If you are willing to relocate to CA, you have to think about it twice, at least you can select somewhere far from ocean.
It can bee seen that big earthquakes in California are around a line that is paralel to ocean. I thought there may be a fault line around here and guess what, there is really one and named San Adreas Fault.
Image Source: http://geology.com
Lumira has already ESRI integration, however having possibility to create your own map extension using different services makes analyzing data very powerful.
Update: VizPacker and Extension Files
Important Note: Extension requires internet connection in order to load Google Maps.
Very interesting application of Lumira!
Thank you Jochen. It was interesting to discover a fault line with Lumira.
Nice one Mustafa. Well done, innovative and informative.
Thank you Antonie.
Interesting representation.
Thank you Mayank.
This rocks! Nice job!
Thank you Ty.
Great piece of work - My only concern about all of these is the amazing amount of examples where we have extended Lumira - sounds great but the other side of the coin is just that...
Look what you can't do with Lumira out the box... there is still SO MUCH that the product needs to do without 3rd parties extending the product. We (SAP) should be doing this ourselves in the out the box product.
I agree with you Daniel. Most of the extensions must be provided out of the box.
I believe, as Lumira developed, more extensions will be part of the product.
There's a balance between what should be in Lumira and what should be easily available to Lumira. We are doing two things to achieve this balance:
It seems that we will have a great marketplace.
Awesome Extension Mustafa! I used it in my blog:
http://scn.sap.com/community/lumira/blog/2015/02/04/how-i-gained-more-insight-into-my-data-using-an-sap-lumira-open-sourced-extension
Thank you Rohit.
with the new Lumira release 1.23 this extension has some problems.
it can show any maps..
is it only a problem for me?
I recognized that a couple of my extensions are not working on 1.23.
There are some changes on extension side of 1.23. I am trying to figure it out.
I will update the extension as soon as I fix it.
Hi, see this blog article for details: Lumira 1.23 VizPacker Update
I have a problem running the extension Lumira version 1.23. Adding the line "var bindings = {}" in the HTML does not help.
With the 1.23 release there seems to be many things that we perhaps should be told BEFORE the product auto-updates. Many extensions have simply stopped working... Now I have a new dialog when saving old LUMS files that they are now saved in a NEW FILE FORMAT...
that's just pre-school 101 - The Lumira.ini file get re-written every time and does not keep a copy of the old one - poor design, the file formats chance and we only find out AFTER the product installs, I have virtual machines that I do not want to update but can no longer send LUMS files to customer and prospects as they no longer open in a version that was only installed a month ago.
We keep telling our customers about the extendibility of Lumira (something my customers tell me is just not ideal as competitors have it in the product out the box) and to cap it all the things they then extend stop working.
It feels a little underdone - don't get me wrong I do love Lumira but please don't just 'do it' but 'do it right' please.
</RantOver>
Daniel
Hi Mustafa,
I managed to get the extension working (on my copy of Lumira 1.23).
After trying my own extensions with some headaches with 1.23 I found if I set the parameters I mention in my comment to Julien's Google Maps extension
SAP Lumira Extension: Google Maps
Also for both extensions I moved the data definition (fdata slice call in this case) before the require.js call and it was more stable for me changing the data.
So for your heatmap extension I adapted the code as follows. Not sure how this will show in this Jive editor but here it is......
mapDiv = container;
//load google maps api if it wasnt loaded before.
I'd be interested if changing the parameters and changing the code works for anyone else.
Cheers
Robert
Hi Robert,
I changed parameters as below, and code as you stated, however extension still doesnt work on my pc.
-Dhilo.cef.frame.debug=true
-Dhilo.cef.cache.enabled=false
I have another extension using requirejs, that is also not working.
I updated extension to work on Lumira 1.25. Now it is working on 1.25 without any problem on my pc. I hope it works for everybody.
You can download new version from above links.
Mustafa,
Great example but I cannot get mine working on 1.25 - I point to the ZIP, add it, restart... load the CSV, create visualisation with Mag, Long and Lat - ALL WHITE screen, any ideas?
Thanks and Regards
Daniel
Hi Daniel,
It may be because of corporate network. Can you try with a different network.
I'm at home so not on either of the SAP networks.
Can you send a direct link for the zip file so I can try again?
Thanks and Regards
Daniel
It gets stranger 🙁 I reinstalled Lumira 1.25 fresh, added the zip, went through all the usual steps... and opened the lums file - amazing the heatmap was there and visible and working... I do anything with Lumira and when I return to the visualisation it's white again.
Bizarre!
I tested Wifi vs Cable, 2 networks, with and without proxy, refresh, recreate, reinstall and now I have to get on with other stuff. Very strange
Thanks for advice
Regards
Daniel
Daniel,
I have updated extension. Could you please download from github and try again?
Mustafa,
Is the extension only for Desktop Lumira?
Or should it be possible to use opening a Lumira document through LaunchPad?
Works nicely for me on Desktop but blank white page displaying when opened through launchpad.
Regards,
Colm.
Hi Mustafa,
I am using the SAP Lumira designer 2.1 version. I have downloaded the heat map extension but every time I execute it, it displays the message " for development purpose only". Please find attached screenshot.
Upon extensive research, I found out that you need to insert a Google API key to access the google maps now. However, I inserted a Google API key in the render.js file at the line that says :
async!https://maps.googleapis.com/maps/api/js?key=AIzaSyDjQ11ciah7ftjU8eTUvPwf670sSt-bO8I&v=3&libraries=visualization
The maps still are showing the same message. PLease please help me out on this.