I recently encountered a business need to reproject a hosted web feature layer from an obscure projection to Web Mercator. This layer was inadvertently published by a user that had previously used said projection and forgot to change it when publishing. Working with Esri Solutions Engineer Matthew Viverito, I was able to reproject a web feature layer that included attachments and point web apps to the new service using ago-assistant. In the process, I also preserved the last editor value in a new field.
What you need
- Editor access to layer in ArcGIS Online (AGO)
- ArcGIS Pro
- Editor access to any maps or apps using layer in AGO
How To
Optional: Preserving editor tracking
The following steps are optional and pertain preserving editor tracking. If this is a requirement, do it before the reprojection
- Open the feature layer in AGO
- On the settings tab, disable editor tracking
- For good measure, export a backup to File GDB
- Open ArcGIS Pro and open an project for the work
- Open the Portal section of catalog and find the web feature layer
- Add fields for preservation, e.g., editor_old
- Use the field calculate geoprocessing tool to copy the values into the new fields
- Turn the editor tracking back on in AGO
Reprojecting the feature layer and publishing
- Open ArcGIS Pro and open an project for the work
- Create a new file geodatabase
- Create a new feature dataset in whatever projection you want for the new feature layer, i.e., the reprojection
The feature dataset enforces the chosen projection of all data inside it.
- Find the old layer in Catalog pane under Portal content
- Add to a new map
- Export that layer to the that new geodatabase inside the feature dataset (attachments are enabled by default)
- Once the export finishes, add that feature class to a new map
Make sure to use a new map so the old map's projection is not carried over when publishing
- Adjust any symbology you want to update before publishing
- Share as web layer to your AGO content
- Check the editor preferences in the parameters area
- Analyze and fix any issues
- Publish
- Find the layer in AGO content (on the web)
- Make any necessary sharing, metadata, layer, or group updates
- Copy the service URL
- Open the AGO Assistant
- Choose Update the URL of Services in a Web Map from the I want to... menu
- Select any maps or apps that reference the old layer and update them with the new URL
The structure of the URL must be identical, including the layer number if applicable
- Test all affected maps and apps for functionality
The reprojected layer should now be visible throughout AGO
There is a bug with the attribute table widget in Web App Builder. It is necessary to recreate any web apps where the attribute table is configured to look at a layer in the web map.