[Gdal-dev] how to crop a dataset

Michele Zanin miczanin at gmail.com
Thu Oct 18 12:46:19 EDT 2007


Hi,
  I'm a very unexperienced user of GDAL (since yesterday), so please
excuse me if I say something obvious.

I followed the nice API tutorials and, thanks to the good
documentation, I was able to implement exactly what I needed.

I'd like to share with you a task I found difficult to understand and
implement: maybe you can find interesting looking at GDAL from the
point of view of a complete novice.

I needed to obtain a dataset that was a portion of another one;
something similar to cropping an image. I found difficult to
understand how to do it.
After few hours I discovered VRT datasets and I successfully used
them. This part of GDAL is not fully documented and I feel like there
should be a simpler solution...

I also had a problem: gdal_vrt.h was missing from my include
directory. I modified the install part of GNUmakefile from

install:
	$(INSTALL_DATA) vrtdataset.h gdal_vrt.h $(DESTDIR)$(INST_INCLUDE)

to

install:
	$(INSTALL_DATA) vrtdataset.h gdal_vrt.h $(DESTDIR)$(INST_INCLUDE)
	$(INSTALL_DATA) gdal_vrt.h $(DESTDIR)$(INST_INCLUDE)

I want to thank the authors of GDAL for this very useful software.
michele

ps: I used gdal to (1) load a 5x5 degrees GeoTiff SRTM, (2) extract a
1x1 degree portion, (3) transform it (in memory) to
Oblique_Stereographic projection, and (4) export it to an int buffer.



More information about the Gdal-dev mailing list