<?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: Reprojecting Rasters Issue in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278221#M21475</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;"raster" and "outraster" are variables not string names, so remove the quotes and try that.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Aug 2011 14:32:33 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2011-08-09T14:32:33Z</dc:date>
    <item>
      <title>Reprojecting Rasters Issue</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278220#M21474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am new to python and attempting to set up a batch process to reproject rasters in a folder.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the script and error message I am getting.&amp;nbsp; I defined the projection of the rasters in the folder to WGS 1984 UTM Zone 16N before starting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... arcpy.env.workspace = r"C:/GIS/NDVI/Georef_27_21_TIFFs/test" &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... rasterList = arcpy.ListRasters("*", "All")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... for raster in rasterList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... outraster = raster+"_ontlambproj"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... arcpy.ProjectRaster_management("raster", "outraster", "MNR_LAMBERT_PROJECTION_3161.prj", "NEAREST", "30", "WGS_1984_(ITRF00)_To_NAD_1983", "#", r"C:/Program Files/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/Northern Hemisphere/WGS 1984 UTM Zone 16N.prj")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;L5027021_02119850802_B30.TIF&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LT5027021008516650_B3.tif&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: Undefined coordinate system for input dataset. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone help me determine why I am getting this error?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Erica&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 14:19:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278220#M21474</guid>
      <dc:creator>EricaNewton</dc:creator>
      <dc:date>2011-08-09T14:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting Rasters Issue</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278221#M21475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;"raster" and "outraster" are variables not string names, so remove the quotes and try that.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 14:32:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278221#M21475</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2011-08-09T14:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting Rasters Issue</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278222#M21476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;THANK YOU!!!&amp;nbsp; I thought it must have been a simple solution, but being very new to this,&amp;nbsp; I have been working on it for days.&amp;nbsp; I'm still having a problem with the file name (it renames the files as originalfilename.tif_olp.tif - need to fix that to originalfilename_olp.tif but I think I can figure that out - here is the final script that properly reprojects the tif.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;... import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... arcpy.env.workspace = r"C:/GIS/NDVI/Georef_27_21_TIFFs/test"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... rasterList = arcpy.ListRasters("*", "All")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... for raster in rasterList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... outraster = raster+"_olp.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... arcpy.ProjectRaster_management(raster, outraster, "MNR_LAMBERT_PROJECTION_3161.prj", "NEAREST", "30", "WGS_1984_(ITRF00)_To_NAD_1983", "#", r"C:/Program Files/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/Northern Hemisphere/WGS 1984 UTM Zone 16N.prj")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;L5027021_02119850802_B30.TIF&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LT5027021008516650_B3.tif&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 15:01:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278222#M21476</guid>
      <dc:creator>EricaNewton</dc:creator>
      <dc:date>2011-08-09T15:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting Rasters Issue</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278223#M21477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes that is just simple string manipulation, since raster = "originalfilename.tif" when you do outraster = raster+"_olp.tif" you get the logical originalfilename.tif_olp.tif&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are a couple ways to solve that issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;raster = raster.rpartition(".")[0]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 15:10:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278223#M21477</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2011-08-09T15:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting Rasters Issue</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278224#M21478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can also use this to get the base name of a raster without its extension like this.&amp;nbsp; Both options will work.&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;desc = arcpy.Describe(raster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;name = desc.baseName&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jamie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 15:24:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278224#M21478</guid>
      <dc:creator>JamieDrisdelle</dc:creator>
      <dc:date>2011-08-09T15:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting Rasters Issue</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278225#M21479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Perfect.&amp;nbsp; Thanks to both of you very much.&amp;nbsp; Now I can keep going !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Erica&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 15:33:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278225#M21479</guid>
      <dc:creator>EricaNewton</dc:creator>
      <dc:date>2011-08-09T15:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting Rasters Issue</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278226#M21480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There is one final tweak that I can't seem to figure out with this script.&amp;nbsp; Both of the following only return one reprojected file, not both that are in the "test" folder.&amp;nbsp; Any ideas on how to get it to process both .tif files?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = r"C:/GIS/NDVI/Georef_27_21_TIFFs/test"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rasters = arcpy.ListRasters("*", "All")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for raster in rasters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outraster = raster.rpartition(".")[0]+"_olp.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ProjectRaster_management(raster, outraster, "MNR_LAMBERT_PROJECTION_3161.prj", "NEAREST", "30", "WGS_1984_(ITRF00)_To_NAD_1983", "#", r"C:/Program Files/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/Northern Hemisphere/WGS 1984 UTM Zone 16N.prj")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = r"C:/GIS/NDVI/Georef_27_21_TIFFs/test"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rasters = arcpy.ListRasters("*", "TIF")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for raster in rasters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outraster = raster.rpartition(".")[0]+"_olp.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ProjectRaster_management(raster, outraster, "MNR_LAMBERT_PROJECTION_3161.prj", "NEAREST", "30", "WGS_1984_(ITRF00)_To_NAD_1983", "#", r"C:/Program Files/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/Northern Hemisphere/WGS 1984 UTM Zone 16N.prj")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 23:45:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278226#M21480</guid>
      <dc:creator>EricaNewton</dc:creator>
      <dc:date>2011-08-09T23:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting Rasters Issue</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278227#M21481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, the first script only has one indent for "print raster"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second script is indented at "print raster" and all following lines.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2011 01:01:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278227#M21481</guid>
      <dc:creator>EricaNewton</dc:creator>
      <dc:date>2011-08-10T01:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting Rasters Issue</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278228#M21482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wrapping your code in [ CODE][/CODE ] tags lets you preserve your formatting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As to the question, do both Rasters have unique names? Same coordinate systems? When you list the rasters do both come up? The syntax for limiting the list by .tif images is "TIFF" I believe.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2011 15:16:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278228#M21482</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2011-08-10T15:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting Rasters Issue</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278229#M21483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

[HTML]

Apparently I just wasn't waiting long enough.&amp;nbsp; The second code (below) works for both. 

import arcpy
arcpy.env.workspace = r"C:/GIS/NDVI/Georef_27_21_TIFFs/test"
rasters = arcpy.ListRasters("*", "TIF")
for raster in rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster
&amp;nbsp;&amp;nbsp;&amp;nbsp; outraster = raster.rpartition(".")[0]+"_olp.tif"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ProjectRaster_management(raster, outraster, "MNR_LAMBERT_PROJECTION_3161.prj", "NEAREST", "30", "WGS_1984_(ITRF00)_To_NAD_1983", "#", r"C:/Program Files/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/Northern Hemisphere/WGS 1984 UTM Zone 16N.prj")

[/HTML]

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:33:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-rasters-issue/m-p/278229#M21483</guid>
      <dc:creator>EricaNewton</dc:creator>
      <dc:date>2021-12-11T13:33:09Z</dc:date>
    </item>
  </channel>
</rss>

