<?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 Add  a layer to a hosted feature layer in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1323931#M54237</link>
    <description>&lt;P&gt;I am trying to add an extra layer to a hosted feature layer. I dont find any function inside AGOL to do it directly and I have tried some code in Notebook, but it doesnt seem to be possible. Any ideas how I can do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See screenshot&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 30 Aug 2023 15:20:28 GMT</pubDate>
    <dc:creator>IB3</dc:creator>
    <dc:date>2023-08-30T15:20:28Z</dc:date>
    <item>
      <title>Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1323931#M54237</link>
      <description>&lt;P&gt;I am trying to add an extra layer to a hosted feature layer. I dont find any function inside AGOL to do it directly and I have tried some code in Notebook, but it doesnt seem to be possible. Any ideas how I can do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See screenshot&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 15:20:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1323931#M54237</guid>
      <dc:creator>IB3</dc:creator>
      <dc:date>2023-08-30T15:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1323939#M54238</link>
      <description>&lt;P&gt;You can add new layers to a hosted feature layer using the "add to definition" function of the REST API and Python API.&lt;/P&gt;&lt;P&gt;I would definitely test this out on a layer you don't care about first though, especially if you're adding any kind of relationships, it's very easy to mess this up and can be difficult to fix.&lt;/P&gt;&lt;P&gt;Another option would be to export your existing HFL to a File GDB, add a new feature class to the GDB in Pro, then republish the modified File GDB as a new HFL.&amp;nbsp; This option is definitely safer and easier but can be more work if you have web maps and apps hanging off your existing HFL.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 15:30:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1323939#M54238</guid>
      <dc:creator>MobiusSnake</dc:creator>
      <dc:date>2023-08-30T15:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1323968#M54245</link>
      <description>&lt;P&gt;I've been working on this too. There is a real need for it since we can't see the future or anticipate all needs of a layer at initial creation. Even ESRI Solutions need extended and they seem to include even the kitchen sink. &lt;A href="https://community.esri.com/t5/arcgis-online-questions/feature-layer-added-to-feature-service-does-not/m-p/1322944#M54169" target="_blank" rel="noopener"&gt;Here's the best post I've found&lt;/A&gt; that even has info about a github repo with samples and a bug that shows a workaround to getting these newly added items to show in portal after adding them through the REST API.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 16:09:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1323968#M54245</guid>
      <dc:creator>DougGreen</dc:creator>
      <dc:date>2023-08-30T16:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324105#M54260</link>
      <description>&lt;P&gt;How can i get a token to access the rest api? Its says token required&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 20:34:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324105#M54260</guid>
      <dc:creator>IB3</dc:creator>
      <dc:date>2023-08-30T20:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324120#M54266</link>
      <description>&lt;P&gt;If you go through Portal/ArcGIS Online to the Item Overview page and scroll down to the "URL" link, it will open it up in the rest services directory and then you can click "Admin" in the upper right. This window has the token already applied. Use the links at the bottom to "addToDefinition". Also, if it says that the token is expired, refresh the Overview page and repeat those steps.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 20:54:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324120#M54266</guid>
      <dc:creator>DougGreen</dc:creator>
      <dc:date>2023-08-30T20:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324127#M54267</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2023-08-30 at 10.58.25 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79514i6D1260B1C9C0A95B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2023-08-30 at 10.58.25 PM.png" alt="Screen Shot 2023-08-30 at 10.58.25 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 20:59:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324127#M54267</guid>
      <dc:creator>IB3</dc:creator>
      <dc:date>2023-08-30T20:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324128#M54268</link>
      <description>&lt;P&gt;this is what i see&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 20:59:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324128#M54268</guid>
      <dc:creator>IB3</dc:creator>
      <dc:date>2023-08-30T20:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324133#M54269</link>
      <description>&lt;P&gt;Nevermind. I managed. thanks! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 21:10:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324133#M54269</guid>
      <dc:creator>IB3</dc:creator>
      <dc:date>2023-08-30T21:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324144#M54274</link>
      <description>&lt;P&gt;My problem now is that the layer doesnt appear and I can't create a new item. I get an error...do you know a code to add data that works?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 21:37:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1324144#M54274</guid>
      <dc:creator>IB3</dc:creator>
      <dc:date>2023-08-30T21:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1404842#M58438</link>
      <description>&lt;P&gt;How a regular user can do this via ArcGIS PRO (no restAPI handling)?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 13:10:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1404842#M58438</guid>
      <dc:creator>JoabelBarbieri</dc:creator>
      <dc:date>2024-08-06T13:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1561822#M62531</link>
      <description>&lt;P&gt;I just tested adding a layer to an existing Hosted Feature Layer through the REST endpoints today and IT IS NOW FIXED! I used the addToDefinition with a JSON containing one layer. After it completed, I refreshed the item's Overview page and the new layer showed up. This is really great. It means AGOL can really be used as an actual Geodatabase for small organizations now. Thank you ESRI!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 18:40:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1561822#M62531</guid>
      <dc:creator>DougGreen</dc:creator>
      <dc:date>2024-11-22T18:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1611969#M64639</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/70326"&gt;@DougGreen&lt;/a&gt;&amp;nbsp;That's awesome that you say it's fixed....unfortunately, I didn't experience the same behavior when I was working on this yesterday.&lt;BR /&gt;&lt;BR /&gt;I wanted to share what I ended up doing, after lots of trial and error, which seemed to work. Below is a snippet from the script for the tool I built.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
    #  Add layer definition from JSON file to the service definition
    result = fs.manager.add_to_definition(config)
    
if result.get("success"):
        arcpy.AddMessage("Layer successfully added.")

        #  Update the item metadata with the new layer so it appears in the AGOL UI
        item.update(data={"layers": [dict(layer.properties) for layer in fs.layers]})
    else:
        arcpy.AddWarning(f"Failed to add layer. Response: {result}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found that I needed to use &lt;STRONG&gt;item.update&lt;/STRONG&gt;, specifically using a dictionary structure like that, to properly get the item metadata to update to match the service definition.&lt;BR /&gt;&lt;BR /&gt;How did you handle your workflow, in which you say it updated the item details automatically?&lt;/P&gt;&lt;P&gt;A potentially important detail, I was working with a hosted feature layer that was published from ArcGIS Pro. I believe the metadata for these is structured slightly differently compared to hosted feature layers created in ArcGIS Online directly. Perhaps that was a factor....&lt;/P&gt;</description>
      <pubDate>Tue, 06 May 2025 14:05:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1611969#M64639</guid>
      <dc:creator>Katie_Clark</dc:creator>
      <dc:date>2025-05-06T14:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1614573#M64730</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/232739"&gt;@Katie_Clark&lt;/a&gt;Thanks! This is so useful to have this code snippet and it worked for me!&lt;/P&gt;&lt;P&gt;Just to fill in some missing bits for others, here's a full code snippet:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection

# Fill in your username and password
gis = GIS('https://www.arcgis.com','username','password')

# Fill in the hosted feature layer ID
item = gis.content.get('feature layer id')
fs = FeatureLayerCollection.fromitem(item)

# Update the item metadata so that all layers appear in the AGO UI
item.update(data={"layers": [dict(layer.properties) for layer in fs.layers]})&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 14 May 2025 15:05:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1614573#M64730</guid>
      <dc:creator>BRENNEJM</dc:creator>
      <dc:date>2025-05-14T15:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1615550#M64775</link>
      <description>&lt;P&gt;Sorry for no response there. It's been long enough that I don't have all the details anymore. The next time I have to do this, I know I'll be coming back here though, since the working status of this seems to change frequently.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 16:52:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1615550#M64775</guid>
      <dc:creator>DougGreen</dc:creator>
      <dc:date>2025-05-16T16:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Add  a layer to a hosted feature layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1691159#M68211</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/232739"&gt;@Katie_Clark&lt;/a&gt;&amp;nbsp;, thank you so much! You saved me a lot of time. So far, this is the only workaround that has worked for me using the ArcGIS Python API 2.4.2.It worked both on the hosted features and the views.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2026 23:28:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/add-a-layer-to-a-hosted-feature-layer/m-p/1691159#M68211</guid>
      <dc:creator>femusicale</dc:creator>
      <dc:date>2026-03-17T23:28:36Z</dc:date>
    </item>
  </channel>
</rss>

