<?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: Setting Feature Layer as Default in Geoprocessing Service written in Python in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816866#M7044</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response! I don't think I can hardcode the layers as there are other parts of the script that reference these parameters (I didn't write the script, I'm just trying to figure out how to set defaults). I tried setting the properties, but the Export option is greyed out, so I can't export the script to republish. I may be misunderstanding what you're suggesting, though.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Feb 2020 19:26:56 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2020-02-20T19:26:56Z</dc:date>
    <item>
      <title>Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816864#M7042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello! I have a python script for a geoprocessing service. It takes all of the streams that lie inside of polygons selected from up to three different feature layers and runs different calculations (total length, cost, etc.).Currently, when you open the tool (in a widget), you have to specify each of the feature classes for each parameter. That is, there are three drop-down boxes under headings (HUC8, HUC10, County), and you have to select the correct feature class for each parameter.&lt;/P&gt;&lt;P&gt;What I would like to do is have each parameter default to a certain feature class so the user doesn't have to do it each time. I feel like this should be easy, but I can't figure it out (plus, I'm still very new at Python scripting.).&lt;/P&gt;&lt;P&gt;Should this be written in the script, or does it have to be set when the script is served online? Or...?&lt;/P&gt;&lt;P&gt;The script was written for Python 2 to be used in ArcMap (as opposed to ArcPro).&lt;/P&gt;&lt;P&gt;I know more information is needed to help you all answer my question. Please specify what more you need!&lt;/P&gt;&lt;P&gt;Annina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2020 15:09:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816864#M7042</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-02-19T15:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816865#M7043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would remove these as parameters in your tool and hardcode the, or set a default value in your arcmap toolbox script properties then republished.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2020 19:02:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816865#M7043</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-02-20T19:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816866#M7044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response! I don't think I can hardcode the layers as there are other parts of the script that reference these parameters (I didn't write the script, I'm just trying to figure out how to set defaults). I tried setting the properties, but the Export option is greyed out, so I can't export the script to republish. I may be misunderstanding what you're suggesting, though.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2020 19:26:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816866#M7044</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-02-20T19:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816867#M7045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess its password protected? I actually think you can set defaults in the gp widget but I'm not sure. I'd try and get hold of the script, though can you not run it, go to the results window and share as a service? The defaults could be changed in the publishing window maybe.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2020 19:40:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816867#M7045</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-02-20T19:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816868#M7046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got to thinking about the publishing/sharing settings after I responded to you. I looked into it this morning and there's a section to set defaults when publishing. I never see this portion of the workflow because I'm not an admin! I'll have to update this/mark as answered later on next week when my administrator returns and gets it running. Thank you, David!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2020 12:38:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816868#M7046</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-02-21T12:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816869#M7047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi @Annina Rupe,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might want to use the config file for the pre-set value for parameters.&amp;nbsp;There is configparser python library that can read the value from the config file.&lt;/P&gt;&lt;P&gt;eg. &lt;BR /&gt;&lt;EM&gt;config = configparser&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;config.get("program","layer1")&amp;nbsp; =&amp;gt; get the value of 'HUC8'&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;the example of config.ini&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[program]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;layer1=HUC8&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;layer2=HUC10&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;layer3=Countries&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the python code, to assign the value to your default drop-down list when you initialize the dropdown list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To publish the web tool with config.ini, need to select '&lt;STRONG&gt;copy all&lt;/STRONG&gt;' data option. the process copied the config.ini to the deploy directory in ArcGIS server.&lt;/P&gt;&lt;P&gt;the path looks like below (you can check the directories form ArcGIS Manager):&amp;nbsp;&lt;/P&gt;&lt;P&gt;C:\arcgis\arcgisserver\directories\arcgissystem\arcgisinput\ExportGPTool_n.GPServer\extracted\cd\gp_export\config.ini&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use the config.ini that allows you to update the default value after you deployed the web tool without changing the code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other option will require that your layer list can select the default layer by logical pre-selection in the code; such as&amp;nbsp;sorting, or the layer name contains a particular keyword, etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2020 02:16:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816869#M7047</guid>
      <dc:creator>VickyWang</dc:creator>
      <dc:date>2020-02-24T02:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816870#M7048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vicky, Thanks for the detailed information! Will be doing some testing later on this week, so will let you know!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2020 11:42:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816870#M7048</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-02-24T11:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816871#M7049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestions, David, but it doesn't seem to work. You&amp;nbsp;&lt;SPAN style="text-decoration: underline;"&gt;can&lt;/SPAN&gt; set defaults when you serve the tool. But, if I choose defaults, I then lose the ability to make a selection in the tool. That is, the tool will run on the entire default layer and not a subset. That part is pretty important to us. Will be trying Vicky's suggestion next.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2020 13:17:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816871#M7049</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-03-02T13:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816872#M7050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vicky,&lt;/P&gt;&lt;P&gt;I partially understand the config instructions. First of all, how do I create this config.ini file? As far as I know, there wasn't one automatically created.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, when I have the config.ini file, do I insert the italicized text above exactly as it's shown above? And where in both files? I apologize; I'm just learning Python and it's not as intuitive as I thought.&lt;/P&gt;&lt;P&gt;Annina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2020 13:37:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816872#M7050</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-03-02T13:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816873#M7051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/345407"&gt;Annina Rupe&lt;/A&gt;‌,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The config.ini is a plan tex file. It can be created in any text editor (notepad, notepad++). Please reference to python configparser help document below.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.python.org/2.7/library/configparser.html" title="https://docs.python.org/2.7/library/configparser.html"&gt;13.2. ConfigParser — Configuration file parser — Python 2.7.17 documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will create the section and variable names in the config.ini.&lt;/P&gt;&lt;P&gt;eg.[program] is the section name; layer1, layer2, and layer3 are variable names. The HUC8, HUC10, Countries are the values of your variables which will be read into the python script.&amp;nbsp;The config file location can locate in the same folder as the python script (or anywhere the script can access, as long as you define where to read in the script). There are examples from the python help doc.&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;[program]&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;layer1=HUC8&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;layer2=HUC10&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;layer3=Countries&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2020 19:26:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816873#M7051</guid>
      <dc:creator>VickyWang</dc:creator>
      <dc:date>2020-03-02T19:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Feature Layer as Default in Geoprocessing Service written in Python</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816874#M7052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the explanation, Vicky. I think though there's still something missing, and it may be due to how the script was written.&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I can tell, the parameters aren't set in the script; they are set when creating the toolbox in ArcMap. There are three parameters that are entered into the tool, HUC8, HUC10, and County. These three parameters are all set as "Feature Set" and type: Optional. Unfortunately, if the Data Type is "Feature Set," you can't set a Default (like you can with feature layer, shapefile, etc.), and there is only one Filter option: None.&lt;/P&gt;&lt;P&gt;I have tried running as other Data Types; some won't run at all. The most promising one was "Any Value" because it allowed me to run the tool with defaults set. When served, it did enter the correct defaults, but I lost the capability of making selections in the layers. That is, the tool would run all three layers at their max extent. We need people to be able to choose subsets because the tool will then make calculations based on those.&lt;/P&gt;&lt;P&gt;Does this make sense? Am I expecting more than what can be done? If you'd like to see the tool as it stands now (running, but the user has to manually set each layer and then make the selection), I can share it with you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2020 15:05:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/setting-feature-layer-as-default-in-geoprocessing/m-p/816874#M7052</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-03-03T15:05:46Z</dc:date>
    </item>
  </channel>
</rss>

