POST
|
###########Point to Raster
# Import arcpy module
import arcpy, os
from arcpy import env
from arcpy.sa import *
# Set environment settings
arcpy.env.workspace = "C:/py2/extract"
arcpy.env.overwriteOutput = True
OutputFolder2 = "C:/py2/result"
# Loop through a list of files in the workspace
RasterFiles2 = arcpy.ListFeatureClasses()
print "POINT TO RASTER"
print RasterFiles2
print " "
# Set local variables
for filename2 in RasterFiles2:
print "Processing: {0}".format(filename2)
outRaster2 = os.path.join(OutputFolder2, filename2)
value = "RasterValu"
assignmentType = "MOST_FREQUENT"
priorityField = "NONE"
cellSize = "0.035714286"
# Execute ExtractValuesToPoints
saveRaster = arcpy.PointToRaster_conversion( filename2, value, outRaster2, assignmentType, priorityField, cellSize)
print " "
print ":o) End Processing :)"
print arcpy.GetMessages()
my point shp file, attribute table. ..[ATTACH=CONFIG]24481[/ATTACH] i got this error Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\arcpy\convert", line 33, in <module>
saveRaster = arcpy.PointToRaster_conversion( filename2, value, outRaster2, assignmentType, priorityField, cellSize)
File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\conversion.py", line 1772, in PointToRaster
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000728: Field RasterValu does not exist within table
ERROR 000840: The value is not a Raster Dataset.
ERROR 000840: The value is not a Raster Catalog.
Failed to execute (PointToRaster).
... View more
05-19-2013
05:42 AM
|
0
|
2
|
1449
|
POST
|
it is my attribut table in the shape file. [ATTACH=CONFIG]24355[/ATTACH] and, new code is here.
###########Point to Raster
# Import arcpy module
import arcpy, os
from arcpy import env
from arcpy.sa import *
# Set environment settings
arcpy.env.workspace = "C:/py2/extract"
arcpy.env.overwriteOutput = True
OutputFolder2 = "C:/py2/result"
# Loop through a list of files in the workspace
RasterFiles2 = arcpy.ListFeatureClasses()
print "POINT TO RASTER"
print RasterFiles2
print " "
# Set local variables
for filename2 in RasterFiles2:
print "Processing: {0}".format(filename2)
outRaster2 = os.path.join(OutputFolder2, filename2)
value = "RASTERVALU"
assignmentType = "MOST_FREQUENT"
priorityField = "NONE"
cellSize = "0.035714286"
# Execute ExtractValuesToPoints
saveRaster = arcpy.PointToRaster_conversion( filename2, value, outRaster2, assignmentType, priorityField, cellSize)
print " "
print ":o) End Processing :)"
print arcpy.GetMessages()
but i got it,
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\arcpy\convert", line 33, in <module>
saveRaster = arcpy.PointToRaster_conversion( filename2, value, outRaster2, assignmentType, priorityField, cellSize)
File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\conversion.py", line 1772, in PointToRaster
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000840: The value is not a Raster Dataset.
ERROR 000840: The value is not a Raster Catalog.
Failed to execute (PointToRaster).
help me...TT
... View more
05-15-2013
11:24 PM
|
0
|
0
|
445
|
POST
|
why is your cellsize in quotes? My projection is GCS, so my cell size is quotes.. ^^
... View more
05-15-2013
09:53 PM
|
0
|
0
|
445
|
POST
|
i got the this error message. what's wrong to me? Traceback (most recent call last): File "C:/Users/Administrator/Desktop/arcpy/convert", line 36, in <module> saveRaster = arcpy.PointToRaster_conversion( filename2, "RASTERVALU", outRaster2, "MOST_FREQUENT", "NONE", cellSize) File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\conversion.py", line 1772, in PointToRaster raise e ExecuteError: ERROR 999999: Error executing function. Failed to execute (PointToRaster).
# Import arcpy module
import arcpy, os
from arcpy import env
from arcpy.sa import *
# Set environment settings
arcpy.env.workspace = "C:/py2/extract"
arcpy.env.overwriteOutput = True
OutputFolder2 = "C:/py2/result"
# Loop through a list of files in the workspace
RasterFiles2 = arcpy.ListFeatureClasses()
print "POINT TO RASTER"
print RasterFiles2
print " "
# Set local variables
for filename2 in RasterFiles2:
print "Processing: {0}".format(filename2)
outRaster2 = os.path.join(OutputFolder2, filename2 + "_4x")
valField = "RASTERVALU"
assignmentType = "MOST_FREQUENT"
priorityField = "NONE"
cellSize = "0.035714286"
# Execute ExtractValuesToPoints
saveRaster = arcpy.PointToRaster_conversion( filename2, valField, outRaster2, assignmentType, priorityField, cellSize)
print "done "
print arcpy.GetMessages()
... View more
05-15-2013
04:57 PM
|
0
|
4
|
4226
|
POST
|
Hi, now, i use only single zonal statistics module. but i want to multiple zonal tool. # Import arcpy module import arcpy, os from arcpy import env from arcpy.sa import * # Check out any necessary licenses arcpy.CheckOutExtension("spatial") # Input data source arcpy.env.workspace = "C:/py/07" arcpy.env.scratchWorkspace = "C:/py/07" arcpy.env.overwriteOutput = True ZoneData = "C:/py/FISHNET_4k_FeatureToPolygon.shp" # Output File OutputFolder = "C:/py/zonal" # Loop through a list of files in the workspace RasterFiles = arcpy.ListRasters() print RasterFiles print " " # Local variables: for filename in RasterFiles: print "Processing: {0}".format(filename) input_dir = arcpy.env.workspace inRaster1 = "C:/py/07/lai_0907_m" outRaster1 = os.path.join(OutputFolder,"z4_" + filename) # Process: Zonal Statistics saveRaster = arcpy.sa.ZonalStatistics(ZoneData, "ID", inRaster1, "MEAN", "DATA") saveRaster.save(outRaster1) print "done" but, i have 12 raster files. and, i want to zonal at the one time.. please help me. how can i do? i heard loop, but, i can use that.. raster file name. (lai_0901,lai_0902, ......, lai_0912)
... View more
05-14-2013
05:54 PM
|
0
|
1
|
340
|
POST
|
Hi. I wanna zonal tools. I can use, simple arcpy modules. I can use zonal statistics. but, i have many input raster. so, i want to use arcpy of zonal tools, for many input raster at the one time. # Import arcpy module import arcpy, os from arcpy import env from arcpy.sa import * # Check out any necessary licenses arcpy.CheckOutExtension("spatial") # Input data source arcpy.env.workspace = "C:/py/07" arcpy.env.scratchWorkspace = "C:/py/07" arcpy.env.overwriteOutput = True ZoneData = "C:/py/FISHNET_4k_FeatureToPolygon.shp" # Output File OutputFolder = "C:/py/zonal" # Loop through a list of files in the workspace RasterFiles = arcpy.ListRasters() print RasterFiles print " " # Local variables: for filename in RasterFiles: print "Processing: {0}".format(filename) input_dir = arcpy.env.workspace inRaster1 = "C:/py/07/lai_0907_m" outRaster1 = os.path.join(OutputFolder,"z4_" + filename) # Process: Zonal Statistics saveRaster = arcpy.sa.ZonalStatistics(ZoneData, "ID", inRaster1, "MEAN", "DATA") saveRaster.save(outRaster1) print "done" but, it is only process one raster. I have, 01~12.raster. plz, help me.
... View more
05-14-2013
04:57 AM
|
0
|
2
|
4470
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|