In QGIS 1.8 I used the openstreetmap plugin to request data from the server, or open a .osm XML file, which produced 3 layers (polygons, polylines and points) in QGIS.
This was great (give or take the 64bit bug which highly affects the freshly mapped area I work on), but how do I do that in QGIS 2.x?
I can't find any updated documentation about it.
In the vector menu, I've tried importing from osm servers, I get a .osm file, but then I'm stuck. There's a menu option for loading an XML file, but it produces a spatialite db, which apparently only has non-geometry tables when I try to add it as a spatialite layer. If I open the attribute table, I can see node ids, ways and so on, but I can't figure out how to actually make use of them.
I've also tried adding a vector layer from a .osm XML file. I get a gpsbabel window that shows nothing, then finally an invalid data source message in QGIS.
Answer
Update for QGIS 3.x: The old OSM importer from QGIS 2 was dropped in QGIS 3 due to lots of unresolved bugs. The QuickOSM plugin also enables to read osm raw files. You can use user Layer - Add Layer - Add Vector Layer instead. In that case, OSM data are opened with GDAL as documented by http://gdal.org/drv_osm.html
In QGIS 2.x, There are 3 steps involved
- Get an OSM File, you can get it using josm or overpass or any other source. It has to be a valid xml. You can also download it from qgis Vector > OpenStreetMap > Download OSM Data menu, but sometimes it does not give result. I would recommend using overpass turbo.
- Vector > OpenStreetMap > Import Topology from XML, this as you said will produce a spatialite database with non-geometry tables. This i think is the topology.
- Finally, you can get data by Vector > OpenStreetMap > Export Topology to Spatialite, here you need to give the db file made above and just like in qgis 1.8 you will have option to choose points, lines or polygons. Below that in exported tags section you can load all the tags contained in the file and select only those which you require. This is additional feature than in 1.8.
The layer gets added to map, if you want all nodes, ways you can repeat step 3 with other options.
http://wiki.openstreetmap.org/wiki/QGIS#QGIS2_OpenStreetMap_Vectors
No comments:
Post a Comment