Quantcast
Channel: Question and Answer » gdal
Viewing all articles
Browse latest Browse all 397

(How) can I write string data to a raster with Python/GDAL?

$
0
0

In Python, I have a NumPy array of string values (categories of some variable) that I’d like to write to a raster file (.tif or .img) using GDAL.

The impression I get is that it’s not possible to write a string value into the grid cell of a raster file, meaning I’d need to create an integer lookup table and write the integers into the grid cells instead. Then I’d need to write the character data into the column of the raster’s attribute table so that you could know what string values the integers represent.

Is my reasoning correct? If so, I’d like to know the basic process for building a raster attribute table using Python, GDAL. I haven’t had much success in the past, and, as I understand it, not all GDAL raster formats are able to have attribute tables at all anyway.

Thankyou in advance!


Viewing all articles
Browse latest Browse all 397

Latest Images

Trending Articles



Latest Images