<?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 Python script coordinates system problem in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-script-coordinates-system-problem/m-p/312934#M24333</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wrote the following python script and I ran it one time and all works perfectly. Then I changed the name of the output folder in order to create an other surface for and other discharge. At the end all the output files are correct excepted the output file of the SetNull function. This file is created with no coordinates system and the value of the raster are "consequently" wrong. I tried several time to rewrite the script but I still have the same problem. I do not understand why the coordinates system is not set up in this only file when all the other output files are correct. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Could someone help me ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thibault&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy.sa import *&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set environment settings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;env.workspace = "C:/Users/Teabox/Documents/ArcGIS/MasterThesis" #Set your environment file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.outputCoordinateSystem = "D:/Programmes/ArcGisDesktop10/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/Northern Hemisphere/WGS 1984 UTM Zone 32N.prj"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.cellSize = "C:/Users/Teabox/Documents/ArcGIS/MasterThesis/lundes_raster"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set local variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;inPntFeat = "EndPoints.shp" #Set the name of the input file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;zField = "elevation" #Set the name of the interpolate field &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cellSize = arcpy.env.cellSize = "C:/Users/Teabox/Documents/ArcGIS/MasterThesis/lundes_raster"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;splineType = "REGULARIZED"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;weight = 0.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Check out the ArcGIS Spatial Analyst extension license&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CheckOutExtension("Spatial")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Execute Spline"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Execute Spline&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outSpline = Spline(inPntFeat, zField, cellSize, splineType, weight)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Save the output &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outSpline.save("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/LowWaterL")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Execute Raster Calculator"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#Evaluate the difference between the interpolated water surface and the digital elevation model of the river bed&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#The difference gives the areas covered by water as positive number and the rest as negative numbers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outRas = Raster("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/LowWaterL") - Raster("lundes_raster")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outRas.save("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/output_raster")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Final step to display only the values above zero to create a final layer showing only the area covered by water. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outSetNull = SetNull("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/output_raster", "C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/output_raster", "VALUE &amp;lt; 0")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outSetNull.save("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/area.img")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Reclassify water level layer"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Reclassify the water level layer in order to run the ZonalGeometry tools.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# This Zonal tools works only on integer raster.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Waterlevel = "C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/area.img"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outReclassWL = Reclassify( Waterlevel, "Value", RemapRange([[0,1,1], [1,3,1]]), "NODATA")&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outReclassWL.save("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/ReclassWL")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Run the ZonalGeometry tool"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#ZonalGeometry tool&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set local variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;inZoneData = ("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/ReclassWL")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;zoneField = "Value"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Execute ZonalStatistics&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outZonalGeometry = ZonalGeometry(inZoneData, zoneField, "AREA", cellSize)&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Save the output &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outZonalGeometry.save("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/zonegeo")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Extract the value of the water area&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;WaterArea = arcpy.GetRasterProperties_management("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/zonegeo", "MAXIMUM")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Total water surface in m²"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print WaterArea&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "End"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jun 2011 12:59:49 GMT</pubDate>
    <dc:creator>ThibaultBoissy</dc:creator>
    <dc:date>2011-06-24T12:59:49Z</dc:date>
    <item>
      <title>Python script coordinates system problem</title>
      <link>https://community.esri.com/t5/python-questions/python-script-coordinates-system-problem/m-p/312934#M24333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wrote the following python script and I ran it one time and all works perfectly. Then I changed the name of the output folder in order to create an other surface for and other discharge. At the end all the output files are correct excepted the output file of the SetNull function. This file is created with no coordinates system and the value of the raster are "consequently" wrong. I tried several time to rewrite the script but I still have the same problem. I do not understand why the coordinates system is not set up in this only file when all the other output files are correct. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Could someone help me ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thibault&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy.sa import *&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set environment settings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;env.workspace = "C:/Users/Teabox/Documents/ArcGIS/MasterThesis" #Set your environment file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.outputCoordinateSystem = "D:/Programmes/ArcGisDesktop10/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/Northern Hemisphere/WGS 1984 UTM Zone 32N.prj"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.cellSize = "C:/Users/Teabox/Documents/ArcGIS/MasterThesis/lundes_raster"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set local variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;inPntFeat = "EndPoints.shp" #Set the name of the input file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;zField = "elevation" #Set the name of the interpolate field &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cellSize = arcpy.env.cellSize = "C:/Users/Teabox/Documents/ArcGIS/MasterThesis/lundes_raster"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;splineType = "REGULARIZED"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;weight = 0.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Check out the ArcGIS Spatial Analyst extension license&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CheckOutExtension("Spatial")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Execute Spline"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Execute Spline&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outSpline = Spline(inPntFeat, zField, cellSize, splineType, weight)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Save the output &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outSpline.save("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/LowWaterL")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Execute Raster Calculator"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#Evaluate the difference between the interpolated water surface and the digital elevation model of the river bed&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#The difference gives the areas covered by water as positive number and the rest as negative numbers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outRas = Raster("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/LowWaterL") - Raster("lundes_raster")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outRas.save("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/output_raster")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Final step to display only the values above zero to create a final layer showing only the area covered by water. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outSetNull = SetNull("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/output_raster", "C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/output_raster", "VALUE &amp;lt; 0")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outSetNull.save("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/area.img")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Reclassify water level layer"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Reclassify the water level layer in order to run the ZonalGeometry tools.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# This Zonal tools works only on integer raster.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Waterlevel = "C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/area.img"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outReclassWL = Reclassify( Waterlevel, "Value", RemapRange([[0,1,1], [1,3,1]]), "NODATA")&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outReclassWL.save("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/ReclassWL")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Run the ZonalGeometry tool"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#ZonalGeometry tool&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set local variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;inZoneData = ("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/ReclassWL")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;zoneField = "Value"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Execute ZonalStatistics&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outZonalGeometry = ZonalGeometry(inZoneData, zoneField, "AREA", cellSize)&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Save the output &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outZonalGeometry.save("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/zonegeo")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Extract the value of the water area&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;WaterArea = arcpy.GetRasterProperties_management("C:/Users/Teabox/Documents/ArcGIS/MasterThesis/test/zonegeo", "MAXIMUM")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Total water surface in m²"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print WaterArea&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "End"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2011 12:59:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-coordinates-system-problem/m-p/312934#M24333</guid>
      <dc:creator>ThibaultBoissy</dc:creator>
      <dc:date>2011-06-24T12:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Python script coordinates system problem</title>
      <link>https://community.esri.com/t5/python-questions/python-script-coordinates-system-problem/m-p/312935#M24334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This file is created with no coordinates system and the value of the raster are "consequently" wrong. I tried several time to rewrite the script but I still have the same problem. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This can happen with map algebra output with some tools, especially mathematical operators like SetNull. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My advice is to copy the coordinate system from your input to the output raster using the Define Projection tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jun 2011 17:58:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-coordinates-system-problem/m-p/312935#M24334</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2011-06-27T17:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Python script coordinates system problem</title>
      <link>https://community.esri.com/t5/python-questions/python-script-coordinates-system-problem/m-p/312936#M24335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;try using &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.outputCoordinateSystem = "PROJCS["WGS_1984_UTM_Zone_32N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0],AUTHORITY["EPSG",32632]]"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it worked for me with a similar issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hope this helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AC&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 09:17:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-coordinates-system-problem/m-p/312936#M24335</guid>
      <dc:creator>AlessandroCinnirella</dc:creator>
      <dc:date>2011-06-28T09:17:23Z</dc:date>
    </item>
  </channel>
</rss>

