Thursday, 24 March 2016

color - Programmatically changing raster symbology after reclassification using ArcPy


I have created a code in Python that I will use for a custom tool in ArcGIS, the code will create a Eucledian Distance of 6000m around a point and Reclassify the distance from 0-2000, 2000-4000, 4000-6000. The code works but what I was wondering was, is there a bit of code I can add on to make the 0-2000 area red, the 2000-4000 area to be orange and the 4000-6000 area to be yellow. As the code stands the colours are random i guess (blue, green etc.). I have been looking through a few books but could not find a solution.


from arcpy import env
from arcpy.sa import *

# Set environment settings

arcpy.env.workspace = "Z:\\GIS TEST\\Select_by_Location"
arcpy.env.overwriteOutput=1

# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")


# Local variables:
Breakout_Location = "Breakout_Location.shp"
maxDistance = "6000"

Output_direction_raster = "Z:\\GIS TEST\\Codes\\Output"

# Set Extents
arcpy.env.extent = arcpy.Extent(31652.290929,28102.389486,269652.513962,212966.447186)

if arcpy.Exists(Output_direction_raster):
arcpy.Delete_management(Output_direction_raster)
Euc_Dist1=EucDistance(Breakout_Location, 6000, 400, Output_direction_raster)



# Process: Reclassify
Reclass_Output_direction_raster = Reclassify(Euc_Dist1, "Value", RemapRange([[0,2000,1],[2000,4000,2],[4000,6000,3]]), "DATA")

arcpy.SetParameterAsText(0, Breakout_Location)


Reclass_Output_direction_raster.save("Z:\\GIS TEST\\Codes\\Output")


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...