Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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

Hi,

Some questions here.

We are planning to buy licenses of GeoQlik to do a similar work as this extension. So...

1. (if one used both) How does it relate to GeoQlik?

2. Does this extension work on a web interface? I tried to use the web view and it does not show.

3. Does it work on a public internet server (Qlikview IAS - Information Access Server)?

4. Is there a way to work with hierarchies? I.e. drill-down/roll-up on different map levels (country, states, cities)?

5. Are there any restrictions for its use? Like it doesn't work with xyz server etc?

TIA,

R.

pablolabbe
Luminary Alumni
Luminary Alumni

Hi Cesar,

  What is your environment ? I tested under windows xp with ie8 and QV11 IR and it doesn´t show the regions, only the map.

Not applicable

Greate work!

I started to play with your extension, but unfortunately have a following error:

Cannot open file 'D:\Inst.dsk\Develop\QlikView\Extensions\openlayers\US States.txt' The system cannot find the file specified.

LOAD

    RIGHT(TRIM(@1:n), 2) as State,

    TRIM(@1:n) as Data

FROM

[US States.txt]

(fix, codepage is 1252)

cesaraccardi
Specialist
Specialist

Hi Pablo,

I see that this extension use only the <name> tag to associate the data with the map. When you have 2 areas with the same name like 2 cities in different provinces, you may want to use a second field for the association, I was asking how to do that?

Regards,

Cesar.

pablolabbe
Luminary Alumni
Luminary Alumni

Cesar,

I think this is quite simple. Just define the tag name considering the

concatenation of city and province name inside the kml file. Do the same in

your data model, and use this field (city+province) in the "region name"

property of the chart.

Em 19 de março de 2012 09:59, Cesar Accardi Jr <

qliktech@sgaur.hosted.jivesoftware.com> escreveu:

**

QlikCommunity <http://community.qlik.com/index.jspa>

Re: Open Source Geospatial Mapping Extension using KML files

created by Cesar Accardi Jr<http://community.qlik.com/people/cesaraccardi>in

Integration and Extensions - View the full discussion<http://community.qlik.com/message/202119#202119>

Not applicable

I have the same problem as Rob:

On initial open, the object is blank. If I zoom in I get some map, which I can slip around and continue to zoom. Big issue is that I never get any coloring.

As I'm under Windows XP, I can't upgrade to Internet Explorer 9.

Not applicable

Brian,

Great work, I am totaly new to QV, need to Know how to get the extension showing up in QV desktop personal edition. I have downloaded a KML of Chile, saved the file as ci.zip instead of ci.kmz. When I extract the ci.zip, it is read only. Do I have to edit the script in QV so as to look for the file......reading your notes I am using explorer 8. I have no programing knowledge, all I want is to get a map of chile to show in QV, then set it up to work like a heat map. Any help is much appreciated.

Not applicable

Hi Brian,

Thank you for the plugin.  I have the same issue as stingray when I try to reload.  Is the 'US States.txt' file the source of the 'Num' column, and not included in the zip?

Also, does line 62 of 'Script - Just Load.js' need to end, "us_states.xml" instead of "-.kml"  in order for it to work on IE8?  (I have tried both ways, but do not see the shapes.)

Thanks

cesaraccardi
Specialist
Specialist

Hi, I'm having a problem with the extension... When I change the color expression, the map color doesn't change and it erases the expression. I'm using QV11 SR1... is someone facing the same problem?

Regards,
Cesar

andy
Partner - Creator III
Partner - Creator III

Hi,

Great extension!

I need a map showing individual positions. I do like this map where you can grab and move. Anyone got a hint on how to modify this extension to show lat/lon points?

/Andy