<?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: Add several raster files (ecw) from one folder, Symbology RGB in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387737#M30644</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that's perfect!&lt;/P&gt;&lt;P&gt;Thanks a lot! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Jun 2016 06:24:39 GMT</pubDate>
    <dc:creator>SilvanStöckli</dc:creator>
    <dc:date>2016-06-27T06:24:39Z</dc:date>
    <item>
      <title>Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387726#M30633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I'd like to add several raster files (format: .ecw) from one folder with several subfolders to my mxd-file. It works fine with the following code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;workspace = r"C:\Workspace"&amp;nbsp;&amp;nbsp; #Workspace
... 
... 
... #Code
... import arcpy, os
... 
... mxd = arcpy.mapping.MapDocument("CURRENT")
... df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
... 
... walk = arcpy.da.Walk(workspace)
... 
... for dirpath, dirnames, filenames in walk:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.AddLayer(df, arcpy.mapping.Layer(os.path.join(dirpath, filename)))&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Problem is, that after adding them like this, they appear with a symbology "stretched values along a color ramp" but they should be drawn as "RGB composite".&lt;/P&gt;&lt;P&gt;Can someone help me?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:48:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387726#M30633</guid>
      <dc:creator>SilvanStöckli</dc:creator>
      <dc:date>2021-12-11T17:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387727#M30634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can find nothing but read-only properties &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm"&gt;Layer—Help | ArcGIS for Desktop&lt;/A&gt; in the arcpy.mapping module.&amp;nbsp; I presume that is because histograms and band statistics are required for multiband rasters.&amp;nbsp; All other references to rasters and symbology refer to setting a raster's symbology to an existing layer file (lyr) which isn't going to work in your case&lt;/P&gt;&lt;P&gt;http:&amp;nbsp; //desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 12:44:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387727#M30634</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-16T12:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387728#M30635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;I can't open the Link. May you post it again?&lt;/P&gt;&lt;P&gt;Would that mean that there's a option I could set?&lt;/P&gt;&lt;P&gt;I don't mind setting the symbology afterwords but I couln't figure a way to do so.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 13:02:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387728#M30635</guid>
      <dc:creator>SilvanStöckli</dc:creator>
      <dc:date>2016-06-16T13:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387729#M30636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I copied the link as text above&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/2034"&gt;Timothy Hales&lt;/A&gt;​ check my link above... I just copied and pasted the url and this error keeps appearing. I have seen this before&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 13:54:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387729#M30636</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-16T13:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387730#M30637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I thought it may be the dash, but this URL works:&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/cursor.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/cursor.htm"&gt;http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/cursor.htm&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I noticed the URLs with two dashes do not:&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/styleitem-class.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/styleitem-class.htm"&gt;http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/styleitem-class.htm&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an open case with Jive Software to determine the issue. Thanks for letting me know!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 14:24:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387730#M30637</guid>
      <dc:creator>TimothyHales</dc:creator>
      <dc:date>2016-06-16T14:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387731#M30638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so does this mean that there's no solution for my problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jun 2016 07:48:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387731#M30638</guid>
      <dc:creator>SilvanStöckli</dc:creator>
      <dc:date>2016-06-17T07:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387732#M30639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you managed to get through to the link by a manual search on the topic, you would see that there is no arcpy access to that particular symbology probably because it is dependent on other things which may not exist.&amp;nbsp; The rest of the discussion was directed toward the failure of a direct link to the help files not working.&lt;/P&gt;&lt;P&gt;To return to your issue... can you set the symbology to what you want manually? is not, does pyramids/histograms help do it manually? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jun 2016 07:55:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387732#M30639</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-17T07:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387733#M30640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Silvan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you considered starting with a Raster Mosaic?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/mosaic.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/mosaic.htm"&gt;Mosaic—Data Management toolbox | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 18:28:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387733#M30640</guid>
      <dc:creator>andrewj_ca</dc:creator>
      <dc:date>2016-06-20T18:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387734#M30641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I can set the symbology manually. But I'll have to do so for about 100 Rasters, which really sucks. And I'll have to do it at least once a year.&lt;/P&gt;&lt;P&gt;I tried to use a Raster Catalog. But this enlarged the Data (from 8G to 130G) and was extremely slow.&lt;/P&gt;&lt;P&gt;I can't create a MosaicDataset because I run on basic licence.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2016 07:52:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387734#M30641</guid>
      <dc:creator>SilvanStöckli</dc:creator>
      <dc:date>2016-06-21T07:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387735#M30642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I solved it diffrently: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made a Batch-Script:&lt;/P&gt;&lt;P&gt;for /R C:/Path %%f in (*.ec*) do copy %%f C:/Path2/&lt;/P&gt;&lt;P&gt;So now I copy all the files from the folder with those many subfolders to one single folder.&lt;/P&gt;&lt;P&gt;It works fine. The only sad thing is that I now do have two folders with all those images... but still much better than doing all this manually...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone knows about an other method without copying the files, I would still be interested in the solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2016 14:44:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387735#M30642</guid>
      <dc:creator>SilvanStöckli</dc:creator>
      <dc:date>2016-06-21T14:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387736#M30643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got it to work by adding the ECWs, then updating the stretched layer using a template RGB .lyr file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os

workspace = r"C:\Temp\Test"&amp;nbsp; #Workspace 
rgb_lyr = arcpy.mapping.Layer(r"C:\Temp\rgb.lyr")

mxd = arcpy.mapping.MapDocument("CURRENT") 
df = mxd.activeDataFrame

walk = arcpy.da.Walk(workspace) 

for dirpath, dirnames, filenames in walk: 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames: 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print os.path.join(dirpath, filename)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = arcpy.mapping.Layer(os.path.join(dirpath, filename))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.AddLayer(df, lyr) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateLayer = arcpy.mapping.ListLayers(mxd, lyr.name, df)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.UpdateLayer(df, updateLayer, rgb_lyr)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also use replaceDatasource on the template layer:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os

workspace = r"C:\Temp\Test"&amp;nbsp;&amp;nbsp; #Workspace&amp;nbsp; 
rgb_lyr = r"C:\Temp\rgb.lyr"

mxd = arcpy.mapping.MapDocument("CURRENT")&amp;nbsp; 
df = mxd.activeDataFrame
&amp;nbsp; 
walk = arcpy.da.Walk(workspace)&amp;nbsp; 
&amp;nbsp; 
for dirpath, dirnames, filenames in walk:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = arcpy.mapping.Layer(rgb_lyr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.replaceDataSource (dirpath, 'RASTER_WORKSPACE', filename)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.name = filename
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.AddLayer(df, lyr)&amp;nbsp; 
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:48:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387736#M30643</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-12-11T17:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Add several raster files (ecw) from one folder, Symbology RGB</title>
      <link>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387737#M30644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that's perfect!&lt;/P&gt;&lt;P&gt;Thanks a lot! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jun 2016 06:24:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-several-raster-files-ecw-from-one-folder/m-p/387737#M30644</guid>
      <dc:creator>SilvanStöckli</dc:creator>
      <dc:date>2016-06-27T06:24:39Z</dc:date>
    </item>
  </channel>
</rss>

