Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Brian_Munz
Employee
Employee

Open Source Geospatial Mapping Extension using KML files

A little while back, I posted a few mapping extensions that read in various kinds of data to allow mapping of regions and data on Google Maps.  One major problem with those is that Google is now charging money for useof their mapping product, so in order to use this extension on any grand scale,they'd need to purchase licensing.

So, in response to this, I've built an extension which uses all open source (free) products to provide some similar mapping capabilities(and then some).  The tool which provides the scrolling and "slippy" map features is called OpenLayers which reads in map imagery from OpenStreetMap. What I've done this time, however, is built the extension to read in KML files for the regions.  KML is a format that is very common in the industry (Google Earth uses and creates the files) ,and there are many tools out there to convert other formats (like shape files) into the KML format.

So, for example, I went and found a KML file for the US 50 states and put it into this new extension, and was able to create a map similar to my other US Map extension:

map_shot.png

New Features


Above and beyond the normal features of the extensions I created for Google, this extension provides a few new features:

  • No more setting the zoom and center point - In the other extensions, you had to set the default center point of the map as well as how far in it should be zoomed when it loads.  In order to make the map more user friendly and intuitive, this extension automatically determines the center point of all of the regions and sets the window to show the whole map.  This way, also, if you click on a region, the map window will only show the selected region:
    one_state.png
  • Select Box -With this extension, if you hold down the shift key and drag an area with your mouse, a select box will appear, allowing you to select many regions at once:
    select_box.png
    Once the selection is made, the window will adjust itself to only show that region:chosen.png
  • Loading KML files - Loading KML files into the extension eliminates a lot of the manual work that was need for the other extensions.  This way, as long as the KML names and QlikView dimension match up, KML files containing any kinds of regions can be used.  So, for example, if a company has custom regions representing different sales regions, etc. in a KML file, it would be very easy to plug it into this extension.

  • It's free- It uses open source technology so nobody will have to worry about licensing or being chased down by Google.

I've attached the extension as well as a QVW and quick guide.  In the extension is a sample KML file called us_states.kml that can be used with the example QVW.

Please let me know if you have any questions.  Hopefully this is useful to people.

UPDATE

Due to some issues with versions of Internet Explorer prior to 9 and how it handles different data formats, it is now necessary to change the KML file into an XML file prior to loading it into the extension.  So, for example, if you have a KML named "counties.kml" you need to change the file extension so it becomes "counties.xml".  Hopefully I'll eventually get time so this last step can be avoided, but for now it's necessary in order for the extension to work in IE8.

I've updated the attatchments on this post to use an XML file, so the examples should now work.

176 Replies
Not applicable

Hello Brian

I download the extension for open source kml mapping example for QV however having problems getting it to work.

I have an open QV lience and not working via the access point (via explorer).

To start off I upload polygons to google earth to get the kml file, we have 21,000 polygons (South African) which I did try however map did not work so thought it would be a size issue. Anyways I am now working with a small (only 14 suburbs).

I did copy the kml and changed the extension to xml (although I do have Explorer 9).

I have also load some interal company information as well so that the map shows this data. The fields in the kml/xml file are exaclty the same as the company data.See below image.

1_FieldsUsed.jpg

This is what the extension objection looks like. I used the same expression in the QV example for the colour expression however just changed any reference of num to connections which is my numeric value that it needs to shade by. Also changed the range to match my data range as well.

2_ExtensionObject.jpg

As for the KML file...I put the name of the file in here, however was not sure how QV knows how to fetch it as it is not loaded in the QV script...also but the full path of where it is however with way the map seems to work in terms of sending the map to excel and I get the kml areas I created. See below. However the map is blank! As per image above. Not sure why or what I am doing wrong. Is there an email I can contact on and I can send the files for you to look at?3_MapObjectExcelOutput.jpg

Not applicable

Hi,

We've tryed in 64 bits (Win7, Qlikview 11.20.11922.0 SR2 64-bit Edition (x64)) and 32 bits (Win7, Qlikview 11.20.11922.0 SR2) systems, it worked just on 32 bits.

Not applicable

Hi Brian,

Are you able to provide the file;

[US States.txt]  ??

Am trying to load a different country but at district level. Would like to see how the original text file looked like

Regards

Fangwen

victa001
Partner - Contributor III
Partner - Contributor III

Hello Brian,

the extension is working fine and we've added our own kml files. Our question is if it is possible/and how to add to add an extra overlay (show in this example). We would like to view the map of the Netherlands and underneath that al the cities. How can we manage that?!

Thank you!

Victa

Carlo Vruwink
bjgrijpstra
Contributor II
Contributor II

Hey there,

I am at a total loss here. I'm totally confused on how to use this extension (or any extension for that matter, since I am new to QV). I want to plot some points on a map of the Netherlands. Could you maybe point me in the right direction?

Thanks in advance!

victa001
Partner - Contributor III
Partner - Contributor III

The thing we are doing is drawing a path (coordinates) with Google Earth and saving it as KML. The KML containts al the coordinates of the drawing (every mouse-click is an coordinate). These coordinates can be put in the kml/xml file which you load in your extensions. Be sure to name the drawing in the kml/xml the same as the name in your database. You can draw anything you want, the only thing it is static. Hopefully this helps a little?

Carlo Vruwink
bjgrijpstra
Contributor II
Contributor II

Thanks for you reply, my input, however, is slightly different. I'm using a large data set with placenames. I've got QV retrieving the  latitudes and longitudes corresponding to the cities. But i'm not able to make a map chart on which to plot the lats and longs. Maybe you could take a quick look at my qwv and excel file:

http://www.mijnbestand.nl/Bestand-434H7SDDYO7E.rar

thyagoguimaraes
Contributor
Contributor

Hello, I installed the extension available and open the sample file is displayed blank map.

I use the QV 11 SR2 and Windows 8.

Could you help me figure out what is wrong?

thank you

openlayers.jpg

Julie_Main
Employee
Employee

Lol!  Brian, I've just been sent your example as an image by a customer!  However looking closer at it .. how come your map looks more county based as opposed to mine which is based on postcodes .. have you aggregated at a regional level?  Or are you using a different kml for counties?  Cheers, Julie

Not applicable

Brian,

I am encountering the issue a couple of others were regarding the map not displaying the xml file correctly highlighting the US states. I am currently on QV 11.011440.0 SR2, and I am also running IE8. Do you know of any workaround with getting this data to be able to display?

Thank you,

Andrew