Generate a distance-to-class raster

A raster, where each pixel provides the distance to a class is useful for lots of classification / modelling applications. Using the gdal_proximity command it’s really easy to generate one.

Assuming your classification is already a raster (you can use gdal_rasterize to convert a vector to a raster if needed), the command to calculate the proximity to class 1 (-values 1), in geographic units (-distunits GEO), up to a maximum distance of 1000 m (-maxdist 1000; assuming your input is in m), setting no-data values to 1000 (maximum distance; -nodata 1000) and saving as a KEA file (-of KEA), is: -of KEA -ot UInt16 -distunits GEO \
-maxdist 1000 -nodata 1000 -values 1 \
classification.kea \

Leave a Reply

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

You are commenting using your 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