A recent project at work required the use of the ogr2ogr program found found in GDAL (Geospatial Data Abstraction Library), a popular open source library for working with various geospatial data formats. My requirement was simply a command line utility for the purpose manipulating some data; I didn’t need a GDAL library for a language or framework. After some Google searching for how to install and use GDAL, I found a lot of results for Linux and macOS, but had some difficulty finding a clear guide on how to install and use on Windows. I did eventually manage to figure things out, and have documented the process below. Unlike Linux and macOS, applications on Windows often install their own command line utilities, and eventually you may wind up with a lot different CLIs…

This is not super convenient, so at the end of this tutorial I’ll show how to add an OSGeo4W shell profile to the Windows Terminal for a more seamless integration with the system. The end result is a one-stop shop for all your command line based tools.

To begin, I downloaded OSGeo4W from the Open Source Geospatial Foundation (OSGeo). OGGeo4W is “a binary distribution of a broad set of open source geospatial software for Windows,” which is perfect for someone who just needs to use the tools. After downloading, I ran the .exe and selected “Advanced Install.”

Set the desired installation path, users, and icon options, and on the next step set the installation file download folder and Start Menu name. The default values should be fine here for most users.


In the next two steps, set your internet connection options (default should be fine) and select one of the available download sites.


The next step is where optional packages can be selected for install. Search for “gdal” in the upper left of the installer, and select “gdal” under All > Commandline_Utilities. Optionally, select the “src” box to include the source files with installation.


After installation completes, you should see a new shortcut in the start menu. If that is not present, start the OSGeo4W shell by launching the “OSGeo4W.bat” script found in the installation folder.

With the shell running, use command o-help
for a list of available commands.

o-help

ogr2ogr
command is availableWindows Terminal Integration
After verifying everything installed correctly, I added a new profile to the Windows Terminal. To do this, open Terminal, and select “Settings.”

In Settings along the left hand column of icons, click the “+” icon to add a new profile, scrolling down if necessary to reveal it.

Select “New empty profile” and set the name of the profile and the value “Command line” (which will be the full path to the “OSGeo4W.bat” script). Optionally, set the starting directory or set an icon for the profile using the default installation’s icon.

Once the profile has been created, it can be opened as a new tab in Windows Terminal.

