1
1

I want to export powerline location information for Oman that I see in OpenStreetMap as shapefiles. How do I do that. Those powerlines do not seem to be in the gcc-latest-free.shp files available at Geofabrik downloads.

asked 21 Nov '16, 21:18

McGradyM's gravatar image

McGradyM
17113
accept rate: 0%


3 Answers:
4

A simple way to do this is using Overpass Turbo. For example, this query was generated using the Assistant and typing "power=tower in Oman". You can easily adapt the query to get the lines themselves. Just check the wiki to see what exactly you need. You can then export the data to GeoJSON, which you can drag and drop to QGIS. If you really want to use shapefiles, you can simply save as shapefile in QGIS. There is built in support in QGIS (and also the QuickOSM plugin) to do the same without going over a website.

Of course, if you want to do something more advanced, Jochen's answer is more interesting.

permanent link

answered 22 Nov '16, 08:56

joost%20schouppe's gravatar image

joost schouppe
3.3k214684
accept rate: 12%

OK. Thanks. Maybe I am missing something obvious and easy. The map key in OSM says that the power lines they show are "cable cars or chair lifts", so maybe the available shape files are named as such. Anyway, between the two answers, I've got a number of ways forward. Thanks

(22 Nov '16, 10:34) McGradyM
1

Yeah, our map key is far from perfect. Ski lifts actually do look like that, it's just that power lines are missing in the map key. There is way more visualized on the map than could fit in a normal sized map key. If you want to know what kind of thing you see on the map, you can try clicking on it with the question mark button (below the map key button). What I do more often is click "Map data" in the Layers button. Then all objects become clickable. With either option, you can then see the raw data behind the thing you see on the map. Then hit the wiki to learn more about it.

(24 Nov '16, 13:49) joost schouppe

Thanks. That helps.

(26 Nov '16, 10:43) McGradyM
3

There are many ways of doing this, they all have their advantages and disadvantages. A lot depends on the amount of data you are dealing with (whole planet vs. small extract) and the system and skills you have. If you are familiar with SQL/PostGIS, for instance, you can use one of the PostGIS importers (like osm2pgsql or imposm) to import OSM data into a PostGIS database and then export into Shapefiles. If you like command lines, try ogr2ogr. If you need something more custom and know C++, you can write your own exporter based on https://github.com/osmcode/osm-gis-export. For smaller files, you can build something with use node-osmium, see the demo here: https://github.com/osmcode/node-osmium/tree/master/demo/converter.

http://wiki.openstreetmap.org/wiki/Shapefiles has more options.

permanent link

answered 22 Nov '16, 08:20

Jochen%20Topf's gravatar image

Jochen Topf
4.6k54665
accept rate: 32%

Thanks. I'll probably nose around some more, and end up asking someone with more skill. That would be the fastest.

(22 Nov '16, 10:30) McGradyM
2

A little bit more explanation to @joost-schouppe answer. First you need to find out "Oman" or any other region's OSM relation id.

Use this query in Overpass Turbo

[out:json][timeout:900];
// get a few areas into .myArea
// you can add or remove an area by simply adding or removing
// one line here.

(
{{geocodeArea:"Oman"}};
)->.myArea;

// display .myArea This can be replaced by any query
// on the objects in .myArea

rel(pivot.myArea);

// print results
out geom;

{{style:
node{opacity:0;fill-opacity:0}
}}

Now once you know the OSM relation id then you can extract any layer easily with overpass API. OSM relation id for "Oman" is "305138"

Here is curl command to extract power line using Area clause of overpass API

curl \
  -H "Host: overpass-api.de" -H "Content-Type: text/xml"  \
  -d '(relation["route"="power"](area:3600305138););(._;>;);out body;'  \
  http://overpass-api.de/api/interpreter  \
  -o powerline.osm

Now you can use ogr2ogr to convert OSM to shapefile.

permanent link

answered 04 Dec '16, 05:35

Gagan's gravatar image

Gagan
2902413
accept rate: 14%

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×287
×74

question asked: 21 Nov '16, 21:18

question was seen: 5,232 times

last updated: 04 Dec '16, 05:35

powered by OSQA