As from the ArcGIS help, getRasterProperties() ...
... returns the output values of a tool when it is
executed as a Result object. The advantage of a result object is that
you can maintain information about the execution of tools, including
messages, parameters, and output. These results can be maintained even
after several other tools have been run.
you need to get the value of the result using .getOutput(index), which will return your value of interest as an unicode string at index 0. This string can in turn be converted into a numeric variable using float() and int().
print int(float(Max_aggl.getOutput(0)))
I think you're getting the error because the fieldnames list still contains the field LABEL, but you said you're not adding it to the output_fc.
for field in fields:
fieldnames.append(field.name)
Right here you're getting all the field names.
If you do a print statement above this line:
cursor = arcpy.da.InsertCursor(output_fc, fieldnames)
I assume you'll see LABEL as a field which was not added to the output_fc.
You should only append the fields that you add to the output_fc.
I would think that this should work:
for field in fields:
if field.type in ('TEXT', 'FLOAT', 'DOUBLE', 'SHORT', 'LONG', 'DATE', 'BLOB', 'RASTER', 'GUID'):
arcpy.AddField_management(point_file_name, field.name, field.type, field.precision, field.scale, field.length, field.aliasName, field.isNullable)
fieldnames.append(field.name)
Unless I'm misunderstanding and the problem is that you aren't able to add the LABEL field to the output_fc.
EDIT
The fields aren't adding because the TEXT is actually "String", DOUBLE is "Double", etc.
Try this:
for field in fields:
print field.type
And see what the output is. You need to match that.
Here's what field.type returns:
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v0000001p000000
All — All field types are returned. This is the default.
Date — Only field types of Date are returned.
Double — Only field types of Double are returned.
Geometry — Only field types of Geometry are returned.
GUID — Only field types of GUID are returned.
Integer — Only field types of Integer are returned.
OID — Only field types of OID are returned.
Raster — Only field types of Raster are returned.
Single — Only field types of Single are returned.
SmallInteger — Only field types of SmallInteger are returned.
String — Only field types of String are returned.
If I were you, I'd just use the template parameter to add the fields.
CreateFeatureclass_management (out_path, out_name, {geometry_type}, {template}, {has_m}, {has_z}, {spatial_reference})
So you could just put:
arcpy.CreateFeatureclass_management(destination_workspace, point_file_name, "POINT", input_fc, "", "", input_fc)
This will create the new feature class including all the fields in the input feature class and it's spatial reference.
Best Answer
The problem is that you are passing in Shape@XY as the argument for the field names. This expects a tuple of the feature's centroid x,y coordinates to be passed in when you use the insert cursor ( see http://resources.arcgis.com/en/help/main/10.1/index.html#//018w0000000t000000)
However, czk=[413960.0, 47130.0] is a list containing two floating point numbers. When you say:
You are only passing a single floating point number in when it expects a tuple with two items in it (one x and one y coordinate).
If 413960.0, 47130.0 is your x,y pair then you need to change your code to something like this: