Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
h2. *First a bit of background* I used to live in a place where the streets have no names which is weird or maybe just different depending on your location in the world. As well as "lost in translation" I was just simply lost most of the time.  As a result I found myself interested in geographic information systems (GIS software) as a way to understand more about the place I was living.  I like this video as it covers a "weird or just different" topic with an example based on street names. A TED talk by Mr Sivers, youtube link. Media Description: Link: http://www.youtube.com/v/1K5SycZjGhI After searching the web I tried the free open source based DVD (http://live.osgeo.org/en/index.html) from the Open Source Geospatial Foundation, that to quote "allows you to try a wide variety of open source geospatial software without installing anything".  Now during this timeline I attended several meetings where people were talking about SAP reports based on postcodes. So I had the idea to combine my interest in GIS software and SAP to see how I could present SAP data on a map. Especially as I also found a geographical database of postcodes available for download here at Geonames.org (http://download.geonames.org/export/zip/) What follows is based on the fact we did have a standalone SAP ERP (640) system and not any other reporting tool at the time. This will be changing for the company I work for. So the following SCN points example was used as a way to learn more about SAP and integrating software and is based on a NetWeaver 7 demo system. A link to the ABAP code used is at the end of the blog. h2. *Presentation of the data on a map* So let's start with an example based on SCN contributors worldwide. Now SCN points may or may not be your reason to be on SDN, and points are not everyone's cup of tea. However below is a map created with the SCN RSS feeds (http://www.sdn.sap.com/irj/scn/topcontributors)  in regards to contributors worldwide.  The report is based on points per contributor for 2011 by country in an thematic map. Now I guess you can guess which countries dominate the points, so I chose (because it's my blog 🙂 points per contributor and not put any minimum on the number of contributors. So I say hello and thank you to SCN members in Slovenia and Panama for your contributions. More on this later as it is created in ABAP with the open source GIS software Geoserver providing the KML to process.   While checking the results I did notice an impressive performance in my chosen category of points per contributor from Canada. So..... h3. *The SCN point kings at the SAP Vancouver office.* OK, I do not have detailed information at hand to fully back up this claim however, based on the RSS feeds I "felt the force" and took an assumption Business Objects was the key to the Canada performance. So I ran the report with and with out Business Objects/Crystal Reports. The results, again I am limited in how much I can show in 500x700  image. A couple of clicks later on the RSS stream of the top contributors and the SAP Vancouver office is the place for SCN points. * * h3. {code:html}Example KML in the Google Earth API can be found here{code} The link will only work with Windows or a Mac as the Google Earth API is only compatible with those platforms h2. *Credit where its due* When I first ran the ABAP report I chose total points and a small range of colours and one country stood out in India. Now I am sure there are lots of teams in many office buildings where SCN points are generated at a rate that beats the rest of the world. However I do not have the detailed data to identify any. However the SCN point champions are from India. And I probably didn't need to run any report to figure that one out. h2. *Other* *Examples * The main inspiration for all the ideas for KML came from the Thematic Mapping Engine website. Most if not all the ideas in the following ABAP KML report are based on the information shared at this website. *Thematic Mapping Engine (http://thematicmapping.org/engine/)* Nowadays it appears that most data comes with a map and a couple of examples that I like are here, {code:html}superbowl & beer{code} my interest was beer  as the other aspect of the presentation  reminds me of telling my son there is a real game of football and its not soccer :). {code:html}how to cross Dublin without passing pub{code}.  I am not sure if I could cross any city in the world without passing an Irish pub. I do occasionally check out my youtube video for[ Barcodes in SAP with the Barcode writer in Pure Postscript | http://www.youtube.com/watch?v=Z1abgzb2ppM&rel=0] from one of my previous blogs (Barcodes in SAP with the Barcode Writer in Pure Postscript.). It makes me realise the world wide nature of SAP and YouTube (* I presume no one would watch an SAP barcode video unless they really wanted to). The youtube stats use the google charts for their maps. . The URL to generate the chart is below. I won't consider the option to front end this process with ABAP! - I'll stick with KML http://chart.apis.google.com/chart?cht=t&chs=361x180&chd=s:BEAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAHAAAAACA... AAAAAAAACAABACAAAAAAAAABAAAABABAAAAAAAAACAAgAAAAAAAAABAA AAAAAAAAAuAAAAABAAAAAAAAAAA9AAAAAAACAAAEAADAAANAAAEEAAAAA AAFAAAAEFFLAABADAAAAAAAAAACAAAAAAAAAAAAACDAAAAHAAAAAAAAAA FAAAAAAAAAFCAAAAAAAAAAAABAAJAAHAAAADAAAAAEA&chco=f9f9f9,e2eecf ,3eb011,008800&chls=1,0,0&chld=HUILVUMASMAWDDWFSJCZNUKEVCZWBG KPUAKGFIMMADSIASANBYPHMKPKBEDZMDTVMLESKZJEGTSYMOCOPAKNJPHMGR NPSZMGBWBILAATTCNIPTLCROSRFXBSBLAZPYMQTKGLAUDJISLVPRSKCVPEKHZ MVIPNIRKMYULKNTCHAFTLDEPMVESNGIGASCTTUMHREECFFJHTBVCCGDRSBUER GNLIUSCRZRDMSHNCZAGEJMAXYTCYSUFOYEBHGFTGINMWPSPFCDSODOGUQA MCBMCUMYMERWTWMUPWAGKRGHTPSBTHSGFMIQETAMTOTZCIFRNAVAMSCKC LBRSAHKNRGQNZAQRUGYBDCMUGGGLRAIGMLYTJVNSVNOYDEHMVBZNEBFMZRE CNLBMPARCAJOVGBAMFTROMSTLSTFBNIEMHCXEGKYMXIMGSTNNGLTBTIOGPTD NLAEALPGCSMRGWMNBOAOHNSDCGUZSETMKIGBKWBJITLUBBECFKIDDKNFSLMT UYPLWS&chxt=x&chxl=0:|world&chf=bg,s,EAF7FE !http://chart.apis.google.com/chart?cht=t&chs=361x180&chd=s:BEAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAHAAAAACA... tube test will it work|width=361|src=http://chart.apis.google.com/chart?cht=t&chs=361x180&chd=s:BEAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAHAAAAACA...! h2. *KML * So now with some software and SAP data I needed ideas on how to present the data in SAP on a map. Attempting to keep it free and open source based as I was using open source software.  (The actual presentation ends up with Google Earth or ESRI ArcGis explorer (http://www.esri.com/software/arcgis/explorer/index.html) so check out the terms of use of those). Back searching the web again and I found a way to present data with KML at the following site Thematic Mapping Engine (http://thematicmapping.org/engine/). At this point I felt sure there would be some resource on SDN with KML, however I could not find any relevant data/information to use.  I do consider myself pretty good at finding things on the internet, however on this subject (SAP and KML) nothing that matched what I wanted to do. As I will be moving back to place where the streets have names, I will post my attempts at thematic mapping as I certainly enjoyed the process and learnt something along the way.  * Also a very recent tweet in regards to the {code:html}SAP/ Google partnership{code} focusing on Google maps, made me mark it as a favourite tweet. Just as I was about to delete my blog 🙂 I realised the SAP Google partnership is for the business analytics side only so I probably will not get to see it soon, as we do not have that software. Two basic approaches with KML that I covered are detailed in the creative commons document on the thematic mapping website. h3. *Choropleth maps* During the research into choropleth maps I did come across the Esri shapefiles (http://en.wikipedia.org/wiki/Shapefile) which are part of presenting SAP BI data on a map (http://help.sap.com/saphelp_nw70/helpdata/en/3b/7c92321bed374ee0000800091c1b0e/content.htm). However I did not use these files as I found the Natural Earth datasets which are public domain (my examples are based on version 1.3). These shapefiles can be used for any purpose and have polygon shapefiles ideal for choropleth maps.  [Natural Earth Dataset. | http://www.naturalearthdata.com/]  !http://www.naturalearthdata.com/wp-content/uploads/2009/08/NEV-Logo-color_sm.png|height=72|alt=Natur... Earth Data|width=216|src=http://www.naturalearthdata.com/wp-content/uploads/2009/08/NEV-Logo-color_sm.png! h3. Scalable icons. Now you can put the Google Earth api into SAPGUI for windows and you will have to pay Google for that api. Windows SAPGUI is not really the right tool for the job, however at the time I was trying to present the idea it appeared to be the best option.  As even BSP's at the time were end of life and not even the icf nodes were active on our 640 based system. Google Earth API allows a string ({code:html}parse kml{code}) to be used to provide the KML. Now modifying my favourite ABAP demo program (which I haveused elsewhere (Generating QR codes with a Zebra Crossing in the Java stack)) SAPHTML_DEMO1 with the required javascript then the following demo shows scalable icons and using different icons to display customers by type. The geocoding is done via the postcode only service offered by geonames (http://www.geonames.org/)  Media Description: Link: http://www.youtube.com/v/8YHskQYb384 h2. *Producing the source Choropleth (http://en.wikipedia.org/wiki/Choropleth_map) KML* As part of the OSgeo livedvd (mentioned earlier) a java program called Geoserver (http://geoserver.org/display/GEOS/Welcome) can output KML from shapefiles.  There are a number of ways to get KML from a shapefile but I do like the flexibility of Geoserver and its ability to modify the data with configuration settings/flat files. Another aspect of Geoserver is the great documentation and tutorials available online. The first option is to load the Natural Earth shapefiles into Geoserver and there is a tutorial on this here (http://live.osgeo.org/en/quickstart/geoserver_quickstart.html). Then taking the KML placemark tutorial (http://docs.geoserver.org/stable/en/user/googleearth/tutorials/kmlplacemark/index.html) as an example I placed the ISO country codes I required into a XML markup to be used in the KML.Another tweet that I took notice of was the fact that the entire {code:html}Natural Earth Dataset is available in Google Fusion Tables{code}. I did comment on the Mr Sandvik's blog and he did say the data is available to use, although Google fusion tables terms of use are mentioned. As far as I can tell the service maybe free to use, however the terms of use link is here (http://code.google.com/apis/fusiontables/terms.html) for the api. * * h2. *Into the clouds for free*  [Amazon micro instances | http://aws.amazon.com/free/] are available for free for new customers. I always thought about using an Amazon instance for an SAP system but never wanted to pay for the privilege as I had vmware player and virtualboxed SAP systems.  You can't get a SAP system onto a micro instance however you can install Geoserver and many other web services. Another tweet lead me to the clouds and I am hooked, just need now to figure out how to make it pay after the free period expires. Along similar lines of being free and presenting data I was immediately drawn to the blog about the [free download of "SAP Crystal Presentation Design" last year | SAP Crystal Presentation Design ( Xcelsius Present) Free Giveaway!]. The offer has now ended but linked for reference. So checking the program for all things related to maps and Japan, I found the following map for the regions of Japan. So inspired by the presentation from the program (and the Google charts) and my new found knowledge of Geoserver I knew it was possible to generate images and style the map with custom controls via a URL. So here is a PNG image from my cloud based Geoserver where the colours are being defined by the URL call. If you right click on the image you can check out the URL, it's not as complicated as the Google Chart Map mentioned earlier, as the URL only sets the colour of the region. However a URL could be constructed in ABAP to set the colours depending on requirements. Also Geoserver allows other images to be part of the Web Map Service (WMS) call, follow the link to see the details (http://docs.geoserver.org/stable/en/user/advanced/wmsdecoration.html). I have placed a QRcode in the image below but it could be a legend/title to cover the details of the map. (Here is the {code:html}SCN points example shapefile in openlayers{code} where the legend is created by Geoserver) !http://barcode.dyndns-web.com/geoserver/wms/reflect?layers=cite:japanregions&env=R1%3AFF0000%3BR2%3A... in the cloud|width=512|src=http://barcode.dyndns-web.com/geoserver/wms/reflect?layers=cite:japanregions&env=R1%3AFF0000%3BR2%3A...! h2. *Painting By Numbers* Usually the only colour coordination I am interested in is matching my tie to my shirt, and I am not that great at picking out colour combinations. So online tools for map making I came across are. [Colorbrewer | http://colorbrewer2.org/] is an online tool for map colours Also thanks again to the Thematic Mapping Engine (http://blog.thematicmapping.org/) document in regards to KML and the fact that the RGB colours are actually in BGR order. This allowed me to use the free Google chart tools to produce some titles and legends with some adjustments.

h2. *Scale & Legends and *Normalising Your Data* * KML is not really setup for producing scales and legends. However once again thanks to the thematic mapping engine I used the image overlay to get Google charts onto the map. Also Geoserver has some KML legend graphics (http://docs.geoserver.org/2.1.0/user/googleearth/features/kmllegends.html) that can be used for the shapefiles with the static data. Now presenting data on a map can have some issues which I came across during the process of putting this demo together. Normalising and presenting data is covered[ here | http://www.gsd.harvard.edu/gis/manual/normalize/] and normalising data is mentioned in the wikepedia entry for choropleth maps (http://en.wikipedia.org/wiki/Choropleth_map). With the SCN points demo I just went for the data that at least gave me some colours on the map.

h2. *Is French Guiana in Europe and Hello to South Sudan* As master data plays an important role in identifying your data on a map in SAP. I do have to point out some areas of the natural earth dataset that I used. Now French Guiana has the ISO code for France which does put it in Europe in my method of selection (there are other Natural Earth datasets with dependancy ISO codes in the shapefile) . Also South Sudan already exists in the dataset but the ISO code is -99. So I have made other comments in the ABAP source code (see the end of the blog) on other countries where the selection is not a straight forward match. Now there is the possiblility of directly editing the shapefiles to correct/set any data as desired. I did {code:html}this for Japan here{code}, where I added the ISO codes for the prefectures. h2. Closer to Home My original intention in regards to this blog was covering the examples I was doing for Japan. The blog has been in draft for a while. Back in February I was about to start the process and blog about thematic maps which related to Japan. Then on March 11th the earthquake and tsunami struck and while I was not directly affected by these events, my life did change direction as a result. My thoughts are with those still coping with the aftermath and I remain deeply impressed by the way the people coped and are {code:html}rebuilding the nation{code}. h2. Free the Postcode Now I have briefly mentioned master data earlier, as good quality master data will make it easier to produce thematic/choropleth maps. My original method linked the geonames (http://download.geonames.org/export/dump/) Japan postcode data to the prefectures from the Natural Earth dataset. Also using the geonames data for scalable icons as detailed above. Although there is a big hole in the geonames data for Japan (http://forum.geonames.org/gforum/posts/list/1695.page). While in Japan I did come across the "free the postcode" (http://www.freepostcodes.org.uk/) website in relation to the data for the UK. Now the data for Great Britain has been freed (https://www.ordnancesurvey.co.uk/opendatadownload/products.html). So I downloaded some of the data from the Ordnance Survey website and also from US Census website (http://www.census.gov/geo/www/tiger/tgrshp2010/tgrshp2010.html). Using the Geonames postcode data for the US and link this to the US Tiger shapefiles for Rhode Island as an example . The Common Query Language (http://docs.geoserver.org/stable/en/user/tutorials/cql/cql_tutorial.html) (and ECQL) can be used with Geoserver to query the attributes of the dataset. So after using QGIS (http://www.qgis.org/)  to load the Geonames dataset for Rhode Island into a shapefile I was then able to use the data in Geoserver. This is purely for demonstration purposes of linking postcodes to regions. {code:html}http://barcode.dyndns-web.com/geoserver/wms/kml?layers=cite:geonamesri&CQL_FILTER=postalcode=02896&m...{code}Take the County Providence and using the Tiger Shapefile then follow the link to see the {code:html}polygon for Providence in Google Maps.{code} using my Geoserver in the cloud. Another example this time based on the Geonames data for Great Britain matching the Ordnance Survey data. Using the geonames webservice and the post code B91 3TF -[ link | http://api.geonames.org/postalCodeSearch?postalcode=B91 3TF&maxRows=10&username=demo&style=full] Links nicely to the the ordnance shapefile as shown again in{code:html} Google maps for the Solihull district{code}.  Now onto the actual SCN thematic map code which hopefully shows you how you could create a map with a whole bunch of county or region polygons. h2. Thematic* Map ABAP code with simpl**e transformations* h2. *Back to the Future.* With the arrival of Gateway and the way it opens up SAP data it appears many old blogs of yesteryear have renewed relevance today. The way I started with reading data from an RSS web feed is here in Brian McKellar's 2004 blog (BSP Programming: RSS = HttpClient + XML + XSLT) which refers to a DJ Adams blog from 2003. I adapted the code to use (not so) simple transformations after further reading of the SAP help. Also the forums helped out for some of the code challenges I faced, to many threads to mention them all, but one name Rich Heilman did stand out in many of the answers I chose to use. Now what I have done with the answers and the code is my adaption and any issues or mistakes are obviously mine. And I do point out it is a demo in a demo SAP system and maybe you can help me out. I would like to hear any suggestions on improving the code.

h3. The ABAP source/nugget can be found here. (http://dl.dropbox.com/u/24196653/SCNblog.zip) The selection screen looks like this. There is a README file in the zip file that covers some of the selection options. h2.   h2. And finally Geoserver can also generate KML with a time series based on static temporal data in a shapefile. Check the documentation here (http://docs.geoserver.org/stable/en/user/googleearth/tutorials/time/time.html). So based on SCN Points worldwide from 2004 to 2010 I did follow the document and created a time series for the total SCN points from the RSS feeds. The kml can be found in the ABAP/Nugget zip file link above, also included is the base spreadsheet I used with QGIS and Geoserver to create the static data in the shapefile. The KML time series looks like this, note the time bar across the top of the screenshot.
7 Comments