This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
gis_data [2014/08/07 09:45] mstraub [Use OSM data with QGIS] |
gis_data [2015/02/11 16:57] (current) mstraub [Use OSM data with QGIS] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== OpenStreetMap ====== | ||
+ | ===== OSM map data===== | ||
+ | |||
+ | ==== Use OSM data with QGIS ==== | ||
+ | |||
+ | Step 1: Download OSM data, e.g. an export from Geofabrik in the space-saving binary pbf-format | ||
+ | <code bash> | ||
+ | wget http://download.geofabrik.de/europe/austria-latest.osm.pbf | ||
+ | </code> | ||
+ | |||
+ | Step 2: [[http://www.gdal.org/ogr/drv_osm.html|Configure GDAL]] (which is used by QGIS to import OSM data) to import all attributes you are interested in | ||
+ | <code> | ||
+ | /usr/share/gdal/1.10/osmconf.ini | ||
+ | </code> | ||
+ | |||
+ | Step 3: Extract your area of interest and convert it into a SpatiaLite (SQLite) database - a format QGIS can handle easily. The -spat argument takes latitude / longitude in the following order: -spat minLon minLat maxLon maxLat | ||
+ | <code bash> | ||
+ | #ogr2ogr -f "SQLite" -spat minLon minLat maxLon maxLat snippet.db austria-latest.osm.pbf | ||
+ | ogr2ogr -f "SQLite" -spat 16.34 48.19 16.36 48.20 snippet.db austria-latest.osm.pbf | ||
+ | </code> | ||
+ | |||
+ | |||
+ | Alternative: use Osmosis to snip your area of interest (you could also use --write-xml to create an OSM XML file to e.g. open it in JOSM) | ||
+ | <code bash> | ||
+ | osmosis --read-pbf austria-latest.osm.pbf --bounding-box left=16.34 bottom=48.19 right=16.36 top=48.20 --write-pbf snippet.pbf | ||
+ | </code> | ||
+ | |||
+ | Step 4: Use [[https://github.com/anitagraser/QGIS-resources/tree/master/qgis2/osm_spatialite|pretty predefined styles]] to visualize the map. | ||
+ | |||
+ | Sources: \\ | ||
+ | http://anitagraser.com/2014/05/31/a-guide-to-googlemaps-like-maps-with-osm-in-qgis \\ | ||
+ | http://anitagraser.com/2014/06/07/toner-lite-styles-for-qgis/ | ||
+ | |||
+ | ===== OSM GPX planet ===== | ||
+ | |||
+ | In April 2013, OSM [[http://blog.osmfoundation.org/2013/04/12/bulk-gpx-track-data/|announced]] a new dataset containing GPS tracks. | ||
+ | [[http://planet.openstreetmap.org/gps/|Full dataset]] and [[http://zverik.osm.rambler.ru/gps/files/extracts/index.html|extracts]] (e.g. for [[http://zverik.osm.rambler.ru/gps/files/extracts/europe/index.html|Europe]]) are available. The OSM wiki of course has more [[https://wiki.openstreetmap.org/wiki/Planet.gpx|information]] for this dataset. | ||
+ | |||
+ | ==== What's inside ==== | ||
+ | |||
+ | Looking at a small excerpt - [[http://zverik.osm.rambler.ru/gps/files/extracts/usa/us-pacific.tar.xz|us-pacific.tar.xz]], downloaded 2013-04-23 - the following can be said: | ||
+ | |||
+ | The compressed dataset has 16MB, the uncompressed has 340MB. | ||
+ | |||
+ | |||
+ | {{ :structure.png |}} | ||
+ | |||
+ | The **metadata file** contains an entry per track. Each entry has an id, a timestamp depending on the privacy setting, | ||
+ | |||
+ | The tracks are grouped in directories according to their [[http://wiki.openstreetmap.org/wiki/Visibility_of_GPS_traces|visibility]]. Public, trackable and identifiable tracks are included. Private tracks are not contained within the dataset. | ||
+ | |||
+ | Uploaded **GPX tracks** must have a timestamp for each GPS positions. However the timestamps may be anonymised (e.g. by using [[http://wiki.openstreetmap.org/wiki/JOSM/Plugins/EditGpx#Anonymize_timestamps|JOSM]]. | ||
+ | |||
+ | The dataset may contain tracks that show obvious **errors** (e.g. spatial error and a track is located in the ocean). |