<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: arcpy AddColormap issue in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564842#M44201</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because the script, if run standalone, has no concept of what a layer is, so you either have to add code that using the arcpy mapping module, to retrieve the layer from the mxd or get it from disk.&amp;nbsp; So sample code of what you are trying to do would help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Mar 2016 12:52:32 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2016-03-16T12:52:32Z</dc:date>
    <item>
      <title>arcpy AddColormap issue</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564841#M44200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In 10.3.1, when using arcpy.AddColormap_management in a script tool, the input must be passed from a Raster Dataset with a full path to the dataset, not from a Raster Layer in an ArcMap document! If passed from a Raster Layer, it results in "ERROR 000199: Failed to add Colormap".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2016 12:43:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564841#M44200</guid>
      <dc:creator>RandalGreene1</dc:creator>
      <dc:date>2016-03-16T12:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AddColormap issue</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564842#M44201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because the script, if run standalone, has no concept of what a layer is, so you either have to add code that using the arcpy mapping module, to retrieve the layer from the mxd or get it from disk.&amp;nbsp; So sample code of what you are trying to do would help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2016 12:52:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564842#M44201</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-03-16T12:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AddColormap issue</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564843#M44202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan for the quick reply. The issue only occurs when the script tool is being run inside ArcMap and I select a raster layer as the input. Here is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy

# Script arguments
Forest_tif = arcpy.GetParameterAsText(0)
# required arg - comment following in production
if Forest_tif == '#' or not Forest_tif:
&amp;nbsp;&amp;nbsp;&amp;nbsp; Forest_tif = "C:\\GIS\\KML\\publish\\oberniki\\Forest.tif" # provide a default value if unspecified

Forest_colour_tif = arcpy.GetParameterAsText(1)
# required arg - comment following in production
if Forest_colour_tif == '#' or not Forest_colour_tif:
&amp;nbsp;&amp;nbsp;&amp;nbsp; Forest_colour_tif = "C:\\GIS\\KML\\publish\\oberniki\\Forest_colour.tif" # provide a default value if unspecified

# Local variables (files in same path as toolbox/script)
Forest_tif_lyr = "Forest.tif.lyr"
Forest_tif_clr = "Forest.tif.clr"

# Set Geoprocessing environments
arcpy.env.outputCoordinateSystem = "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
arcpy.env.overwriteOutput = True

# Make Raster Layer
arcpy.MakeRasterLayer_management(Forest_tif, "temp_layer", "", "", "")

# Apply Symbology From Layer
arcpy.ApplySymbologyFromLayer_management("temp_layer", Forest_tif_lyr)

# Add Colormap
arcpy.AddColormap_management("temp_layer", "#", Forest_tif_clr)

# Copy Raster to generate RGB
arcpy.CopyRaster_management("temp_layer", Forest_colour_tif, "", "", "255", "NONE", "ColormapToRGB", "8_BIT_UNSIGNED", "NONE", "NONE")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:20:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564843#M44202</guid>
      <dc:creator>RandalGreene1</dc:creator>
      <dc:date>2021-12-12T00:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AddColormap issue</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564844#M44203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why don't you set a workspace line&amp;nbsp; to specify the folder where the layer files reside&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = .....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2016 13:07:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564844#M44203</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-03-16T13:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AddColormap issue</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564845#M44204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's a good idea, but it's not related to the problem. arcpy.AddColormap_management will still fail with the error above!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2016 13:16:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564845#M44204</guid>
      <dc:creator>RandalGreene1</dc:creator>
      <dc:date>2016-03-16T13:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AddColormap issue</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564846#M44205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if this is a layer file, it would work in arcmap because it is just a layer... but I just saw that your layer file has &lt;/P&gt;&lt;P&gt;Forest.tif.lyr two periods in it.&amp;nbsp; Can you confirm the actual filename and the name of the layer in arcmap.&amp;nbsp; and for extra measure specify the actual path to the layer file to check.&amp;nbsp; In all cases, print the layer name whether it is being read from the project or disk , particularly the latter to ensure paths are correct&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2016 13:21:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-addcolormap-issue/m-p/564846#M44205</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-03-16T13:21:40Z</dc:date>
    </item>
  </channel>
</rss>

