[Gdal-dev] Extracting A Rotated Rectangle

Kent Eschenberg eschenbe at psc.edu
Thu Sep 20 11:46:48 EDT 2007


This is a simple question, I think, from one who is just starting to use the 
GDAL library. I'll make this as brief as possible. I need to

===
1) Convert raster/vector files to lon/lat.
2) Extract a region given the min/max lon/lat.
3) Extract from 2) a smaller region that is at an angle.
4) Write the data in a legacy VTK file format.
===

I'm writing a C++ program and some custom code to do 3 and 4. The question for 
you folks is how to best do 1 and 2.

===
Plan A: Do it all in the C++ program. The problem: at least one of the maps is 
1.3 GB and is impractical to read into memory unless the workstation has, say, 
2 GB. Step 1 also takes a lot of time. I don't see a way to combine 1 and 2, 
i.e., read only the desired rectangle into memory given the min/max lon/lat.

Plan B: Use utilities gdalwarp and gdal_translate for steps 1,2 then do the 
rest in my program. A little less elegant but maybe the best. I'd like to do it 
all in gdalwarp but its "-te xmin ymin xmax ymax" option seems to require the 
bounds in the input file's coordinate system whereas I only know the bounds in 
lon/lat.
===

Suggestions? Thanks!

Kent
Pittsburgh Supercomputing Center



More information about the Gdal-dev mailing list