Convert rasters between Whitebox GAT and ArcGIS

Whitebox GAT is a powerful open-source GIS and remote sensing software package, which is developed by Dr. John Lindsay at University of Guelph. It provides many useful geoprocessing tools that ArcGIS does not have. Sometimes it is desirable to convert rasters between Whitebox GAT and ArcGIS, In particular, when you have to deal with hundreds of files, scripting is the way to go. See below for some scripting examples using Whitebox Scripter (Whitebox–>Tools–>Scripting) and  ArcPy (ArcMap–>Geoprocessing–>Python). You can customize the file path and make it your own.

Whitebox GAT can be freely downloaded at http://www.uoguelph.ca/~hydrogeo/Whitebox/index.html. You can also check out the Whitebox blog http://whiteboxgeospatial.wordpress.com/ for more information.

Happy Geoprocessing!

Import GeoTIFF (*.tif ) to Whitebox format (*.dep) using Whitebox Scripter

import os
import glob

path = r”C:\temp\*.tif”

fileNames = glob.glob(path)

inputFiles = “”

for fileName in fileNames:
inputFiles = inputFiles + “;” + fileName

inputFiles = inputFiles[1:]

#print inputFiles

args = [inputFiles]
pluginHost.runPlugin(“ImportGeoTiff”, args, False)

Export the Whitebox results (*.dep) to ArcGIS ASCII Grid format (*.txt) using Whitebox Scripter

import os
import glob

path = r”C:temp\*.dep”
fileNames = glob.glob(path)
inputFiles = “”
for fileName in fileNames:
inputFiles = inputFiles + “;” + fileName

inputFiles = inputFiles[1:]
#print inputFiles
args = [inputFiles]
pluginHost.runPlugin(“ExportArcAsciiGrid”, args, False)

Convert ArcGIS ASCII Grid format (*.txt) to GeoTIFF(*.tif) using ArcPy

import os
import glob

path = r”C:\temp\*.txt”
fileNames = glob.glob(path)
outPath = r”C:\output”

for file in fileNames:
base=os.path.basename(file)
outRaster = os.path.splitext(base)[0] + ‘.tif’
outFileName = os.path.join(outPath,outRaster)
arcpy.ASCIIToRaster_conversion(file,outFileName,”INTEGER”)

Advertisements

About Qiusheng Wu

Assistant Professor of Geography at Binghamton University, State University of New York

Posted on October 28, 2014, in GIS/RS, Software, Tutorials and tagged . Bookmark the permalink. Leave a comment.

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

Alex Tereshenkov

Programming and managing GIS

REDD+ for the Guiana Shield

Technical Cooperation Project

LidarBlog.com

Dr. Qiusheng Wu @ SUNY Binghamton

Writing Science

How to write papers that get cited and proposals that get funded

GIS In Ecology

Providing Training, Advice And Consultation On The Use Of GIS In Ecology

metrhispanic

On cities, land, ...

GeoAcademy

Open GIS: No Bounds

Scientia Plus Conscientia

Thoughts on Science and Nature

r4hydrology

Learning hydrology with R

Karl Hennermann

GIS at the University of Manchester

GIS and Science

Applications of geospatial technology for scientific research and understanding.

GISblog.com

GIS, Mapping, Remote Sensing, Geodata, Geospatial news

Whitebox Geospatial Analysis Tools

Open-source GIS development and spatial analysis with Whitebox GAT

TopoToolbox

MATLAB-based software for topographic analysis

Anything Geospatial – AnyGeo

Dr. Qiusheng Wu @ SUNY Binghamton

GeospatialPython.com

Dr. Qiusheng Wu @ SUNY Binghamton

Another GIS Blog

Dr. Qiusheng Wu @ SUNY Binghamton

%d bloggers like this: