Advertisement
maphew

poly2raster

Jun 1st, 2012
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. # ---------------------------------------------------------------------------
  2. # poly2raster.py
  3. # Created on: 2012-04-02 12:45:01.00000
  4. #   (generated by ArcGIS/ModelBuilder)
  5. # Description:
  6. # ---------------------------------------------------------------------------
  7. import arcpy
  8. from arcpy import env
  9.  
  10. # Local variables:
  11. Input_Features = arcpy.GetParameterAsText(0)
  12. out_wspace = arcpy.GetParameterAsText(1)
  13. cellsize = arcpy.GetParameterAsText(2)
  14.  
  15. Cell_assignment_type = "CELL_CENTER"
  16. Priority_field = "NONE"
  17.  
  18. # todo: get fields from input RulePoly attributes
  19. value_fields = "BOL BOH SUB ALP TAW TAS TUN".split()
  20.  
  21. env.workspace = out_wspace
  22.  
  23. try:
  24.     for vf in value_fields:
  25.         out_rast = '%s/value_%s' % (out_wspace, vf)
  26.         print "Running PolygonToRaster, output: %s" % out_rast
  27.         arcpy.PolygonToRaster_conversion(Input_Features, vf, out_rast,
  28.             Cell_assignment_type, Priority_field, cellsize)
  29.         print arcpy.GetMessages()
  30.  
  31. except Exception as e:
  32.     print e.message
  33.     arcpy.AddError(e.message)
  34.  
  35. print arcpy.GetMessages()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement