<?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 Add spatial reference to a raster in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518831#M40623</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;After transforming the Numpy array back to raster data, the spatial reference lost. I want to add my original spatial reference information back on the new generated raster. But the spatialReference of raster data property is read-only, how can I do it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wei&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 May 2011 18:55:07 GMT</pubDate>
    <dc:creator>jili</dc:creator>
    <dc:date>2011-05-16T18:55:07Z</dc:date>
    <item>
      <title>Add spatial reference to a raster</title>
      <link>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518831#M40623</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;After transforming the Numpy array back to raster data, the spatial reference lost. I want to add my original spatial reference information back on the new generated raster. But the spatialReference of raster data property is read-only, how can I do it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wei&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 May 2011 18:55:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518831#M40623</guid>
      <dc:creator>jili</dc:creator>
      <dc:date>2011-05-16T18:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Add spatial reference to a raster</title>
      <link>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518832#M40624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Start a new session of ArcMap and add the raster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Use the Define Projection Tool in ArcToolbox&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this procedure work?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 May 2011 20:44:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518832#M40624</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-05-16T20:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add spatial reference to a raster</title>
      <link>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518833#M40625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;assuming you are using python &amp;amp; the arcpy module.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;According to Dan you could use something like that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;desc = arcpy.Describe("original_raster")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SR = desc.spatialReference&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.DefineProjection_management("numpy_raster", SR)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AC&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2011 09:14:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518833#M40625</guid>
      <dc:creator>AlessandroCinnirella</dc:creator>
      <dc:date>2011-05-17T09:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Add spatial reference to a raster</title>
      <link>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518834#M40626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks guys, it works. I just want to try the import and export from Numpy array so that I can work on the image more. code is shown as below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import numpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;descData=arcpy.Describe('D:/arcpy test code/Geoprocessing/test.tif')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cellSize=descData.meanCellHeight&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;extent=descData.Extent&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;spatialReference=descData.spatialReference&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pnt=arcpy.Point(extent.XMin,extent.YMin)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;readRaster=arcpy.RasterToNumPyArray('D:/arcpy test code/Geoprocessing/test.tif')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;newRaster = arcpy.NumPyArrayToRaster(readRaster,pnt, cellSize,cellSize)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.DefineProjection_management(newRaster,spatialReference)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;newRaster.save("D:/arcpy test code/Geoprocessing/testRaster1")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2011 15:50:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518834#M40626</guid>
      <dc:creator>jili</dc:creator>
      <dc:date>2011-05-17T15:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Add spatial reference to a raster</title>
      <link>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518835#M40627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you guys for this discussion and for the concluding script.. this helped me a lot.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2011 20:24:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-spatial-reference-to-a-raster/m-p/518835#M40627</guid>
      <dc:creator>Atma_BharathiMani</dc:creator>
      <dc:date>2011-07-29T20:24:17Z</dc:date>
    </item>
  </channel>
</rss>

