Replace a Map Service from MXD by APRX

1082
15
Jump to solution
12-01-2023 02:49 PM
GD2
by
New Contributor III

Hi everybody, 

Can we replace a map service that was published on portal using MXD by an APRX project? I mean, when the same MXD is imported to an APRX, can we "Overwrite" the map service on Portal?

Tags (1)
15 Replies
GD2
by
New Contributor III

@DEWright_CA Awesome. Thank you!

 

0 Kudos
GD2
by
New Contributor III

HI@DEWright_CA . Did you have to add the published layer and reconfigure (pop ups etc) it on different Web Maps? Or did it get replaced on webs maps by its own?

0 Kudos
cdickerson
New Contributor III

Hi,

We updated all of our projects from MXDs to APRXs a number of years ago just by importing the map in to the Pro Project. If you have a federated system, new services will have a reference that will appear in Portal. If you have old services that were published before having an Enterprise Portal setup and federated with ArcServer you will need to add your services to your Portal first. Believe this can be accomplished by taking your REST endpoint URL and adding a layer in Portal. This creates the link in Portal that will allow you to overwrite your service from Pro.   

GD2
by
New Contributor III

@cdickerson Thank you for your suggestions. We have a federated system, so, I am able to import the MXDs and replace the map service using APRX. The next challenge is to find out all the web maps/apps in the Portal that has that map service and configure their settings. 

0 Kudos
cdickerson
New Contributor III

I recommend the Python API. Recently we conducted an inventory of everything in our Portal. I was able to use the Python API to cycle through all of our Web Maps and output list of Layers with data sources. 

Here are few lines to get you started. It isn't everything you need in the code but those are the main parts.

gis = GIS(url="PORTAL URL HERE", username="USERNAME", password="PASSWORD")

webmap_search = gis.content.search(query="", item_type="Web Map", max_items=10000)

for webmap_item in webmap_search:
  print({webmap_item.title})
  webmap = arcgis.mapping.WebMap(webmap_item)
  for layer in webmap.layers:
    print(f"- {layer.title if hasattr(layer, 'title') else 'Untitled Layer'}, {layer.url}")

 

 

GD2
by
New Contributor III

@cdickerson Thank you very much. Much appreciated. I will use this code to filter the web maps.

0 Kudos