Home > Uncategorized > Using FWTools in Powershell

Using FWTools in Powershell

FWTools is a great tool when working with geographical data. When installed in provides a FWTools command prompt (in the same way as Visual Studio provides a Visual Studio command promt), However, this does not work when using Powershell, ofcouse, and we all prefer Powershell – right? Luckily the setfw.bat that is used to setup the FWTools environment is not that complicated. So here is the powershell equivalent:

$ftdir = "C:\Program Files (x86)\FWTools2.4.6"
[Environment]::SetEnvironmentVariable("FWTOOLS_DIR", $ftdir)

$env:path += ";" + (join-path $ftdir bin)
$env:path += ";" + (join-path $ftdir python)

$temp = join-path $ftdir "proj_lib"
[Environment]::SetEnvironmentVariable("PROJ_LIB", $temp)

$temp = join-path $ftdir "pymod"
[Environment]::SetEnvironmentVariable("PYTHONPATH", $temp);

$temp = join-path $ftdir "data"
[Environment]::SetEnvironmentVariable("GEOTIFF_CSV", $temp);
[Environment]::SetEnvironmentVariable("GDAL_DATA", $temp);

$temp = join-path $ftdir "gdal_plugins"
[Environment]::SetEnvironmentVariable("GDAL_DRIVER_PATH", $temp);

Save the code in a file (i.e. setfw.ps1) and put it in a folder that is added to the path and you will have a powershell command that enables FWTools commands.

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: