Select to view content in your preferred language

Change the item properties (url) for feature layer of web map is not working.

03-19-2019 12:12 PM
New Contributor II

We've recently changed our production servers. I changed the url for the feature layers but the problem is, even if they are displaying correctly in AGOL, when I look at the json for the webmap feature layer objects,  the old server url is still being returned.


if req.status_code == 200:

   target = GIS('', 'myname', 'mypassword')
   newsearch ="", item_type = "Web Map", max_items = 1000)
   for item in newsearch:

      #test item
      if == "1111111111111111etc":

         filewriter.writerow([item.title, " ", item.owner, item.type, item.homepage, item.url]) 
         newmap = WebMap(item) 
            for layer in newmap.layers:
               my_dict = dict(layer)
               new_id = my_dict.get("itemId")
               layertype = my_dict.get("layerType")
               new_url = my_dict.get("url")


               nextstr = new_url.find("https://oldserver")
               if nextstr != -1: #found a url with old server name
                  newmap.update(item_properties='url':'https://myorg /arcgis/rest/services/Framework/Cadastral/MapServer/0'})

               #should mention that this method updates the url but the item is still pointing to the old service. 
               nexturl = my_dict.get("url")
               if new_id is not None:
                  #feature layer home page construct
                  filewriter.writerow([" ", layer.title, " ", layertype, my_dict.get("itemId"), my_dict.get("url"), layer.visibility]) 


 Any idea on how I can resolve this. The item is displaying correctly in AGOL (url property was changed) but when I query the web map, list out the feature layers, the old server name is still displayed which is a problem.

0 Kudos
0 Replies