[gdal-dev] Question on python gdal.Rasterize()

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Fri Jun 14 10:58:48 PDT 2019


Hi all,

My goal is to take satellite track data and create a gtiff file using 
Python.
The satellite data is in a NetCDF file, which I can read in Python and 
has variables lat, lon, ssha. There are a continue stream of the NetCDF 
data over time so I plan to just keep loading them as they become available.

My thought is to take adjacent track points as a LineStringZ and burn 
them into the image overwriting any existing data. This will keep the 
gtiff up to date with the most current data for any given area.

Maybe there is a better way to do this? suggestions welcome.

I was looking at gdal.RasterizeOptions() and gdal.Rasterize() and my 
thought was that I could create feature with geom like (lon, lat, ssha) 
and then rasterize that into the image using the option "useZ=True" but 
this seems to imply that I need to have an ogr source for the vector 
data. It would be much more convenient to be able to just pass features 
from python to the Rasterize() function.

I see callback and callback_data in the options can these be used for 
that? How?

Rasterize(destNameOrDestDS, srcDS, **kwargs)

I can open the gtiff file and then pass the handle of that to 
destNameOrDestDS.
Can a create an in memory srcDS that I've loaded with the track 
segments. The NetCDF files have about 5-6000 track points in them so an 
eqivalent number of LineStringZ features.

Is there an example of something similar you can link me to.

Thanks,
   -Steve

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the gdal-dev mailing list