<?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 to download feature layer by name in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/python-to-download-feature-layer-by-name/m-p/1521224#M60821</link>
    <description>&lt;P&gt;I have found some python that will loop through a list and download all feature layers from ArcGIS online. Found &lt;A href="https://support.esri.com/en-us/knowledge-base/how-to-download-feature-service-items-from-arcgis-onlin-000018909" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;How would I manipulate this script to only search and download a specified feature layer (prompted by input)?&lt;/P&gt;&lt;PRE&gt;import arcgis
from arcgis.gis import GIS

gis = GIS(None,'username', 'password', verify_cert=False)

# Download all data from a user
def downloadUserItems(owner, downloadFormat):
    try:
        # Search items by username
        items = gis.content.search('owner:{0}'.format(owner))
        print(items)
        # Loop through each item and if equal to Feature service then download it
        for item in items:
            if item.type == 'Feature Service':
                result = item.export('sample {}'.format(item.title), downloadFormat)
                result.download(r'file path of where to store the download')
&amp;nbsp;               # Delete the item after it downloads to save on space
&amp;nbsp;               result.delete()
    except Exception as e:
        print(e)&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2024 07:58:15 GMT</pubDate>
    <dc:creator>ForrestS</dc:creator>
    <dc:date>2024-08-14T07:58:15Z</dc:date>
    <item>
      <title>Python to download feature layer by name</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/python-to-download-feature-layer-by-name/m-p/1521224#M60821</link>
      <description>&lt;P&gt;I have found some python that will loop through a list and download all feature layers from ArcGIS online. Found &lt;A href="https://support.esri.com/en-us/knowledge-base/how-to-download-feature-service-items-from-arcgis-onlin-000018909" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;How would I manipulate this script to only search and download a specified feature layer (prompted by input)?&lt;/P&gt;&lt;PRE&gt;import arcgis
from arcgis.gis import GIS

gis = GIS(None,'username', 'password', verify_cert=False)

# Download all data from a user
def downloadUserItems(owner, downloadFormat):
    try:
        # Search items by username
        items = gis.content.search('owner:{0}'.format(owner))
        print(items)
        # Loop through each item and if equal to Feature service then download it
        for item in items:
            if item.type == 'Feature Service':
                result = item.export('sample {}'.format(item.title), downloadFormat)
                result.download(r'file path of where to store the download')
&amp;nbsp;               # Delete the item after it downloads to save on space
&amp;nbsp;               result.delete()
    except Exception as e:
        print(e)&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 07:58:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/python-to-download-feature-layer-by-name/m-p/1521224#M60821</guid>
      <dc:creator>ForrestS</dc:creator>
      <dc:date>2024-08-14T07:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Python to download feature layer by name</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/python-to-download-feature-layer-by-name/m-p/1521237#M60824</link>
      <description>&lt;P&gt;I'm assuming your putting a toolbox front end on this. So your input parameter would be a string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So you define that as a variable (assuming it;s first input parameter e.g.:&lt;BR /&gt;&lt;BR /&gt;FileName =&amp;nbsp;arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you change the search line to:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;items = gis.content.search(query=FileName +', type:"Feature Service")&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2024 08:30:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/python-to-download-feature-layer-by-name/m-p/1521237#M60824</guid>
      <dc:creator>RichardHowe</dc:creator>
      <dc:date>2024-08-14T08:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python to download feature layer by name</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/python-to-download-feature-layer-by-name/m-p/1521239#M60826</link>
      <description>&lt;P&gt;Apolgies, I'm missing a aclosing apsotrohe. Last line shoudl read:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;items = gis.content.search(query=FileName +', type:"Feature Service"')&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2024 08:33:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/python-to-download-feature-layer-by-name/m-p/1521239#M60826</guid>
      <dc:creator>RichardHowe</dc:creator>
      <dc:date>2024-08-14T08:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Python to download feature layer by name</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/python-to-download-feature-layer-by-name/m-p/1522496#M60903</link>
      <description>&lt;P&gt;Much appreciated. Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 19:24:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/python-to-download-feature-layer-by-name/m-p/1522496#M60903</guid>
      <dc:creator>ForrestS</dc:creator>
      <dc:date>2024-08-15T19:24:02Z</dc:date>
    </item>
  </channel>
</rss>

