Difference between revisions of "Getting Setup With GDAL Using OSGeo4W"

From Tuflow
Jump to navigation Jump to search
 
Line 9: Line 9:
 
<pre>
 
<pre>
 
set PROJ_LIB=C:\OSGeo4W\share\proj
 
set PROJ_LIB=C:\OSGeo4W\share\proj
set gdal_translate="C:\Program Files\QGIS 3.24.1\bin\gdal_translate.exe"
+
set gdal_translate="C:\OSGeo4W\bin\gdal_translate.exe"
 
%gdal_translate% <conversion_commands>
 
%gdal_translate% <conversion_commands>
 
</pre>
 
</pre>

Latest revision as of 02:12, 12 April 2022

The compiled GDAL binaries can be installed via OSGeo4W. Follow the instructions under Quick Start for OSGeo4W Users and choose "GDAL" as the package to install when prompted. The GDAL programs should be located in the installation directory, in the "bin" folder. As an example:

C:\OSGeo4W\bin

The GDAL programs should be ready to use as they are. For example the following batch file will use "gdal_translate.exe":

set gdal_translate="C:\OSGeo4W\bin\gdal_translate.exe"
%gdal_translate% <conversion_commands>

However if you receive errors similar to "PROJ: proj_create_from_database: Cannot find proj.db" you should add this environment variable to the top of the batch file (Note: do not use quotes "" in path):

set PROJ_LIB=C:\OSGeo4W\share\proj
set gdal_translate="C:\OSGeo4W\bin\gdal_translate.exe"
%gdal_translate% <conversion_commands>


Up
Go-up.png Back to GDAL Tips and Tricks