Pages Menu
TwitterRssFacebook
Categories Menu

Posted by on Oct 30, 2014 in GIS, Mapping | 9 comments

Tutorial: Using Wikimapia data in QGIS

Tutorial: Using Wikimapia data in QGIS

Initially posted by Léo Martine in French, this article has been kindly translated by Radyi Nurmametov, GIS Officer at the ICRC.

Introducing Wikimapia

Wikimapia is a participatory mapping online project launched in 2006 by two Russian computer scientists, based on satellite imagery from Google. The operation is relatively simple: it is to trace places compared to satellite images and then assign annotations to explain what it is: a park, a hospital, a school, a mountain, etc. In 2013, more than 20 million locations were identified throughout the world.

Since 2010, data from Wikimapia is available under Creative Commons License Attribution-ShareAlike (CC BY-SA). However, given that the premises are drawn from the Google imagery, data from Wikimapia can be considered as “derivative work” which may ask questions of reuse, especially for commercial use. More information about the license: http://en.wikipedia.org/wiki/WikiMapia#Licensing

Like OpenStreetMap, Wikimapia is supported by the work of volunteer contributors. The generated data can be extremely accurate, particularly for cities, and sometimes more than OpenStreetMap as shown in the following example:

WM1

Wikimapia data for the city of Al Qadarif in Sudan (10/07/2014)
(you have to imagine that every white polygon represents an identified place: a neighbourhood, a particular building, etc.)

WM2

Comparison : OpenStreetMap data for Al Qadarif in Sudan (10/07/2014)

To view the map Wikimapia data, please visit the site: http://wikimapia.org/

However, despite the huge volume of information that sometimes has nothing to envy to OpenStreetMap or other databases, Wikimapia suffers from some flaws that severely limit its potential:

  1. The data is often in the local language which requires a systematic translation.
  2. The attribute data system is much less extensive and effective than tags in OpenStreetMap.
  3. Export of data is much more complex than for OpenStreetMap, which is well equipped (Geofabrik, HOT Exports …). 

The purpose of this tutorial is to show you one way (among others) to export the data of Wikimapia, and create a layer for each type of object (e.g. a hospital layer, a layer of schools, etc.) to use in your QGIS project.

Downloading data through Wikimapia API

The API (Application Programming Interface) of Wikimapia is an interface that allows downloading the data contained in the Wikimapia database. This interface is accessible via the following link: http://wikimapia.org/api

Using the API is relatively complicated, we have simplified it for this tutorial into an Excel spreadsheet that can be downloaded here: Wikimapia_API_Builder

The Builder API is configured to download all items within a category contained in a specific area. You only have to change the values of orange cells:

WM3 

  • Key: in the orange cell in front of Key, enter your API key. If you do not have one, leave example (export will still work but you will not be able to download excessive amounts of data). To generate a key, go here: http://wikimapia.org/api?action=create_keyWM4
  • Category ID: in this cell, you must enter the ID of the category you want to download (e.g. 287 for hospitals). To know the ID of the different categories, click See category full list. 
  • Bbox: within 4 Bbox cells (Boundary Box), enter the limits of the area you want to export. To find the limits, you can use the OSM export tool: www.openstreetmap.org/export

Be careful not to choose too large of an area, it is only possible to download 100 objects at a time. If you want to cover a large area, divide it into multiple queries.

Once you have filled the settings, copy the link in blue (right click on cell A20 -> Copy) and paste it into the address bar of your browser, which will effectively start downloading a .kml file which contains all the objects that match your query.

To verify that your export went well, you can open the downloaded .kml file in Google Earth:

WM5

Example: Al Qadarif Schools (category ID: 203) in Wikimapia database

Converting the kml in .shp

KML created by API Wikimapia is of “multigeometry” type which means that for the same purpose, there is both a point (placemark) and a line (you can see it very clearly in the Google Earth screenshot above, each school has both a yellow and a white outline placemark).

The problem is that QGIS does not know how to open this type of kml, so we will have to convert it into two separate files, splitting lines from points.

For this we will use the KML2KML software, downloadable here: kml2kml.geoblogspot.com/

WM6

Click on Download KML2KML for GE Plugin v.6 and later

Follow the standard installation procedure, and once installed, open KML2KML.

  • WM7Click on the folder icon at the top left to open the KML file that was created and uploaded by the Wikimapia API.
  • Click the Export tab and choose “To Shapefile
  • Choose the path of shp output

KML2KML then creates 2 shapefiles, a polygon shapefile containing the centroids (marks) and another containing the polygon outline (lines).

You can open both shapefile in QGIS and thus add this additional source of data to your projects. 

 

Bonus: if you want to get polygons from the lines shapefile, use the Lines to Polygons tool:

WM8

 

 /!\  If you know a faster way to convert a shapefile to KML multigeometry (e.g. via a Python script), feel free to leave a comment ;)

9 Comments

  1. Hi!, I’m been trying to download a data but every time that I do it, the kml file it’s empty. I followed every step but nothing… if you can help me, I would be very grateful… geoproyectosccs@gmail.com

  2. Hi, i have da same problem – the kml file it’s empty.
    Can you help me please h.yankov@mail.bg

    • Hi itso,

      Can you please show me the query you are trying ?

      - Leo

  3. Great info here! The best I have found so far. I was able to generate the KML file for the desired area of interest. After reviewing it in both platforms, Google Pro and KML2KML, I can see it generated both the lines and the points (snice both geometries are vsisible). The issue here is that when I run the KML2KML tool, it only generates the points SHP but the line SHP comes with empty records. Any help will be really appreciated.

Trackbacks/Pingbacks

  1. weekly 224 – 28.10.–03.11.2014 | weekly – semanario – săptămânal – haftalık – 週刊 - […] Martine published a tutorial “Using Wikimapia data in QGIS”. (via […]
  2. QGIS Tutorial: Using Wikimapia data in QGIS | All Around GIS - […] QGIS Tutorial: Using Wikimapia data in QGIS […]
  3. Tutorial: Using Wikimapia data in QGIS – GeoNe.ws - […] http://blog.cartong.org/2014/10/30/tutorial-using-wikimapia-data-in-qgis/ […]

Post a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

A propos de l'auteur :

Léo Martine

Léo is working at CartONG since April 2014 as GIS officer. He's sharing on this blog a few tips and tricks he has discovered during his trainings, developments and missions.