<?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: Set Environment parameter in custom geoprocessing tool in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/set-environment-parameter-in-custom-geoprocessing/m-p/1618034#M74272</link>
    <description>&lt;P&gt;Your parameter name is the Name field. that is not 'outputCoordinateSystem' in your screenshot, but 'output_feature...'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also just manually set the environment variable using arcpy.env:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

...
def main():
    arcpy.env.outputCoordinateSystem = arcpy.SpatialReference(2230)
    ...&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 23 May 2025 19:36:59 GMT</pubDate>
    <dc:creator>HaydenWelch</dc:creator>
    <dc:date>2025-05-23T19:36:59Z</dc:date>
    <item>
      <title>Set Environment parameter in custom geoprocessing tool</title>
      <link>https://community.esri.com/t5/python-questions/set-environment-parameter-in-custom-geoprocessing/m-p/1618018#M74271</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I build a new geoprocessing tool, and I want to set a default outputCoordinateSystem in Environment:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EugeneSosnin_GSI_0-1748027710267.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/133141i2AD57C8EEFD8968B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EugeneSosnin_GSI_0-1748027710267.png" alt="EugeneSosnin_GSI_0-1748027710267.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I found we have it tool parameters:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EugeneSosnin_GSI_1-1748027769328.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/133142i05775D618F1C8676/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EugeneSosnin_GSI_1-1748027769328.png" alt="EugeneSosnin_GSI_1-1748027769328.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried to use initializeParameters:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class ToolValidator:
  # Class to add custom behavior and properties to the tool and tool parameters.
    
    def __init__(self):
        # Set self.params for use in other validation methods.
        self.params = arcpy.GetParameterInfo()

    def initializeParameters(self):
        # Customize parameter properties. This method gets called when the
        # tool is opened.
        for param in self.params:
            if param.name == "outputCoordinateSystem":
                param.value = arcpy.SpatialReference(2230)
        return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;but it didn't work out.&lt;/P&gt;&lt;P&gt;Could you, please, help me?&lt;/P&gt;</description>
      <pubDate>Fri, 23 May 2025 19:20:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-environment-parameter-in-custom-geoprocessing/m-p/1618018#M74271</guid>
      <dc:creator>EugeneSosnin_GSI</dc:creator>
      <dc:date>2025-05-23T19:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Set Environment parameter in custom geoprocessing tool</title>
      <link>https://community.esri.com/t5/python-questions/set-environment-parameter-in-custom-geoprocessing/m-p/1618034#M74272</link>
      <description>&lt;P&gt;Your parameter name is the Name field. that is not 'outputCoordinateSystem' in your screenshot, but 'output_feature...'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also just manually set the environment variable using arcpy.env:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

...
def main():
    arcpy.env.outputCoordinateSystem = arcpy.SpatialReference(2230)
    ...&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 23 May 2025 19:36:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-environment-parameter-in-custom-geoprocessing/m-p/1618034#M74272</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2025-05-23T19:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Set Environment parameter in custom geoprocessing tool</title>
      <link>https://community.esri.com/t5/python-questions/set-environment-parameter-in-custom-geoprocessing/m-p/1618734#M74289</link>
      <description>&lt;P&gt;Thank you for the answer.&lt;/P&gt;&lt;P&gt;Yeah, I am still confused how to set the Environment parameter. Therefore, I could not accept the answer.&lt;/P&gt;&lt;P&gt;Currently, I use:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def main():
 
    with arcpy.EnvManager(outputCoordinateSystem='PROJCS["California_...'):
        arcpy.management.CopyFeatures(path, outpath)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 27 May 2025 22:10:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-environment-parameter-in-custom-geoprocessing/m-p/1618734#M74289</guid>
      <dc:creator>EugeneSosnin_GSI</dc:creator>
      <dc:date>2025-05-27T22:10:47Z</dc:date>
    </item>
  </channel>
</rss>

