Analysing OSM data for planning purposes – not so easy

It’s just so easy to add new features and edit those existing on openstreetmap with it’s impressive number of tools including iD and JOSM. Little know though is the vast array of little tools which have been created for extracting and working with that wonderful open geo data.

This last week has been eye opening for me once again, I have been working with a small group of assistant physical planners on how we get hold of an extract of OSM for Lesotho, how do we load this into our chosen GIS tool (postGIS) and finally what sorts of exploratory analysis is possible.

Thanks to the lovely folks at geofabrik we have a daily Lesotho OSM extract. It takes the form of an osm.pbf file.

It was a week of new experiences for all the APPs, they had for one never touched the command line before. Something you really need to know if you want to use osm2pgsql to get your pbf file into your database.

Each day they will download the lesotho-latest.osm.pbf file from geofabrik and open up the command line to run the following:

osm2pgsql -c -d lesotho0902 -U colinbroderick -H localhost --hstore  --slim --number-processes 10 --extra-attributes -C 10000 1602-lesotho-latest.osm.pbf

This creates at least 3 database tables one for each of the geometry types present in OSM:

  • planet_osm_point
  • planet_osm_line
  • planet_osm_polygon

Screen Shot 2016-02-18 at 10.48.29

We are now able to easily perform some high level spatial analysis using the data in each of these tables.

Have you used the command line before? It’s not so easy to get started with right? After a rocky start all our guys are flying along with it now, it’s no longer scary! They are updating the database everyday!


We chose to take on the challenge of training the APP’s to use PostGIS for their analysis as it we felt it was the most performant for them to work between periods of online connectivity.

Watch out for some details of the spatial analysis that will be falling out of these five newly trained spatial analysts!

Find out more on how you can get your own Lesotho database on our analysis wiki

MapLesotho Top10 users

It’s time to finally reveal the top 10 #MapLesotho users.

We have analysed the changesets from openstreetmap to compile these numbers.

The figures below are from 5th Feb 2015 to 21st June 2015.

We can reveal that user mdk with over 200,000 edits to the map in support of  #MapLesotho.



Keep up the good work folks!

#MapLesotho First Steps towards Evidence based planning

#MapLesotho has now reached a point where we are now drawing down the data and we are now at a stage where important conclusions can be drawn about the physical layout of the country.

Through MapLesotho every water body in the country is being mapped, with approximately 80% complete to date. Even in this incomplete state we are able to download the data and import into a PostGIS enabled database. The Lesotho data is downloaded from geofrabik ( who provide daily snapshots of all the data.

By taking one of the well mapped features streams and rivers, and analysing this in tandem with buildings has allowed us to see the proximity of buildings to waterbodies.

As further localised extract was taken from Leribe in order to assertion the number of buildings and their respective which are potentially at risk from flooding due to proximity watercourses.

It was found that of the buildings mapped in Leribe approximately 38% were at risk of flooding. When adding features to OSM we use satellite imagery which can be up to 2 years old. When further examining the building type, of those tagged as under construction it was found that over 50% of those were at risk of flooding.


80% Complete – Nothing like a target of 90% for the New Year

In case you missed it last night a number of #MapLesotho mappers pushed the rural task over 80% complete and 14% validated. We are almost there!

In the spirit of end of year targets, don’t we all love those? We want to break the 90% barrier before the end of 2014! Can you help us? 5 Days. 2% per day. Can we do it!? Spread the word!

Join in!

So please steal some time from your employer / study / family this last week of the year and push#MapLesotho over the 90% mark for the new year.

80% Complete

Mark Your Diary!

There will be a Mapathon taking place on the 16th of January. More details to follow in the coming days.


#MapLesotho – The benefits to Physical Planners

Lineo Mothae and Ithabeleng ‘Moleli are Assistant Physical Planners assigned to the Districts of Maseru and Mafeteng respectively.

Lesotho 025

Lineo Mothae – APP – Maseru District Council


Ithabeleng ‘Moleli – APP – Mafeteng District Council

Last February was the first time our partners from Fingal County Council in Ireland introduced OSM as a tool for spatial planners. We can see a direct benefit of the spatial data being added by #MapLesotho each and every day.


Ithabeleng ‘Moleli talks about the usefulness of OSM:

OSM is used to plot information on the map for streets, sewer lines property boundaries electric, ambulance and fire extinguishers utility lines, parking spaces. Having data of this type makes it possible to carryout diverse tasks in planning; be it extension of road networks etc. OSM helps to map the situation as it is on the ground at the same time updating of maps is easier.

Lineo Mothae details her experience of using OSM for planning:

My first hand experience with using OSM was in February.As a planner in order to make a village layout, a number of factors are considered. One being the direction of growth the development is taking. Using osm makes it easier to decide where plans for for new development could be made as data on osm is accessible and up to date since it can be updated from time to time to incorporate new developments.

Ha’Foso – Our first area mapped in February

OSM to me is an essential planning tool.

Mazenod for example, not much development was depicted of the map but now after Osm there is so much change. I have also seen it is possible to map any area, no local knowledge is required except here and there for description of land uses.

Compared to other options in the past openstreetmap is free and has a more frequent update cycle (always being updated). Planners in other countries are relying on it, and we think we should start to do the same.

Would you like to help us finish mapping Lesotho? We are currently at 76% complete. Join in today and map a tile from our mapping task. All you need is a web browser and some time!

#MapLesotho Edits January – 11th October

We’ve come along way with #MapLesotho so far this year, where recently we achieved 52% of our rural mapping task complete.

Now maybe is a time to look back at the massive amount of edits made by everyone involved.Over 80 individual mappers have contributed to the map so far. Thank you! There are now over 1.7 million nodes in Lesotho, where there were only 500,000 in July 2014.

Below is an animation showing the diff’s (the changes made to the OSM database) from January to 11th October 2014.

Spread the word we’re only counting down to completing the first pass of the Open Street Map basemap for Lesotho now, 48% to go! Give us a hand by taking a tile on our HOT OSM Rural Task.