[gdal-dev] image outline polygons with keys

Brent Fraser bfraser at geoanalytic.com
Sat Jun 9 08:50:52 PDT 2012


All,

   I need to create image footprints (outlines excluding the nodata 
areas)  for about 300 geotiff images.  While GDAL's gdal_polygonize.py 
may do the job, I prefer GINA's 
(http://www.gina.alaska.edu/projects/gina-tools) gdal_trace_outline 
because of its option,s but I'm open to alternatives.  I intend to load 
the polygons into PostGIS for later processing and I need some kind of 
key value (filename?) on the polygons. Neither gdal_polygonize nor 
gdal_trace_outline have an option for setting an attribute value (the 
produced shapefiles have a single integer attribute) to identify the 
polygon when they create the shapefile.

   So my current plan calls for scripting:

    For 300 shapefiles:
       Use shp2pgsl to Load shapefile into a PostGIS temp table
             (creates a table with a single row),
       Use pgsql to do an ALTER table to:
             add a IMAGENAME column
             update IMAGENAME for the loaded row
             copy the row into the final table
             delete the temp table

I suppose I could enhance gdal_polygonize (or gdal_trace_outline) to 
allow an attribute value, but I'm hoping someone has a simpler, more 
elegant way using existing software.

GeoKettle may be an answer, but it has a steep learning curve...

-- 
Best Regards,
Brent Fraser




More information about the gdal-dev mailing list