Sunday, January 9, 2011

SAP: Thematic mapping with KML

I have blogged about visualising wikipedia data with Tableau before

Here I will keep the same source data but  process  it with SAP ABAP. The ABAP code will create a KML file for viewing in google earth or arcgis explorer or any other kml compatible program. Hopefully you can make the connection to presenting business data in the same way. e.g. its all in ABAP and therefore you could use the data in SAP, I am not in the position to show even the test data I used to demonstrate this at work.

So I will cover the thematic map with the population of Japan but this time in a choropleth map.  In later blogs I will cover how to produce a choropleth map based on first level admin breakdown of countries, basically later blogs will explain this more! (for now, you can see this 1st level admin in google earth by expanding borders and labels and 1st level admin is shown).

Wikipedia Data

Now to get the wikipedia data we will use sparql as before (in the Tableau blog mentioned at the start) but this time add  iso code related lines.


The ABAP code
I am not an ABAP developer but I have been scripting for long enough to try it out and get this demo working. So its not really about the ABAP code but the idea of presenting data on a map I want to cover.

The - not so - Simple Transformation

This is the key to the choropleth map its based on my kml breakdown of Japan by prefectures in KML ( the 1st level admin borders I mentioned earlier). Now in SAP regions for Japan match the ISO codes for Japan prefectures.

So the simple transformation for Japan is based on changing the colour of the polygon.

The ABAP code works out a range of colours based on the data and then runs the simple transformation changing the colours of the 47 prefectures. As per the snippet of code shown here.


<PolyStyle>

  <color><tt:value ref="cjp34"/></color>

  <outline>1</outline>

</PolyStyle>



The Video,
This is just a demo video at the moment and I will update this later. The video shows data being processed by SAP to generate the polygons and the colour based on a scale. In the video I change Kanagawa and Tokyo prefectures to change the colours of the polygons. This is a first blog in a series and I will cover more in later posts.

**Update 13th March, I have taken down the demo video due to the current situation in Japan.
**Update 19th May, new video with the scalable icons in KML, the polygon video will return later.
**A way to generate your own KML for any country based on the Natural Earth Dataset here


.


Background as to why I ended up doing the above.

What "themematic mapping in SAP with KML", I didnt think I was going to be at this point as I have always been in the SAP Basis side of things and never written an business based report before. During several meetings people were talking about reports based on postcodes, I took this idea of postcodes and started my Google Driven Development and trying to Keep It Simple Stupid at all times. However at the end there was no take up of the idea, we have a complete BI system about to arrive and a commercial mapping service. I am still working on the idea though as it is a great way to show data.

The original ideas for KML presentation came from the Thematic Mapping Engine.

Living in Japan was also the inspiration behind my idea, if you have ever been to Japan then you may know the streets have no names which is weird (or maybe different). So as per QR code adventures into SAP, you can thank Japan for inspiring me to write this blog :) I found myself interested in the whole mapping side of things as a way to try and understand more about Japan, I have not finished my mapping adventure, and there is more blogs to come.

I like this video as it covers the "weird or just different" aspect with Japan street names. (its a TED talk by Mr Sivers, youtube allows me to get the embed code so I am using it).

No comments:

Post a Comment

Google +