I would like to create a shape file containing the extents of each of the rasters in a directory. Is it possible to capture the extent of a raster using Python?
I have tried
extent1=arcgisscripting.Raster.extent('stg1_05.jpg') Runtime error <type 'exceptions.TypeError'>: 'getset_descriptor' object is not callable
and I can't seem to find any help on the module.
I also tried
arcpy.RasterToPolygon_conversion(inRaster, outPolygons, "SIMPLIFY", field) Runtime error <class 'arcgisscripting.ExecuteError'>: ERROR 010247: The size of the output shapefile exceeds the 2 GB limit. ERROR 010067: Error in executing grid expression. Failed to execute (RasterToPolygon).
Anyway this will be a polygon of the whole raster file and not just the extents -even if this is generated, I guess we could then run a merge/dissolve but the files created are to big.
Another option I was thinking of was to convert the raster to layer
import arcpy, os path=r'C:\Python26\script_tests\rectify' os.chdir(path) Layer1=arcpy.mapping.Layer('stg1_05.jpg') Layer1extent=Layer1.getExtent() Layer1extent <Extent object at 0x2b4799b0[0x2b4cd3c8]>
Xmax=Layer1extent.XMax Xmax 338256.03410530568
etc...to then put this into a shape file. No issues here EXCEPT
this seems to be a very convoluted process...
PLEASE ADVISE