<?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: ERROR 000628: Cannot set input into parameter coordinate_system_for_the_raster in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546365#M42609</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is that the coordinate system you want or the coordinate system of the data?&amp;nbsp; If it is the former, it won't work.&amp;nbsp; You need to project your data into the coordinate system you want before mosaicing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 May 2015 08:37:16 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2015-05-22T08:37:16Z</dc:date>
    <item>
      <title>ERROR 000628: Cannot set input into parameter coordinate_system_for_the_raster</title>
      <link>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546364#M42608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;I am trying to batch mosaic rasters using arcpy.MosaicToNewRaster_management in arcpy:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;SPAN class="kwd" style="color: #8a4a0b;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#This is for mosaicking rasters
import arcpy
from arcpy import env

#Set the current workspace and other env 't variables
env.workspace = r"C:\thesis\for_sampling\sampling_outputs\new_loss"
env.nodata = "MINIMUM"
env.compression = "LZ77"

projection = arcpy.SpatialReference(4326) 

coordinate_system =&amp;nbsp; projection

list_all_rasters = ["newlossGreater_Luzonforests_onlyloss_20N_120E.tif;newlossGreater_Luzonforests_onlyloss_30N_120E.tif;\
&amp;nbsp;&amp;nbsp;&amp;nbsp; newlossGreater_Luzonforests_onlyloss_20N_110E.tif","newlossGreater_Palawanforests_onlyloss_20N_120E.tif;\
&amp;nbsp;&amp;nbsp;&amp;nbsp; newlossGreater_Palawanforests_onlyloss_10N_110E.tif;\newlossGreater_Palawanforests_onlyloss_20N_110E.tif",\
&amp;nbsp;&amp;nbsp;&amp;nbsp; "newlossGreater_Negros_Panayforests_onlyloss_10N_120E.tif;newlossGreater_Negros_Panayforests_onlyloss_10N_110E.tif",\
&amp;nbsp;&amp;nbsp;&amp;nbsp; "newlossGreater_Mindanaoforests_onlyloss_10N_120E.tif;newlossGreater_Mindanaoforests_onlyloss_10N_110E.tif;\
&amp;nbsp;&amp;nbsp;&amp;nbsp; newlossGreater_Mindanaoforests_onlyloss_20N_110E.tif"]

for raster in&amp;nbsp; range(0,4):
&amp;nbsp;&amp;nbsp;&amp;nbsp; output_list = ["Luzon_loss.tif","Palawan_losss.tif","Negros_Panay_loss.tif","Mindanao_loss.tif"]
&amp;nbsp;&amp;nbsp;&amp;nbsp; env.workspace = r"C:\thesis\for_sampling\sampling_outputs\new_loss"
&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster # checking the list
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MosaicToNewRaster_management(list_all_rasters[raster], r"C:\thesis\for_sampling\sampling_outputs" , output_list[raster], 1, coordinate_system)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster+ " is ok!" 


print "Finish all of them!"
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I always get this error:&lt;/P&gt;&lt;P&gt;ExecuteError: ERROR 000622: Failed to execute (Mosaic To New Raster). Parameters are not valid.&lt;/P&gt;&lt;P&gt;ERROR 000628: Cannot set input into parameter coordinate_system_for_the_raster.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:38:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546364#M42608</guid>
      <dc:creator>RobertBeno</dc:creator>
      <dc:date>2021-12-11T23:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000628: Cannot set input into parameter coordinate_system_for_the_raster</title>
      <link>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546365#M42609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is that the coordinate system you want or the coordinate system of the data?&amp;nbsp; If it is the former, it won't work.&amp;nbsp; You need to project your data into the coordinate system you want before mosaicing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 May 2015 08:37:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546365#M42609</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-05-22T08:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000628: Cannot set input into parameter coordinate_system_for_the_raster</title>
      <link>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546366#M42610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert,&lt;/P&gt;&lt;P&gt;One issue I can see is that the list_all_raster variable is having issues with the formatting and the continuation lines (and you have a \new.. in the middle and a few too many ").&amp;nbsp; I'm sure that a half dozen others on this forum will be able to write this code in a cleaner way, but since so much of the long tif file name is the same, you can get the variable set with a simple loop.&amp;nbsp; If you copy and past this in your code, make sure to check that the forest names and the N and E values pairs are set correctly....and my spelling is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once the variable is set correctly, try you process again to see if there is another issue.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;theList = [["Luzon","20N_120E"], ["Luzon","30N_120E"], ["Luzon","20N_110E"], \
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ["Palawan","20N_120E"], ["Palawan","10N_110E"], ["Palawan","20N_110E"], \
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ["Negros_Panay","10N_120E"], ["Negros_Panay","10N_110E"], \
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ["_Mindanao","10N_120E"], ["_Mindanao","10N_110E"], ["_Mindanao","20N_110E"]]
cnt = 0
for tif in theList:
&amp;nbsp; if cnt == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list_all_rasters = "(newlossGreater_" + tif[0] + "forests_onlyloss_" + tif[1] + ".tif"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt += 1
&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list_all_rasters = list_all_rasters + "; newlossGreater_" + tif[0] + "forests_onlyloss_" + tif[1]&amp;nbsp; + ".tif"
list_all_rasters = list_all_rasters + ")"
print list_all_rasters&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The cnt == 0 is to make sure the ( with no ; at the front.&amp;nbsp; That way each of the following tifs in the list start with the ;&lt;/P&gt;&lt;P&gt;Once you exit the for statement, I add the closing ")"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need the full variable wrapped in quotes for the input, you may need to do some slight adjustments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This may not fix the problem completely, but first things first.&amp;nbsp; Good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:39:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546366#M42610</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2021-12-11T23:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000628: Cannot set input into parameter coordinate_system_for_the_raster</title>
      <link>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546367#M42611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error seems to indicate that the syntax used for the parameter is invalid for the parameter type. Looking at the help for setting spatial reference (&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v000000p6000000" title="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v000000p6000000"&gt;ArcGIS Desktop&lt;/A&gt;), the syntax is supposed to be like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Create a spatial reference object using a factory code&lt;/P&gt;&lt;P&gt;#&lt;/P&gt;&lt;P&gt;sr = arcpy.SpatialReference()&lt;/P&gt;&lt;P&gt;sr.factoryCode = 3857&lt;/P&gt;&lt;P&gt;sr.create()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 May 2015 04:17:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546367#M42611</guid>
      <dc:creator>SepheFox</dc:creator>
      <dc:date>2015-05-23T04:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000628: Cannot set input into parameter coordinate_system_for_the_raster</title>
      <link>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546368#M42612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually I think what he has is ok (I think that's how I usually do it), although I would use the variable name sr like you have, and there is no need to reassign it to a new variable.&amp;nbsp; &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018z0000000v000000" title="http://resources.arcgis.com/en/help/main/10.2/index.html#//018z0000000v000000"&gt;ArcGIS Help (10.2, 10.2.1, and 10.2.2)&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My guess is the spatial reference error is coming up because the first argument he is using list_all_rasters, is invalid based on how he was creating it.&amp;nbsp; If he uses my code, or a cleaner version when someone else rewrites is, I think he could then just use " list_all_rasters" as the first argument (and not "list_all_rasters[rasters]").&amp;nbsp; There still might be an issues with the spatial reference s you mention, but I don't have a chunk of data handy to test it with right now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 May 2015 04:42:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000628-cannot-set-input-into-parameter/m-p/546368#M42612</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2015-05-23T04:42:20Z</dc:date>
    </item>
  </channel>
</rss>

