I found some batch code using ogr2ogr in order to convert and reproject vector layers. The difficulty for me is to know what to install and which gdal commandline should I use, and how to configure it...

The fact is I'm quite lost with all the packages that gdal offers and I don't know :

  1. which package am I supposed to install : OSGeo4W, FWTools, MS4W,...?? What is the difference between them ? Can I use any of them ?

  2. What is the procedure to set PATH and environment variables ? I work with windows 7.

  3. I have already QGIS and GRASS installed on my computer. Is an installation of gdal could damage anything ?

  • Please narrow this down to a single, focused question and vote to reopen.
    – Aaron
    Jul 23 '17 at 17:48

I prefer the zipped GDAL version of gisinternals. This can be extracted anywhere on your file system. Starting the SDKshell.bat sets the necessary path variables, and after exiting (or outside the command window) everything is back to normal.

FWTools have a standalone installer, but that is not in sync with the current GDAL anymore.


If you have QGIS already installed, then you should also have GDAL and FWTools installed. I hesitate to give you the path because I expect it depends on how you installed QGIS (though the osgeo4w installer is the most common route, which would create an OSGeo4W directory on your C drive).

Although, in theory, installing a separate version of GDAL shouldn't break QGIS - in practice in some circumstances it can. I like to have a standalone version but a little care is needed because you can break QGIS if your standalone version of GDAL is based on a different version of Python to QGIS. QGIS uses Python 2.7 and I need 3.2 or above. It caused me some problems and necessitates me hacking QGIS a little to force it to look in the right place. So, if you want to go down the standalone route, I recommend you install a 32 bit version of GDAL for Python 2.7. You can get up to date binaries for all sorts of combinations of Python, Windows, GDAL and MSVC versions from the excellent GISInternals website.

Since FWTools merely provides a convenience wrapper for GDAL/OGR, if you already have QGIS I wouldn't bother installing a standalone version of it because QGIS gives you even more convenience than using a commandline. Likewise, unless you want to write and run your own geoprocessing scripts, there is not much point in installing GDAL separately. Given your question, I assume this is what you want to do.

To run any of the GDAL Utilities and OGR Utilities you don't need a special command line interface. Just use the Windows commandline (cmd.exe) and navigate or reference the path to where your utilities are as they won't be registered (in my case with an OSGeo4W installation the location is C:\OSGeo4W\bin). Again - you don't need any additional installation to what OSGeo4W can do.

Have a look at this thread for more information on actual installation proceedure if you want to go ahead with a separate install. Following the tutorials mentioned there should tell you how to set the environment variables. However, I don't think you need to do anything apart from locate your ogr2ogr utility.

  • Thanks a lot MappaGnosis for that very precise answer. I'm know sure that I will only use the windows commandline and locate the appropriate utility ;).
    – Samy-DT
    May 27 '13 at 5:01

Little late to view this post, I came upon it when I was looking to incorporate GDAL into Python scripting, WITHOUT using QGIS or OSGeo4W. The reason is that QGIS and OSGeo4W will lock your python to version 2.7 (or similar), and more importantly will only work neatly with their own, separate, install of Python.

Following AndreJ and Jay Cummins advice, you can download a separate install of all binaries (as well as python modules) for GDAL as well as Map Server. The SDKShell.bat file will set your environments so that you can use these scripts from command shell, but you need to permanently set these variables to binary and application files to be able to use these on their own. Also, I recommend copying the Python folders from the GDAL and MS bin folders to your local Python installation directoy, if you want to import all GDAL functionality into new Python scripts.

Not the answer you're looking for? Browse other questions tagged or ask your own question.