Workflow
- You want multiple layers in web map to point to one data layer in AGO,
- Each layer needs to be styled differently, but the item details page content is the same for each map layer (all pointing to one data layer in AGO)
- You don’t want make copies of the layer in the web map, then restyle the layer copies in the web map, because this is time consuming and you already have them styled in ArcMap.
- While creating a new layer from the hosted feature service or a new view from the hosted feature service would achieve the goal of having multiple layers pointing to the same hosted feature service, we still run into the problem of needing to do additional work of restyling the layers in AGO (we already have the styles done in ArcMap). Additionally, new layers or views would also require maintenance of additional item details pages (more work we don't need or want to do).
- So from ArcMap you’re republishing the same data layers with different symbology. You're essentially duplicating data layers in AGO just to achieve the goal of styling them differently – consequence is that you end up with redundant data (multiple instances of the same data as hosted feature services - requiring way more data storage and consuming more credits for storage, and you still end up with more item details pages to manage).
I found a way to create a "layer" that does everything I want it to - but its rather complicated and requires accessing the drawingInfo from the hosted feature service's JSON (via admin page), copying the drawingInfo, and then modifying the JSON of the web map's operational layer's url, itemID, and adding layerDefinition and drawingInfo copied from the service's JSON (used AGO-Assistant for this). This requires advanced knowledge. But since, it is possible, how about creating a tool that makes it easy for the average AGO/ArcMap user to implement.
(publish hosted feature service from arcmap, publish 2nd hosted feature service from arcmap (same data source but different style), add both to AGO web map and save, go to service URL admin page for 2nd service and copy drawingInfo, use AGO-Assistant to edit the web map JSON, find the 2nd layer and edit both the url and itemID to be same as 1st layer and then add layerDefinition and paste in drawingInfo, save JSON, refresh and test web map, delete the 2nd hosted feature service, refresh and test the web map again... should not get any errors, and should no longer be hosting 2 services with same data content, and should have symbology in 2nd layer derived from ArcMap).
Proposed Solution:
- New layer tool for AGO
- user selects a layerfile from their pc or one uploaded to AGO - AGO reads the layerfile saved from ArcMap, to get the drawingInfo for the new "layer"
- user selects the data source - an existing AGO hosted feature service to use with the layer
- provide a warning if the data structure doesn't support the drawingInfo
- user chooses to add the layer to an existing web map (this option will use the source data's item detail page) or create a new item (a new item details page would be created)
- if user adds layer to an existing web map, they still get choice to create new layer item from web map.