<?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: Scripting env.XYResolution settings? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/scripting-env-xyresolution-settings/m-p/629814#M49008</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This link &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/environments/xy-resolution.htm" title="http://desktop.arcgis.com/en/desktop/latest/tools/environments/xy-resolution.htm"&gt;XY Resolution (Environment setting)—Help | ArcGIS for Desktop&lt;/A&gt; suggests that it needs to be known in order to be changes or if the units are different and you are correct that the script example&lt;/P&gt;&lt;P&gt;&lt;SPAN class="kn" style="color: blue; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="nn" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c" style="color: green; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;# Set the XYResolution environment to a linear unit&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="n" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="o" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;env&lt;/SPAN&gt;&lt;SPAN class="o" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;XYResolution&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="o" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="s" style="color: #a31515; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;"0.002 Meters"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;​would suggest setting it directly.&amp;nbsp; It appears though, that your lines 1 and 3 may be redundant in your first code example and in your second code you set them after the createfeaturedataset not before.&amp;nbsp; Have you actually tried your code example 1 without lines 1 and 3? and/or can you confirm that the units are indeed the same?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further information can be found in &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/supplement/spatial-reference-and-geoprocessing.htm" title="http://desktop.arcgis.com/en/desktop/latest/tools/supplement/spatial-reference-and-geoprocessing.htm"&gt;Spatial reference and geoprocessing—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 28 Jun 2015 21:45:03 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2015-06-28T21:45:03Z</dc:date>
    <item>
      <title>Scripting env.XYResolution settings?</title>
      <link>https://community.esri.com/t5/python-questions/scripting-env-xyresolution-settings/m-p/629813#M49007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am hoping for a little clarification on how scripting env.XYResolution and/or env.XYTolerance adjustments work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My script works; I have a question about &lt;STRONG&gt;&lt;EM&gt;why&lt;/EM&gt;&lt;/STRONG&gt; it works the way it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because I need to match the work done by another department, I need to create a feature dataset with&amp;nbsp; resolution values equal to 0.01 feet and all the tolerances equal to 0.02 feet. I thought creating a spatial reference (&lt;SPAN style="font-family: 'courier new', courier; color: #505050;"&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000079000000" rel="nofollow noopener noreferrer" target="_blank"&gt;arcpy.CreateSpatialReference_management&lt;/A&gt;&lt;/SPAN&gt;) to use in the feature dataset creation would do it, but it only gets me halfway there. I still end up needing to change the XY resolution and tolerance through the environment (&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000000w000000" rel="nofollow noopener noreferrer" target="_blank"&gt;env&lt;/A&gt;) function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I’m just confused why it needs to be written the way it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This works:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;XY_Resolution = arcpy.env.XYResolution
arcpy.env.XYResolution = "0.01 Feet"
XY_Tolerance = arcpy.env.XYTolerance
arcpy.env.XYTolerance = "0.02 Feet"
arcpy.CreateFeatureDataset_management(TerrainGDB, DatasetName, Coordinate_System)
arcpy.env.XYResolution = XY_Resolution
arcpy.env.XYTolerance = XY_Tolerance&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This does not:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.CreateFeatureDataset_management(TerrainGDB, DatasetName, Coordinate_System)
arcpy.env.XYResolution = "0.01 Feet"
arcpy.env.XYTolerance = "0.02 Feet"&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why does the first example work and the second not? The first example just seems overly redundant:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #505050;"&gt;XY_Resolution = arcpy.env.XYResolution = "0.01 Feet" = arcpy.env.XYResolution = XY_Resolution.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe I’m just trying to make it too complicated. Can someone help explain this to me? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I keep thinking I have it figured out. But then I think a little bit more and lose it. Is&amp;nbsp; &lt;SPAN style="font-family: 'courier new', courier; color: #505050;"&gt;XY_Resolution = arcpy.env.XYResolution&lt;/SPAN&gt; behaving kind of like &lt;SPAN style="font-family: 'courier new', courier; color: #505050;"&gt;Coordinate_System = arcpy.CreateSpatialReference_management&lt;/SPAN&gt; only without the “create” verbiage and the parameters? Meaning that &lt;SPAN style="font-family: 'courier new', courier; color: #505050;"&gt;arcpy.env.XYResolution&lt;/SPAN&gt; can’t be set by anything but another environment setting. But then, &lt;SPAN style="font-family: 'courier new', courier; color: #505050;"&gt;arcpy.env.XYResolution&lt;/SPAN&gt; is being set by the value “0.01 Feet” and not by another environment setting. The &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001w0000000q000000" rel="nofollow noopener noreferrer" target="_blank"&gt;help&lt;/A&gt; doesn’t say anything about setting up the code like the first example, only "&lt;SPAN style="font-family: 'courier new', courier; color: #505050;"&gt;arcpy.env.XYTolerance = linear_unit&lt;/SPAN&gt;". But the first example is what's produced when the process is exported from ModelBuilder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I feel like I’m missing some giant concept that would make this all make more sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:47:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-env-xyresolution-settings/m-p/629813#M49007</guid>
      <dc:creator>JohnLay</dc:creator>
      <dc:date>2021-12-12T02:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting env.XYResolution settings?</title>
      <link>https://community.esri.com/t5/python-questions/scripting-env-xyresolution-settings/m-p/629814#M49008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This link &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/environments/xy-resolution.htm" title="http://desktop.arcgis.com/en/desktop/latest/tools/environments/xy-resolution.htm"&gt;XY Resolution (Environment setting)—Help | ArcGIS for Desktop&lt;/A&gt; suggests that it needs to be known in order to be changes or if the units are different and you are correct that the script example&lt;/P&gt;&lt;P&gt;&lt;SPAN class="kn" style="color: blue; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="nn" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c" style="color: green; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;# Set the XYResolution environment to a linear unit&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="n" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="o" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;env&lt;/SPAN&gt;&lt;SPAN class="o" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;XYResolution&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="o" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="s" style="color: #a31515; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 12px; background-color: #fafafa;"&gt;"0.002 Meters"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;​would suggest setting it directly.&amp;nbsp; It appears though, that your lines 1 and 3 may be redundant in your first code example and in your second code you set them after the createfeaturedataset not before.&amp;nbsp; Have you actually tried your code example 1 without lines 1 and 3? and/or can you confirm that the units are indeed the same?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further information can be found in &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/supplement/spatial-reference-and-geoprocessing.htm" title="http://desktop.arcgis.com/en/desktop/latest/tools/supplement/spatial-reference-and-geoprocessing.htm"&gt;Spatial reference and geoprocessing—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jun 2015 21:45:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-env-xyresolution-settings/m-p/629814#M49008</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-06-28T21:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting env.XYResolution settings?</title>
      <link>https://community.esri.com/t5/python-questions/scripting-env-xyresolution-settings/m-p/629815#M49009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As far as I can tell, your first code snippet reads the current setting for XYResolution and&amp;nbsp; XYTolerance, then it sets it to the value that you want to use. The you execute the tools (which will use the settings you defined) and afterwards you set them back to what they were before you executed the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second snippet, sets the values after the tool is executed. When running CreateFeatureDataset_management these setting are not available yet and have no influence on the tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In short environments need to be set before a tool is run in order to have influence on the tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume that this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.env.XYResolution = "0.01 Feet" 
arcpy.env.XYTolerance = "0.02 Feet"
arcpy.CreateFeatureDataset_management(TerrainGDB, DatasetName, Coordinate_System) &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... will probably work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:48:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-env-xyresolution-settings/m-p/629815#M49009</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T02:48:01Z</dc:date>
    </item>
  </channel>
</rss>

