<?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 Parameters for Downloading Feature Layer Metadata? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/parameters-for-downloading-feature-layer-metadata/m-p/1077885#M6342</link>
    <description>&lt;P&gt;Trying to download a metadata xml file from a feature layer (not to be confused with a feature &lt;EM&gt;service&lt;/EM&gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having a hard time figuring out how to specify an output directory or path for the downloaded file. Looking at the &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html?highlight=metadata#arcgis.features.FeatureLayer.metadata" target="_self"&gt;documentation&lt;/A&gt;, it seems to accept a string parameter, but I only get errors when I feed it either an output directory, or a full file path.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GB_MattPanunto_GISS_1-1626105911633.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18242i50ED0A19F7C35843/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GB_MattPanunto_GISS_1-1626105911633.png" alt="GB_MattPanunto_GISS_1-1626105911633.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I don't specify anything, it just downloads the xml to a temp folder. Am I doing something wrong?&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jul 2021 16:15:26 GMT</pubDate>
    <dc:creator>GB_MattPanunto_GISS</dc:creator>
    <dc:date>2021-07-12T16:15:26Z</dc:date>
    <item>
      <title>Parameters for Downloading Feature Layer Metadata?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/parameters-for-downloading-feature-layer-metadata/m-p/1077885#M6342</link>
      <description>&lt;P&gt;Trying to download a metadata xml file from a feature layer (not to be confused with a feature &lt;EM&gt;service&lt;/EM&gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having a hard time figuring out how to specify an output directory or path for the downloaded file. Looking at the &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html?highlight=metadata#arcgis.features.FeatureLayer.metadata" target="_self"&gt;documentation&lt;/A&gt;, it seems to accept a string parameter, but I only get errors when I feed it either an output directory, or a full file path.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GB_MattPanunto_GISS_1-1626105911633.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18242i50ED0A19F7C35843/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GB_MattPanunto_GISS_1-1626105911633.png" alt="GB_MattPanunto_GISS_1-1626105911633.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I don't specify anything, it just downloads the xml to a temp folder. Am I doing something wrong?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 16:15:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/parameters-for-downloading-feature-layer-metadata/m-p/1077885#M6342</guid>
      <dc:creator>GB_MattPanunto_GISS</dc:creator>
      <dc:date>2021-07-12T16:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Parameters for Downloading Feature Layer Metadata?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/parameters-for-downloading-feature-layer-metadata/m-p/1078162#M6344</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Perhaps a slightly long-winded aproach, but the following may solve your issue.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
import xml.etree.ElementTree as ET

gis = GIS("&amp;lt;url&amp;gt;", "&amp;lt;username&amp;gt;", "&amp;lt;password&amp;gt;")
item = gis.content.get("&amp;lt;itemID&amp;gt;")
layer = item.layers[0]

if layer.properties["hasMetadata"]:
    
    ET.register_namespace("", "http://www.isotc211.org/2005/gmd")
    ET.register_namespace("gco", "http://www.isotc211.org/2005/gco")
    ET.register_namespace("gts", "http://www.isotc211.org/2005/gts")
    ET.register_namespace("srv", "http://www.isotc211.org/2005/srv")
    ET.register_namespace("gml", "http://www.opengis.net/gml")
    ET.register_namespace("gmx", "http://www.isotc211.org/2005/gmx")
    ET.register_namespace("xlink", "http://www.w3.org/1999/xlink")
    ET.register_namespace("xsi", "http://www.w3.org/2001/XMLSchema-instance")
    
    # Parse  document
    tree = ET.parse(layer.metadata)
    
    # Write file
    tree.write("/path/to/output/file.xml")&lt;/LI-CODE&gt;&lt;P&gt;Unfortunately I couldnt get the method that you are trying to use to work either.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 08:05:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/parameters-for-downloading-feature-layer-metadata/m-p/1078162#M6344</guid>
      <dc:creator>HamishMorton</dc:creator>
      <dc:date>2021-07-13T08:05:29Z</dc:date>
    </item>
  </channel>
</rss>

