I have a problem and maybe someone is able to help me or give me some hints how to start.
Situation: I have a lot of raster and of every raster I have the center coordinate. Out of this coordinate I build a shapefile to have the information about the approximate location of each raster. Now I included the path for each raster in the attribute table of the shapefile with the field calculator.
Problem: Some of the raster are exactly georeferenced with a word-file. I want to add a new attribute field to show if there is a georeference or not. For this I can use the following code (at the moment a input cursor is missing):
from arcpy import env
arcpy.env.overwriteOutput = 1
env.workspace = r'Z:\path'
path = env.workspace
# Create a table and add fields
table_name = "TempTable.dbf"
arcpy.CreateTable_management(path, table_name)
arcpy.AddField_management(path + "\\" + table_name, "RasterName", "TEXT")
arcpy.AddField_management(path + "\\" + table_name, "cs", "TEXT")
# Get the list of raster files
rasters = arcpy.ListRasters()
# Loop through the files and perform the processing
for ras in rasters:
# Determine if the input has a defined coordinate system
dsc = arcpy.GetRasterProperties_management(ras, "TOP")
if float(str(dsc.getOutput(0)).replace(",", ".")) > 100:
row.cs = "y" # Adds "x" to the row where the image has a georeference
else:
row.cs = "n" # Adds "n" to the row where the image has no georeference
Now I do not know how to add the information in the right way to the attribute table (maybe a join?). I hope there is someone who is able to help me with this.
Thanks!
