<?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: Adding All Raster Layer with the Same Name format in ArcMap in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796499#M219</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan&amp;nbsp;for your reply. I think it will return to a list. Can I import the rasters by iterating&amp;nbsp;through the list? For example, if I get a list of list = [raster1.tif, raster2.tif, raster3.tif], can do the following -&lt;/P&gt;&lt;P&gt;for i in list:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;some_function(i)&lt;/P&gt;&lt;P&gt;All of those layers will be imported to ArcMap automatically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jun 2018 21:34:39 GMT</pubDate>
    <dc:creator>Sourav_Abdullah</dc:creator>
    <dc:date>2018-06-06T21:34:39Z</dc:date>
    <item>
      <title>Adding All Raster Layer with the Same Name format in ArcMap</title>
      <link>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796497#M217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;In a folder, I have 150+ raster files - some of them are&amp;nbsp;&lt;/SPAN&gt;pansharpened&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;images, some are panchromatic images, and some are in other formats. Among them,&amp;nbsp;30+&amp;nbsp;&lt;/SPAN&gt;pansharpened&amp;nbsp;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;raster&lt;/SPAN&gt; has&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;the same naming format of date_ZoneName_pansharpened.tif&amp;nbsp; (e.g. 20180511_TX1_pansharpened.tif,&amp;nbsp; 20180511_TX2_pansharpened.tif,&amp;nbsp; 20180511_TX2_pansharpened.tif and etc.). Now, I am adding them to ArcMap one by one with “Add data” menu. It’s time-consuming and not efficient. Is there any way of running a python script that goes through the folder and looks for any files with “_pansharpened.tif” in its name and imports it automatically to&amp;nbsp;ArcMap? &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 20:24:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796497#M217</guid>
      <dc:creator>Sourav_Abdullah</dc:creator>
      <dc:date>2018-06-06T20:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Adding All Raster Layer with the Same Name format in ArcMap</title>
      <link>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796498#M218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you give arcpy.ListRasters a try?&amp;nbsp;&lt;A href="http://pro.arcgis.com/en/pro-app/arcpy/functions/listrasters.htm"&gt;http://pro.arcgis.com/en/pro-app/arcpy/functions/listrasters.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;you can specify a wildcard, presumably with your desired partial file name&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 21:20:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796498#M218</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-06T21:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding All Raster Layer with the Same Name format in ArcMap</title>
      <link>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796499#M219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan&amp;nbsp;for your reply. I think it will return to a list. Can I import the rasters by iterating&amp;nbsp;through the list? For example, if I get a list of list = [raster1.tif, raster2.tif, raster3.tif], can do the following -&lt;/P&gt;&lt;P&gt;for i in list:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;some_function(i)&lt;/P&gt;&lt;P&gt;All of those layers will be imported to ArcMap automatically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 21:34:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796499#M219</guid>
      <dc:creator>Sourav_Abdullah</dc:creator>
      <dc:date>2018-06-06T21:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding All Raster Layer with the Same Name format in ArcMap</title>
      <link>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796500#M220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suppose using Make Raster Layer&amp;nbsp;&lt;A href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-raster-layer.htm"&gt;http://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-raster-layer.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;but someone may suggest making a mosaic dataset instead. &amp;nbsp;&lt;/P&gt;&lt;P&gt;I am just not sure the advantage of spending time doing the coding rather than sorting the rasters in catalog and dragging the lot over at once.&amp;nbsp; Or do you have to do this hundreds of times?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 21:37:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796500#M220</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-06T21:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Adding All Raster Layer with the Same Name format in ArcMap</title>
      <link>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796501#M221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have 7 different fields, each field with 15-30 rasters. In addition,&amp;nbsp; I get one set of new rasters each week, thus importing 100-150 rasters/week for next couples of months is really a boring task.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 21:42:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796501#M221</guid>
      <dc:creator>Sourav_Abdullah</dc:creator>
      <dc:date>2018-06-06T21:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adding All Raster Layer with the Same Name format in ArcMap</title>
      <link>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796502#M222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using the following code, I am getting the list you wrote about. Just need to find a way to import them all.&lt;/P&gt;&lt;P&gt;from os import *&lt;/P&gt;&lt;P&gt;path = 'E:/Yield Program/Texas Section 1/01/20180601_202233_ssc8d2_0011'&lt;BR /&gt;text_files = [f for f in listdir(path) if f.endswith('pansharpened.tif')]&lt;BR /&gt;print (text_files)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 21:51:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/adding-all-raster-layer-with-the-same-name-format/m-p/796502#M222</guid>
      <dc:creator>Sourav_Abdullah</dc:creator>
      <dc:date>2018-06-06T21:51:42Z</dc:date>
    </item>
  </channel>
</rss>

