Qlik Community

Ask a Question

QlikView Integrations

Discussion Board for collaboration on QlikView Integration.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Brian_Munz
Specialist
Specialist

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

Hi Brian,

I have explored the extension and it was great .

I had a shape and i converted it into KML format (using shp2kml 2.0)

Then I have put both kml and xml version of my polygon into the extention.

What are the next steps? what parameter do I need to change in .js file?

I was confused even after reading the guide.

Thanks

gandelr
Partner
Partner

Hi,I have the same problem of Cesar.

With QV11 SR1 When i change the color expression, the map color doesn't change and it erases the expression.

If erase DynProperties.qvpp i view the expression and i change the values but don't the textobject (es. KML file).

you could solve it?

gandelr
Partner
Partner

Not applicable

Brian,

I can't seem to figure out what I have done wrong.  Here is what I did (Windows XP, QlikView 11, IE 8):

1) Placed the extension file in "C:\Documents and Settings\username\Application Data\QlikTech\QlikView\Extensions\Objects" and installed it.

2) Created a new QlikView document.

2) I downloaded a KML file of US States.  It has the structure you specified (includes polygons).  I renamed the KML to XML and placed it in my QlikView project folder.

3) I turned on web view and placed your map.  I set the region name and KML FileName properties, saved and refreshed.  If I double the map object I see a map of the world.

4) Opened script and loaded the same US States XML that was used for the map source file so I could get a list of state names.

5) Placed listbox object on the screen and set it's source to the same field I set the map region name property to.

6) Saved everything and reloaded, of course.

7) When I click a name in the listbox, the map goes blank.

So, I suspect the map and the listbox aren't talking to one another but I don't know why. 

Thanks,

Chris

vbrkrishnan
Contributor
Contributor

Hi Brian

I have a KML file which provides detailed information on the German territories.  I am unable to interpret the KML file.  Is it possible to load the KML file as you have done in your example (using the US States).  I have attached the KML file for your reference here.

Thanks

Balaji

Not applicable

I love the extension and I'm able to view the U.S. google map.  After reading the user guide, I noticed I do not have the ability to import KML files under any of the extension properties.  I'm running QV10 SR1 with Internet Explorer 8.  I'll try updating to IE9, but don't think I can update to QV11.  What am I missing to load up other KML files?

Awesome stuff here!

US Google Aggregate Map.jpeg

Not applicable

Hi Rob,

I think the problem that you and a number of other members are having with changing the kml file is that you are not putting additional KML files in the place where the extension is installed. Extension packages are installed in the following file path on your PC:

C:\Users\your username\AppData\Local\QlikTech\QlikView\Extensions\Objects\openlayers

So even if you save the extension object on your deskptop, you still need to change the original extension.

If you change the kml file (or provide another kml file) in that location, the map should update accordingly, and not be blank.

Camile

Not applicable

Hi All,

Where you able to get the color expression issue resolved?

I am trying this map under IE 9 and QV11 and it simply won't take the color expression I want to use.

Is there a work around that you can suggest?

Thank you.

Pranita

gandelr
Partner
Partner

Hi Pranita, it's a bug og QV11 SR1 when create a dynamic Properies file.

To solve it you need to create a new Properties no dynamic.

1) In the definition.xml you have insert this row:

          <PropertiesPage Version="11" File="Properties.qvpp" />

2) rename DynProperties.qvpp in Properties.qvpp

3) open Properties.qvpp and change :

<div class='prop-grid_span-7 prop-grid_last' style='width:94%;' avq='prop_editexpression:.Chart.Expression.0.1.Definition'></div>

with

<div class='prop-grid_span-7 prop-grid_last' style='width:94%;' avq='prop_editexpression:.Chart.Expression.1.0.Definition'></div>

Not applicable

I have the same error as Rob Wunderlich i'm on QV11 SR1 with IE8