How can I remove old layers from a webmap's JSON file

1030
4
10-12-2017 09:29 PM
DanielNutsford1
New Contributor II

Recently I migrated a lot of webmaps between two organisational accounts using AGOL assistant. Before migration, I spent a lot of time fiddling around with the webmaps adding layers, and removing layers etc etc. This has led to a bloated JSON file associated with each webmap (each layer that was ever added to the web map seems to be stored in the JSON, even after it has been removed from the webmap). Im ready to move in production and have deleted a lot of the intermediary data which I am no longer using. However, because there is still a JSON reference to my deleted data the webmap wont load - at least  I think this is whats happening. The web map will load all the layers I expect to see for about a second then give me the error below

Has anyone had this issue before, or know of a way to clean up a JSON file to ensure only active layers within the webmap are referenced in the JSON?

Any help would be much appreciated!

Thanks

Dan

0 Kudos
4 Replies
KellyGerrow
Esri Frequent Contributor

Hey Dan,

You could try to remove the invalid resources using AGO Assistant, but I wouldn't recommend doing this if you are already running into issues. Consider replacing the invalid urls with valid urls to get the map to open and then remove from the web map.

Would it be easier to recreate a new web map using the current layers?

-Kelly

0 Kudos
DanielNutsford1
New Contributor II

Hi Kelly, thanks for the message. 

An update to my original post. Turns out it was only three layers within the webmap (of about 30) that were causing an issue. All of these layers were Tile services. I noticed that when using AGOL assistant to update service URLs, the URLs themselves change but the itemID remains the same which results in a mismatch. This doesn't appear to be an issue for hosted feature services, but I could only get the webmap to work if I manually updated the item IDs of tile services to be consistent with the URL. 

Now my webmap is working as expected, however I am still slightly concerned that I have a mismatch between my item IDs and my URLs for all of the hosted feature services in my WebMap. Is this something that can be rectified?  

Cheers,

Dan

0 Kudos
KellyGerrow
Esri Frequent Contributor

Hi Daniel,

It's always recommended to have your item Ids match the feature layers. As you have noticed, it is required for some layer types and not others. We are working on some tools to help with this in an upcoming release, but currently i would recommend updating the item ids to the corresponding ID of the layer using the JSON editor in the AGO assistant.

-Kelly

0 Kudos
DanielNutsford1
New Contributor II

Hi Kelly,

Glad to hear there are some tools coming soon. Any idea if these coming tools will update item IDs that are wrong? i.e. retrospective fixes? 

Can you please tell me a little bit more around why you recommend matching item Ids with service URLs. At the moment it is not causing any issues and its going to be a mammoth job to update them all (I have around 60 webmaps with 20 - 30 layers each). What sort of problems could arise by having mismatched IDs? 

Nonetheless ill keep this in mind and update the IDs properly in future projects.

Cheers,

Dan

0 Kudos