Extracting Power Data from OpenStreetMap

From Enipedia
Jump to: navigation, search

Visualization of OpenStreetMap edits to the power grid over time, every frame represents a day.


[edit] Overview

Open Street Map has coverage for a large number of power plants. This data is very comprehensive, and the video to the right shows the growth of this data over time.

In OSM, "power generators" range from a large nuclear plant down to a single wind turbine or a private home with only a couple PV panels, but this still can be very useful especially for medium to small wind farms that are not always well covered elsewhere but can be easily spotted on recent imagery by OSM volunteers.

We also have a synchronized copy of the OpenStreetMap data, which is updated daily via the script below. The primary output is a giant osm file (208 MB zipped) of everything containing the tag "power". This can be filtered further to just show generators. With a bit more work, it is conceivably possible to make at least generator data available via a sparql endpoint. This work so far has been experimental in terms of learning how to synchronize and filter the data, and we haven't put that much effort yet into figuring out how to make the data easier to work with and integrate into our existing efforts.

We're open to ideas of how to further process, filter and present the data. Feel free to add ideas to this page or the discussion page. One improvement that would be easy to implement would be to use country poly files to create files containing all the power data for each country.

[edit] How?

[edit] Filtering from Planet.osm

OpenStreetMap makes their entire database available as a single Planet.osm file which you can download. Aside from downloading the planet file, you need to have three programs installed:

  • osmupdate - used to keep the planet file up to date with latest changes to the OSM database.
  • osmconvert - used to create extracts of all data within a polygon
  • osmfilter - used to filter out items based on their OpenStreetMap tags used (such as power=generator).

#update planet file
./osmupdate -v planet.o5m planet_new.o5m

#overwrite original file with new version
mv planet_new.o5m planet.o5m

#extract out all Europe data
./osmconvert planet.o5m -B=europe.poly -o=europe_new.o5m
mv europe_new.o5m europe.o5m

#keep the power layer up to date
./osmfilter planet.o5m --keep="power=* disused:power=generator generator:method=* generator:source=* generator:output:electricity=* generator:type=* generator:plant=*" > PlanetPower.osm

#extract everything with power=generator
./osmfilter PlanetPower.osm --keep="power=generator power=plant disused:power=generator generator:method=* generator:source=* generator:output:electricity=* generator:type=* generator:plant=*" > PlanetPowerGenerators.osm

#create files containing power=* and power=generator for Germany
#poly file is from http://downloads.cloudmade.com/europe/western_europe/germany/germany.poly
./osmconvert PlanetPower.osm -B=germany.poly -o=GermanyPower.osm
./osmconvert PlanetPowerGenerators.osm -B=germany.poly -o=GermanyPowerGenerators.osm

This script is run nightly and generates snapshots of the OSM data as shown below:

File Description
PlanetPower.osm (zipped) All OSM data tagged with power=*
PlanetPowerGenerators.osm (zipped) All OSM data tagged with power=generator

[edit] Using the OpenStreetMap Overpass API

This ScraperWiki code finds power generators (over 100,000 by now) by leveraging Overpass API.

The scraper has some interesting features such as generation of quadkeys and calculations of the centroids of polygons which are defined as ways. This is a bit beyond what we can do with osmconvert. This was actually part of an experiment:

  • quadkeys proved to be less useful than expected, especially in western Europe where you often straddle the Greenwich meridian.
  • centroids are quite handy for mapping without the overhead of an accurate polygon but computing them by hand during scraping is an unnecessary burden.

[edit] Other Approaches/Additional Documentation

[edit] Mobile Maps

  • OruxMaps has more information on how extracts of OSM data can be viewed on a mobile device.
  • Leaflet looks interesting as it runs in the browser and is cross-platform. The work on Enipedia Maps could probably be adapted to this format.

[edit] Rendering Rules

Personal tools