Select to view content in your preferred language

Converting .tfw to layout shp or dwg file

5546
4
01-01-2013 10:59 PM
MohanGovindaraj1
Emerging Contributor
Hello all,

I have around 1800 tiff and tfw files. Is there anyway to batch convert this into layout(outer extents of tiff) shp or dwg file?



Thanks...
0 Kudos
4 Replies
JakeSkinner
Esri Esteemed Contributor
Are you looking to get a shapefile/dwg for each individual TIFF's extent, or one shapefile/dwg for a mosaic of the TIFFs?
0 Kudos
MohanGovindaraj1
Emerging Contributor
Are you looking to get a shapefile/dwg for each individual TIFF's extent, or one shapefile/dwg for a mosaic of the TIFFs?


Thanks Jake.

I am looking for shp/dwg of each individual tiff's extent.
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Hi Mohan,

If you have the 3D Analyst extension, you can use the Raster Domain tool to create a polygon or polyline footprint of each raster.  Since you have 1800 TIFFs it would be best to run this tool using a python script where you can iterate through each raster.  Here is an example:

import arcpy
from arcpy import env
env.workspace = r"C:\data\raster\TIFF"

arcpy.CheckOutExtension("3D")

for raster in arcpy.ListRasters("*", "TIF"):
    arcpy.RasterDomain_3d(raster, raster.split(".")[0] + ".shp", "POLYGON")


If you do not have the 3D Analyst extension, and you are using ArcGIS 10.x, you can create a mosaic dataset of all the TIFFs.  When you create a mosaic dataset, a Footprint layer is created of all the rasters.  You can then iterate through this layer exporting the footprint of each raster.  Here is an example:

import arcpy
from arcpy import env
env.workspace = r"C:\DATA\RASTER\TIFF\MosaicDataset.gdb"
env.overwriteOutput = 1

arcpy.MakeMosaicLayer_management("Philadelphia", "MosaicLayer")

rows = arcpy.SearchCursor("MosaicLayer/Footprint")
for row in rows:
    OID = row.OBJECTID
    arcpy.SelectLayerByAttribute_management("MosaicLayer/Footprint", "NEW_SELECTION", "OBJECTID = " + str(OID))
    arcpy.CopyFeatures_management("MosaicLayer/Footprint", r"C:\data\raster\tiff" + "\\" + row.Name + ".shp")

del row, rows
0 Kudos
MohanGovindaraj1
Emerging Contributor
Thanks,


The first one works very fine.
0 Kudos