<?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: Mosaic to new raster in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113803#M8912</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Leo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To add to what Jeff said, you mention three different terms - "mosaic" tool, "&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000098000000" rel="nofollow" style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #287433;" target="_blank"&gt;Mosaic to New Raster&lt;/A&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;tool" and "mosaic dataset".&amp;nbsp; I am guessing the last one you simply meant "a dataset on disk that is a mosaic" but I want to be sure you are aware of the &lt;STRONG&gt;Mosaic Dataset&lt;/STRONG&gt; which is a specific data structure in ArcGIS.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;If you're not familiar with it, I'd encourage you to look at its capabilities - if you just use one of the above tools to create a permanent mosaic on disk, you may find you want more control over the seamline placement, color correction, etc. whereas the &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Mosaic Dataset is a virtual mosaic that gives you control over all of that, plus the ability to work with pixels from any scene in the overlap regions, and the source data can be in different projections.&amp;nbsp; (Just a few of &lt;EM&gt;MANY&lt;/EM&gt; other features)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Building a &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Mosaic Dataset is extremely fast - just a data structure with pointers to the data - no data is copied, reformatted, etc. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Once you build a Mosaic Dataset, if you want to Export a fixed raster to disk, that's an option if desired.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I hope that is helpful, although I am suggesting you change your approach - If you need to proceed as planned please clarify what is not working, and we can have a developer look at your code (I'm not any help with that)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Cody B.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Oct 2014 16:01:46 GMT</pubDate>
    <dc:creator>CodyBenkelman</dc:creator>
    <dc:date>2014-10-17T16:01:46Z</dc:date>
    <item>
      <title>Mosaic to new raster</title>
      <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113801#M8910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ALL,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to mosaic a set of rasters in separate folders but I am stuck with my code. Basically, I have two sets of modis tiles located in two separate folders, and I want to create a mosaic dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Folder 1 = mod_h26v06_2012001.tif, mod_h26v06_2012009.tif, mod_h26v06_2012017.tif, mod_h26v06_2012025.tif,......., mod_h26v06_2012361.tif&lt;/P&gt;&lt;P&gt;Folder 2 = mod_h27v06_2012001.tif, mod_h27v06_2012009.tif, mod_h27v06_2012017.tif, mod_h27v06_2012025.tif,......., mod_h27v06_2012361.tif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;mod_h26v06_2012001.tif&lt;/STRONG&gt; &lt;EM&gt;merge with&lt;/EM&gt; &lt;STRONG&gt;mod_h27v06_2012001.tif&lt;/STRONG&gt;, ........, &lt;STRONG&gt;mod_h26v06_2012361.tif&lt;/STRONG&gt; &lt;EM&gt;merge with&lt;/EM&gt; &lt;STRONG&gt;mod_h27v06_2012361.tif&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my initial code:&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14135375221866791" jivemacro_uid="_14135375221866791" modifiedtitle="true"&gt;
&lt;P&gt;# import necessary modules of ArcGIS&lt;/P&gt;
&lt;P&gt;import arcpy, os, sys&lt;/P&gt;
&lt;P&gt;from arcpy import env&lt;/P&gt;
&lt;P&gt;from arcpy.sa import *&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# this will overwrite output. Important in testing codes&lt;/P&gt;
&lt;P&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# activate the spatial analyst extention of ArcGIS&lt;/P&gt;
&lt;P&gt;arcpy.CheckOutExtension("Spatial")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# specify your workspace. This is where raster is stored&lt;/P&gt;
&lt;P&gt;raster1 = 'X:/raster_ws'&lt;/P&gt;
&lt;P&gt;arcpy.env.workspace = raster1&lt;/P&gt;
&lt;P&gt;h26v06 = [os.path.join(raster1, l) for l in arcpy.ListRasters("*2012*", "TIF")]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;raster2 = 'X:/raster_ws'&lt;/P&gt;
&lt;P&gt;arcpy.env.workspace = raster2&lt;/P&gt;
&lt;P&gt;h27v06 = [os.path.join(raster2, r) for r in arcpy.ListRasters("*2012*", "TIF")]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;out_ws = 'X:/output_ws/'&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# (input rasters,outputloc,name w/ ext, coor, pixeltype, cellsize, #of bands&lt;/P&gt;
&lt;P&gt;# mosaic method, mosaic color map)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;for h in range(0,46):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; parse = l[18:25]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = "modis_evi_" + parse + ".tif" #'modis_8day_2012_{:03d}.tif'.format(h+1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mosaic = arcpy.Mosaic_management(Raster(h26v06&lt;H&gt;);Raster(h27v06&lt;H&gt;), out_ws, filename, "", "16_BIT_SIGNED", "", "1", "LAST","FIRST")&lt;/H&gt;&lt;/H&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print mosaic&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;-Leo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 09:23:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113801#M8910</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2014-10-17T09:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Mosaic to new raster</title>
      <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113802#M8911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So are you encountering an error? Or what his happening.&amp;nbsp; On first look, all I see is that you are using the 'Mosaic' tool rather than the '&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000098000000"&gt;Mosaic to New Raster&lt;/A&gt;' tool?&amp;nbsp; If as your title says you are looking for a new raster, then use the second tool.&amp;nbsp; Unless you are going to create a new raster prior to using the mosaic tool.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 12:52:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113802#M8911</guid>
      <dc:creator>JeffreySwain</dc:creator>
      <dc:date>2014-10-17T12:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Mosaic to new raster</title>
      <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113803#M8912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Leo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To add to what Jeff said, you mention three different terms - "mosaic" tool, "&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000098000000" rel="nofollow" style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #287433;" target="_blank"&gt;Mosaic to New Raster&lt;/A&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;tool" and "mosaic dataset".&amp;nbsp; I am guessing the last one you simply meant "a dataset on disk that is a mosaic" but I want to be sure you are aware of the &lt;STRONG&gt;Mosaic Dataset&lt;/STRONG&gt; which is a specific data structure in ArcGIS.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;If you're not familiar with it, I'd encourage you to look at its capabilities - if you just use one of the above tools to create a permanent mosaic on disk, you may find you want more control over the seamline placement, color correction, etc. whereas the &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Mosaic Dataset is a virtual mosaic that gives you control over all of that, plus the ability to work with pixels from any scene in the overlap regions, and the source data can be in different projections.&amp;nbsp; (Just a few of &lt;EM&gt;MANY&lt;/EM&gt; other features)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Building a &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Mosaic Dataset is extremely fast - just a data structure with pointers to the data - no data is copied, reformatted, etc. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Once you build a Mosaic Dataset, if you want to Export a fixed raster to disk, that's an option if desired.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I hope that is helpful, although I am suggesting you change your approach - If you need to proceed as planned please clarify what is not working, and we can have a developer look at your code (I'm not any help with that)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Cody B.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 16:01:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113803#M8912</guid>
      <dc:creator>CodyBenkelman</dc:creator>
      <dc:date>2014-10-17T16:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Mosaic to new raster</title>
      <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113804#M8913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeffrey and Codey, thanks for your reply and sorry for the delayed response and confusion on my inquiry. What I really want to use is the &lt;STRONG&gt;mosaic to new raster&lt;/STRONG&gt; in arcpy -- Mosaics multiple raster datasets into a new raster dataset. I tried several codes and must have mistakenly copy and paste the latest code that I am using. Orignally this is the tool that I am trying to run:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14137013024412550 jive_text_macro" jivemacro_uid="_14137013024412550" modifiedtitle="true"&gt;
&lt;P&gt;arcpy.MosaicToNewRaster_management(Raster(h26v06&lt;H&gt;);Raster(h27v06&lt;H&gt;), out_ws, filename, "&lt;SPAN class="string"&gt;", "&lt;SPAN class="number"&gt;16_BIT_SIGNED&lt;/SPAN&gt;&lt;SPAN class="string"&gt;", "&lt;/SPAN&gt;&lt;SPAN class="string"&gt;", "&lt;/SPAN&gt;&lt;SPAN class="number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="string"&gt;", "&lt;/SPAN&gt;LAST&lt;SPAN class="string"&gt;","&lt;/SPAN&gt;FIRST"&lt;/SPAN&gt;)&lt;/H&gt;&lt;/H&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get an error while running this code. I cannot determine right now the exact error (error code) that I am getting (since I am running it in my office laptop), but if I can remember correctly, the error message is pointing me on the arguments that I put in the MosaicToNewRaster_management. I am suspecting that it has something to do with my first argument &lt;SPAN style="font-family: courier new,courier;"&gt;Raster(h26v06&lt;H&gt;);Raster(h27v06&lt;H&gt;)&lt;/H&gt;&lt;/H&gt;&lt;/SPAN&gt;. In this loop I am using the range function, that is why I am casting out the raster (Raster()) for each step, and referring it to the rasterlist that I created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help and suggestion is very much appreciated,&lt;/P&gt;&lt;P&gt;-Leo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Oct 2014 07:04:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113804#M8913</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2014-10-19T07:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Mosaic to new raster</title>
      <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113805#M8914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The argument (list of rasters) is indeed incorrect. If you look at the help page, at the bottom there is a python sample. The list of raster is actually a string and each raster is separated by a semicolon. Be aware that the name of each raster should include the workspace in case the rasters do no reside in the current workspace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is actually more. I noticed that first and second list will actually contain the same information, since they point to the same folder. So you have to check that too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are sure that there are as many h26 as h27 tiffs and the structure of the name is the same. You can create a list for the h26 rasters and derive the h27 name from it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Oct 2014 23:38:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113805#M8914</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-10-19T23:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Mosaic to new raster</title>
      <link>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113806#M8915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When dealing with lists like this, I usually try printing out the list to see if it is what you think it is.&amp;nbsp; To piggy back to what Xander said, consider those help docs, but also I have found printing them out, copying them and they trying to run them in the Py Window seems to help me determine the proper syntax.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 12:39:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/mosaic-to-new-raster/m-p/113806#M8915</guid>
      <dc:creator>JeffreySwain</dc:creator>
      <dc:date>2014-10-20T12:39:24Z</dc:date>
    </item>
  </channel>
</rss>

