|
POST
|
I have a Python script that is run as a scheduled task every night. It updates a service definition on AGOL using arcpy.UploadServiceDefinition_server. When I first set this up, we had ArcMap 10.4 and Server 10.2. To get around needing to be signed in to ArcGIS Online, I would sign into AGOL through ArcMap and just never sign out. This got around the fact that arcpy.SignInToPortal_server no longer worked. Recently, we upgraded Server to 10.4, so that all versions are the same. Now, ArcMap automatically signs you out of AGOL every day, so when the script runs, it throws the error that you aren't signed in and the service definition never gets updated. Is there any work around to this? What is different about the Server being upgraded to 10.4 that made the change? Any help is appreciated.
... View more
12-20-2016
10:50 AM
|
0
|
11
|
5142
|
|
POST
|
Figured it out. I thought I had read that overwrite = True couldn't be used with publishItem and didn't see it in the documentation, but this line seems to work.... result = user.publishItem(fileType="Shapefile", publishParameters=publishParams, itemId=itemId, overwrite = True)
... View more
12-13-2016
02:09 PM
|
0
|
2
|
5797
|
|
POST
|
Well, I have found a work around to this by looping through the shapefiles, zipping them up and publishing them individually instead of all together. The only problem I am having now is that when the script is rerun, it gets to the arcrest.manageorg.PublishShapefileParameter and throws the error that the service name already exists and thus can not run the user.publishItem. Does anyone know of a way to delete the hosted feature service first before publishing? I've tried looking through other scripts but only find ways to delete records within in the feature service and not the entire thing. Any help would be appreciated.
... View more
12-13-2016
11:45 AM
|
0
|
0
|
5797
|
|
POST
|
We went ahead and upgraded Server to 10.4. No problems now, so versions do have to be the same.
... View more
12-12-2016
08:44 AM
|
0
|
0
|
1181
|
|
POST
|
Thank you for your reply. Both of these examples involve creating an .MXD and thus a service definition. I was kind of hoping to avoid this. I already have the shapefile up there from the script that runs addItem(). I don't know if it is possible to do without creating an SD or if that is the route that I need to take.
... View more
12-08-2016
09:40 AM
|
0
|
0
|
5797
|
|
POST
|
We are trying to automate data updates on our AGOL site. I have a script that zips up 4 shapefiles and uploads this to a specific folder in our Content. There is also a Feature Layer sitting in the folder created from the Shapefile data. Manually, you can open the Feature Layer and hit the 'Overwrite' button to update it. How do you program Python to achieve this same thing? I also played around with having python publish a new Feature Layer after it uploads the shapefile, but haven't found any examples where the shapefile sitting in the directly has multiple shapefiles in it. Hopefully, this all makes sense. Any help would be appreciated.
... View more
12-07-2016
04:17 PM
|
0
|
9
|
9525
|
|
POST
|
Thank you! I will see if I can find a machine with 10.2.2 on it!
... View more
12-06-2016
09:48 AM
|
0
|
0
|
1181
|
|
POST
|
I have been trying to publish both a Geoprocessing Service (a buffer tool) and a printing service to use in a Web AppBuilder Developer app hosted on our local server. After going through the process, although they show up in the Services Directory, neither has a task. I am creating both through the Results Window of ArcGIS 10.4 and our ArcGIS Server that they are sitting on is 10.2.2. This is the first time trying to host a web app on a local machine, so this is all new to me. Is the difference in versions the problem or am I missing something else. Any help would be appreciated!
... View more
12-02-2016
09:52 AM
|
0
|
1
|
1190
|
|
POST
|
Thank you so much! I was thinking that I may have it in the wrong category.
... View more
12-02-2016
09:48 AM
|
0
|
0
|
1181
|
|
POST
|
I have been trying to publish both a Geoprocessing Service (a buffer tool) and a printing service to use in a Web AppBuilder Developer app hosted on our local server. After going through the process, although they show up in the Services Directory, neither has a task. I am creating both through the Results Window of ArcGIS 10.4 and our ArcGIS Server that they are sitting on is 10.2.2. This is the first time trying to host a web app on a local machine, so this is all new to me. Is the difference in versions the problem or am I missing something else. Any help would be appreciated!
... View more
11-30-2016
12:30 PM
|
0
|
5
|
2260
|
|
POST
|
Did you ever figure this out? I am having the same exact problem.
... View more
11-08-2016
12:24 PM
|
0
|
1
|
1003
|
|
POST
|
Hi Kelly, I have a python script that takes an MXD and creates a service definition from it. Then using arcpy.UploadServiceDefinition_server, it is supposed to overwrite the service definition on our ArcGIS Online site. The script runs on our server that has ArcGIS 10.4. I have looked and haven't had any success in finding a way to have my python script delete the current service definition and hosted feature service in our content. I had read that this was a more efficient way of updating rather than relying on the overwrite. I currently do not have anything in my script to do this --- so no errors. Is there a way to delete what is currently sitting in our AGOL before the script runs this.....??? arcpy.UploadServiceDefinition_server(UploadSD, My_Hosted_Services, "", "", "FROM_SERVICE_DEFINITION", "", "STARTED", "OVERRIDE_DEFINITION", "SHARE_ONLINE", "PUBLIC", "SHARE_ORGANIZATION","") -Cindy
... View more
09-26-2016
12:11 PM
|
0
|
1
|
1585
|
|
POST
|
I am writing a python script that will update a service definition in ArcGIS Online - to synchronize changes made by Desktop users. One question/answer that I found suggested 'deleting a service before publishing a replacement service, rather than overwriting'. I can't seem to find the right syntax to delete the old service definition. I'm assuming it uses ArcRest, but I can't seem to figure out how to code this. Any help would be appreciated. I am new to using ArcRest.
... View more
09-16-2016
02:47 PM
|
0
|
3
|
3086
|
|
POST
|
Just to follow up on this, I did get the script working. It was a matter of adding this piece before the user.exportItem..... admin = arcrest.manageorg.Administration(securityHandler=shAGOL) content = admin.content portal = admin.portals.portalSelf commUsers = portal.users(start=1, num=100) commUsers = commUsers['users'] for commUser in commUsers: user = admin.content.users.user(commUser.username) for userItem in user.items: sItem = userItem.id sName = userItem.name sType = userItem.type sUser = commUser.username if sUser == "YakimaStormwater": if sType == "Feature Service":
... View more
09-09-2016
08:50 AM
|
1
|
0
|
1317
|
|
POST
|
We got it figured out. It was later on in the coding. It was a matter of changing the line user = admin.content.users.user(username=item.owner) to user = admin.content.users.user(username=username). It does lead me to another question, though. The purpose of our python code is to back up the feature layers that others are creating and updating on AGOL. Right now, the python code looks for a specific ItemID....is there a way to have the code go into a Members content and list all of their feature layers and itemIDs? This would be ideal since we may not be notified every time someone creates a new layer. Does that make sense? I haven't found a script that does it that way.
... View more
09-02-2016
10:33 AM
|
0
|
2
|
1317
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-23-2017 03:14 PM | |
| 2 | 01-08-2020 09:01 AM | |
| 1 | 09-09-2016 08:50 AM | |
| 1 | 10-10-2019 10:45 AM | |
| 2 | 11-02-2018 11:23 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-20-2026
12:22 PM
|