Skip to Content
Author's profile photo Mustafa Aydogdu

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.

/wp-content/uploads/2014/12/2014_12_04_114915_601115.png

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.

/wp-content/uploads/2014/12/2014_12_04_121301_601116.png


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.

/wp-content/uploads/2014/12/2014_12_04_150403_601117.png

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.

/wp-content/uploads/2014/12/2014_12_04_150520_601133.png

We end up with a heatmap, that shows most dangereous parts of World in terms of earthquakes.

/wp-content/uploads/2014/12/2014_12_04_143258_601134.png

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.

/wp-content/uploads/2014/12/2014_12_04_144225_601135.png

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.

/wp-content/uploads/2014/12/san_andreas_fault_map_380_601148.jpgImage 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.

Assigned Tags

      29 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jochen Schrader
      Jochen Schrader

      Very interesting application of Lumira!

      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      Thank you Jochen. It was interesting to discover a fault line with Lumira.

      Author's profile photo Antoine CHABERT
      Antoine CHABERT

      Nice one Mustafa. Well done, innovative and informative.

      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      Thank you Antonie.

      Author's profile photo Former Member
      Former Member

      Interesting representation.

      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      Thank you Mayank.

      Author's profile photo Ty Miller
      Ty Miller

      This rocks! Nice job!

      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      Thank you Ty.

      Author's profile photo Daniel Davis
      Daniel Davis

      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.

      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      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.

      Author's profile photo Ty Miller
      Ty Miller

      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:

      1. A marketplace where partner created extensions can be published and then directly downloaded to Lumira from within Lumira like you do with apps on your smart phone
      2. A global repository where optional SAP developed extensions are available for download from within Lumira. Example: DAE for BW. Most SAP BI customers don't have BW in their landscape and they don't need a driver for it so we shouldn't make it a default part of the product
      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      It seems that we will have a great marketplace.

      Author's profile photo Former Member
      Former Member
      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      Thank you Rohit.

      Author's profile photo Former Member
      Former Member

      with the new Lumira release 1.23 this extension has some problems.

      it can show any maps..

      is it only a problem for me?

      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      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.

      Author's profile photo Henry Kam
      Henry Kam

      Hi, see this blog article for details: Lumira 1.23 VizPacker Update

      Author's profile photo Former Member
      Former Member

      I have a problem running the extension Lumira version 1.23. Adding the line "var bindings = {}" in the HTML does not help.

      Author's profile photo Daniel Davis
      Daniel Davis

      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

      Author's profile photo Robert Russell
      Robert Russell

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

         

      var fdata = data.slice()  

         

      mapDiv = container;

            //load google maps api if it wasnt loaded before.

        //requirejs and async plugin is used in order to load google maps api asynchronously
        //you can check async plugin's developer blog for more information.
        //http://blog.millermedeiros.com/requirejs-2-0-delayed-module-evaluation-and-google-maps/
         require.config({
         paths: {
         async: '../sap/bi/bundles/sap/viz/ext/googlemapsheatmap/async' //If you are deploying extension for Lumira, aysn.js file must be somewhere  that lumira can access.
         //async: 'C:/LumiraFiles/async' //If you are working with vizPacker, locate your async.js file to location that vizpacker can access.
         }
         }); 
         require(['async!https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=visualization'],
         function ( ) {
         initializeHeatMap();
         });

      I'd be interested if changing the parameters and changing the code works for anyone else.

      Cheers

      Robert

      heatmap.PNG

      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      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.

      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      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.

      Author's profile photo Daniel Davis
      Daniel Davis

      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

      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      Hi Daniel,

      It may be because of corporate network. Can you try with a different network.

      Author's profile photo Daniel Davis
      Daniel Davis

      I'm at home so not on either of the SAP networks.

      /wp-content/uploads/2015/05/e2_699795.jpg

      Can you send a direct link for the zip file so I can try again?

      /wp-content/uploads/2015/05/error_699794.jpg

      Thanks and Regards

      Daniel

      Author's profile photo Daniel Davis
      Daniel Davis

      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

      Author's profile photo Mustafa Aydogdu
      Mustafa Aydogdu
      Blog Post Author

      Daniel,

      I have updated extension. Could you please download from github and try again?

      Author's profile photo Colm OMahony
      Colm OMahony

      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.

      Author's profile photo Anum Haroon
      Anum Haroon

      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.