Project

General

Profile

GDAL - Useful Tips

GDAL (OGR) tools

GDAL is a translator library for raster and vector geospatial data formats. It is used by many software (including QGIS and many other open source ones, including Gisaf). Some command line utilities are supplied, like:

  • ogr2ogr can easily convert one data format to another
  • ogrinfo displays information about files.

Using Windows

On a computer with Windows and GQIS installed:

1. Open a command line console (eg. <Windows Key> to display the Start menu, then just type cmd and <Enter>)
2. In the console window, type (adjust with the QGIS version and location, this seems to be the standard one):

"c:\Program Files\QGis 3.10\OSGeo4W.bat" 

3. GDAL utilities can be used: ogr2ogr, etc.

Example: convert Geopackage to Shapefiles

Output the content of the geopackage 9wdoogfr_2019-11-13_12_26_07.gpkg to the folder shapefiles:

ogr2ogr -progress -f "ESRI Shapefile" shapefiles 9wdoogfr_2019-11-13_12_26_07.gpkg

To output the content of the geopackage 9wdoogfr_2019-11-13_12_26_07.gpkg to the root folder:

ogr2ogr -progress -f "ESRI Shapefile" c:\shapefiles 9wdoogfr_2019-11-13_12_26_07.gpkg

With reprojection

Same as above, reprojecting to UTM44N:

ogr2ogr -progress -f "ESRI Shapefile" -t_srs EPSG:32644 c:\shapefiles 9wdoogfr_2019-11-13_12_26_07.gpkg