[gdal-dev] Generate GeoTiff raster file from scattered data with concrete colours

Félix Pedrera García felix.pedrera at deimos-space.com
Tue Jan 13 04:56:41 EST 2009


Hello,

I would be very thankful to have some guidelines on how to generate a 
GeoTiff raster file from data in a CSV file. The data has this format:

505750,4249750,0
506000,4249750,0
508000,4249750,0
508250,4249750,1
508500,4249750,1
510000,4249750,2
510250,4249750,0
510500,4249750,0
511000,4249750,0
511250,4249750,0
511500,4249750,1
511750,4249750,3
512250,4249750,3
512500,4249750,3
512750,4249750,3
513000,4249750,3
...

The coordinates are expressed in UTM (EPSG:23030), the grid size is 250 
x 250 m, and the extents of the data file is known.

I would like to generate the raster file (GeoTiff) with a pixel 
resolution of  7 px/m. I've managed to generate a single color raster 
(grey scale) with the gdal_grid command, but it would be desirable to 
have the raster file generated with the following colour distribution:

- Transparent if the third field is "0"
- Red, RGB(255;0;0), if the third field is "1"
- Yellow, RGB(255;255;0), if the third field is "2"
- Green, RGB(0;255;0), if the third field is "3".

I don't want the values to be interpolated at all, the unique possible 
values are "0, 1, 2, 3".

Is it possible to have such raster generated using GDAL tools?

The same data is available also in vector format (Mapinfo MIF),  in 
polygons of 250 x 250 m; in case a vector to raster approach is 
preferable.  In this case I've being giving "gdal_rasterize" a try, but 
I'm having problems compiling the code to generate a blank raster with 
the Python and C# GDAL bindings.

Any help on how to focus the solution will be highly appreciated.

Thanks,

-- 
Félix





More information about the gdal-dev mailing list