osm_qgis
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
osm_qgis [2023/03/04 14:45] – created bushwalking | osm_qgis [2023/12/11 09:20] (current) – osmconf changes bushwalking | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Mapping with OSM Data in QGIS ====== | ||
+ | |||
This topic builds on the [[nsw_lidar|Mapping from NSW Lidar with QGIS]] tutorials, though the data can also be used standalone. | This topic builds on the [[nsw_lidar|Mapping from NSW Lidar with QGIS]] tutorials, though the data can also be used standalone. | ||
Line 5: | Line 7: | ||
There' | There' | ||
- | ====== Download raw data ====== | + | ===== Download raw data ===== |
Download the .PBF file (australia-latest.osm.pbf) from | Download the .PBF file (australia-latest.osm.pbf) from | ||
Line 11: | Line 14: | ||
http:// | http:// | ||
- | ====== Convert data ====== | + | ===== Convert data ===== |
+ | |||
+ | ==== Basic ==== | ||
Open up the OSGEO4W Shell that comes with QGIS (look under Start -> All Programs -> QGIS) | Open up the OSGEO4W Shell that comes with QGIS (look under Start -> All Programs -> QGIS) | ||
Line 19: | Line 24: | ||
| | ||
- | '' | + | < |
- | eg '' | + | eg < |
It's useful to include the date in the filenames so you know when the data is from. | It's useful to include the date in the filenames so you know when the data is from. | ||
+ | |||
+ | ==== Cropping ==== | ||
If you need to crop the PBF file, the use the following command: | If you need to crop the PBF file, the use the following command: | ||
- | '' | + | < |
- | eg For NSW data only, you could run: '' | + | eg For NSW data only, you could run: < |
The coordinates above are in the following order: West South East North | The coordinates above are in the following order: West South East North | ||
- | ===== Fields | + | ==== Fields ==== |
You may want to control the fields that you are importing from OSM. This is done using the osmconf.ini file, that can be found under your QGIS installation eg C:\Program Files\QGIS 3.22.10\apps\gdal\share\gdal\osmconf.ini | You may want to control the fields that you are importing from OSM. This is done using the osmconf.ini file, that can be found under your QGIS installation eg C:\Program Files\QGIS 3.22.10\apps\gdal\share\gdal\osmconf.ini | ||
Line 44: | Line 51: | ||
**Points:** attributes=name, | **Points:** attributes=name, | ||
- | Other tags not listed will still be imported, but in a generic field called other_tags. | + | Other tags not listed will still be imported, but in a generic field called other_tags. |
- | + | ||
- | 3. Access | + | If you make any changes, take a backup of your osmconf.ini file. If you upgrade QGIS, it will revert to the default, and you'll need to restore osmconf.ini if you want those fields to come through next time you process an OSM file. |
+ | |||
+ | It may be worth storing a copy of it in (say) your profile folder for QGIS, which is retained on upgrade eg C: | ||
+ | |||
+ | You can then use the '' | ||
+ | |||
+ | < | ||
+ | |||
+ | ===== Load data in QGIS ===== | ||
+ | |||
+ | Open QGIS. | ||
+ | |||
+ | Go to Layer->Data Source Manager and select SpatiaLite. | ||
+ | |||
+ | Select New, and locate the file. | ||
+ | |||
+ | Once you have set up the connection, you can extract data using (for example) the Processing Toolbox-> | ||
+ | |||
+ | ===== Style data in QGIS ===== | ||
- | This is useful | + | Here are some sample bushwalking-based style files for OSM points and OSM lines: |
- | data | + | * {{ : |
+ | * {{ : | ||
- | eg roads, | + | Note that they will only work fully if you have matched |
- | ogr2ogr -f " | + | That said, you can generally fix any issues relating to tags by replacing a basic filtering rule such as |
+ | ''" | ||
+ | with | ||
+ | '' | ||
- | To cut out a section of streets within a municipality, | ||
- | Change the CRS to a metric one so that buffering by say " | + | ===== Links ===== |
Some other methods of getting OSM data into QGIS can be found at https:// | Some other methods of getting OSM data into QGIS can be found at https:// | ||
osm_qgis.1677901556.txt.gz · Last modified: 2023/03/04 14:45 by bushwalking