Select to view content in your preferred language

Overwrite Web Layer - Custom analyze - show differences between existing service and a new (overwrite) service

244
3
07-29-2024 11:05 PM
MarkMindlin_idea
Regular Contributor

In ArcGIS Pro, before Overwrite Web Layer, we need to analyze - show differences between existing service and a new (overwrite) service, keeping parameters consistent when republishing FeatureServices.

Example: Keeping layer IDs consistent

 

It will be more parameters to compare, so we need a general solution.

Possible workflow could be:

  • take an existing service, export all parameters to file.
  • take existing map, export all parameters to a file
  • compare two files and show the difference

 

ArcGIS Pro 3.3.0

ArcGIS Enterprise 11.2

0 Kudos
3 Replies
jcarlson
MVP Esteemed Contributor

If you're comfortable with a bit of Python, the compare method on arcgis.features.GeoAccessor is pretty helpful.

from arcgis.gis import GIS
from arcgis.features import GeoAccessor, FeatureLayer

gis = GIS('your portal url', 'user', 'password')

existing = GeoAccessor.from_layer(FeatureLayer('feature service url'))
new = GeoAccessor.from_featureclass('file path') # this part will depend on where the new data comes from

comp_frames = existing.spatial.compare(new, 'id field')

You'd then be able to look at the contents of comp_frames, being three dataframes corresponding to rows added, modified, and deleted between the existing and new layers.

Each of those identified changes could be exported to file / feature service and further interacted with.

- Josh Carlson
Kendall County GIS
0 Kudos
MarkMindlin_idea
Regular Contributor

Thank you Josh @jcarlson 

The code you provided could be very useful.

For our case, it does not compare schema/s of feature classes,
it does not compare parameters of a service Web Layer and local Map as we going to overwrite the Web Layer.

Example:

An existing service has two feature layers with layers' IDs "1" and "2"

As we going to overwrite the service, we have in a Map two layers, but accidentally, the layers' IDs are "3" and "4"

We are looking to solve that issue in particular (only layers' IDs) and as a general solution (all parameters of the service)


Regards,
Mark

0 Kudos
jcarlson
MVP Esteemed Contributor

Getting the schema from two layers or two dataframes is easy. Layer IDs are probably something you'd need to use the arcpy.mp module for.

- Josh Carlson
Kendall County GIS
0 Kudos