User Tools

Site Tools


osm_qgis

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
osm_qgis [2023/03/05 11:27] bushwalkingosm_qgis [2023/12/11 09:20] (current) – osmconf changes bushwalking
Line 24: Line 24:
  https://github.com/AmericanRedCross/workflows/blob/master/converting_pbf_into_spatialite.md   https://github.com/AmericanRedCross/workflows/blob/master/converting_pbf_into_spatialite.md 
    
-''ogr2ogr -f "SQLite" -dsco SPATIALITE=YES {name_of_new_file}.db {name_of_extracted_file}.pbf'' +<code>ogr2ogr -f "SQLite" -dsco SPATIALITE=YES {name_of_new_file}.db {name_of_extracted_file}.pbf</code>
  
-eg ''ogr2ogr -f "SQLite" -dsco SPATIALITE=YES E:\geodata\ausosm-20230303.db E:\geodata_raw\australia-20230303.osm.pbf''+eg <code>ogr2ogr -f "SQLite" -dsco SPATIALITE=YES E:\geodata\ausosm-20230303.db E:\geodata_raw\australia-20230303.osm.pbf</code>
  
 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.
Line 33: Line 33:
  
 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:
-''ogr2ogr -f "SQLite" -dsco SPATIALITE=YES -spat {x min} {y min} {xmax} {ymax} {output filename}.db {input file name}.osm.pbf''+<code>ogr2ogr -f "SQLite" -dsco SPATIALITE=YES -spat {x min} {y min} {xmax} {ymax} {output filename}.db {input file name}.osm.pbf</code>
  
-eg For NSW data only, you could run: ''ogr2ogr -f "SQLite" -dsco SPATIALITE=YES -spat 141 -37.5 153.75 -28 E:\geodata\nswosm-20230303.db E:\geodata_raw\australia-20230303.osm.pbf''+eg For NSW data only, you could run: <code>ogr2ogr -f "SQLite" -dsco SPATIALITE=YES -spat 141 -37.5 153.75 -28 E:\geodata\nswosm-20230303.db E:\geodata_raw\australia-20230303.osm.pbf</code>
  
 The coordinates above are in the following order: West South East North  The coordinates above are in the following order: West South East North 
Line 54: Line 54:
  
 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. 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:\Users\<username>\AppData\Roaming\QGIS\QGIS3\profiles\default, and doesn't need admin permissions to edit.
 +
 +You can then use the ''-oo'' flag in the convert data process to point to the file location eg:
 +
 +<code>ogr2ogr -f "SQLite" -dsco SPATIALITE=YES -oo CONFIG_FILE=C:\Users\brennant\AppData\Roaming\QGIS\QGIS3\profiles\default\osmconf.ini E:\geodata\ausosm-20231210.db E:\geodata_raw\australia-20231210.osm.pbf</code>
  
 ===== Load data in QGIS ===== ===== Load data in QGIS =====
osm_qgis.txt · Last modified: 2023/12/11 09:20 by bushwalking

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki