|
POST
|
After working with ESRI support, if you are using a third-party IDP to log into Enterprise, you cannot access your layers through the Python API by logging in normally. You must either have built-in credentials to log in non-interactively, or, you must use a client ID workflow which requires interaction after your script starts to run. ESRI will not be working on fixing this issue because they have no way of knowing how users are prompted to log in with their IDP or how it is configured.
... View more
11-16-2020
06:26 AM
|
0
|
0
|
3203
|
|
POST
|
I'm trying to export out a markup layer so I can consume it in ArcGIS Pro as a KML file. I get two error messages when I run my code: Item type'text' is not supported for export, The item needs to be of type url Item '3aa84e15bffd45e39d9aaa44c8d928fd' is of invalid type 'Feature Collection' Item type for export needs to be 'Feature Service', 'Vector Tile Service' or 'Scene Service' How would I go about making my feature collection into a feature service? This is the code that returns the errors: markup = gis.content.search(query='owner:mfoley10_myUTK', item_type='Feature Collection')[0]
output = markup.export('test', 'KML') If I drill down far enough I can access a feature set, but feature sets don't have the property of exporting. #this is a list of feature collections [<FeatureCollection>, <FeatureCollection>, <FeatureCollection>, <FeatureCollection>]
layers = markup.layers
fset1 = layers[0].layer.featureSet
fset2 = layers[0].layer.featureSet
... View more
11-13-2020
10:14 AM
|
0
|
0
|
763
|
|
POST
|
I have the option to sign in with "ArcGIS login" instead of entering a URL for the enterprise login, however it does not work with my credentials. I do not think I am a built-in user but rather the users are created passively upon first logging into the enterprise login. Perhaps we use the enterprise identity store? I'm not the GIS Administrator here and I don't have access to look at how everything is setup unfortunately. I do know the admin can create built-in users though that can use the regular ArcGIS Login, perhaps that is the route to take, though it sounds like this idea won't work out anyway. Is there really no way to work with web GIS layers passively? I'm trying to retrieve markup layers that will be shared from the new Field Maps app by our field workers. It's a conglomeration of 25 states and I do not want them to mess around in the group they share their markup to because they have little knowledge of GIS and I fear they will mess with our maps unintentionally. I would rather simplify the process by just having them click on a button from a JS API developed map, do some processing with their markup layers and a couple feature classes, and then have all the layers they need "magically" downloadable or emailed to them. I already do this passively with data that sits on our server, I'm just trying to figure out a way to do it with the stuff that gets shared to AGOL too.
... View more
11-12-2020
10:30 AM
|
0
|
0
|
3236
|
|
POST
|
Thanks, but unfortunately this won't work for me. I can successfully use a client ID and OAuth 2 to authenticate, but I need this script to be non-interactive. Eventually I would like to publish it as a geoprocessing service so someone can click a button on a JS API built web map which will launch the script on the server and pull some data down from our web GIS to work with in ArcPy. I'm not even sure that's something that will work, but I can try it if I could just log into our portal passively.
... View more
11-12-2020
09:31 AM
|
0
|
2
|
3252
|
|
POST
|
I'm having trouble connecting to our portal and I think it's because we get redirected to a separate sign in that's not hosted by ESRI (e.g. I enter our organization's URL, the button changes to reflect our organization name and after clicking that it redirects me to our university's sign in, then it authenticates me and redirects me to our portal home page). So it's a third-party identity provider being used... my university username (xxx) that I have to use in the login I am redirected to differs from my portal username (xxx_orgName), though I have tried both and neither work. How do you connect to your web GIS when you have a third-party identity provider? #Using IDP username
gis = GIS("https://domain.com/web_adapter", "xxx", "myPassword")
#Using username that appears when I am logged into the portal
gis = GIS("https://domain.com/web_adapter", "xxx_myOrg", "myPassword")
... View more
11-12-2020
09:00 AM
|
0
|
5
|
3267
|
|
POST
|
Apologies in advance as this question could fit in many different sections on the board, but hopefully someone will understand what I'm asking here! I need to be able to access our web GIS through a published geoprocessing service to pull down layers that were shared from the new Field Maps application (namely, I need to get markup layers). I have a web map that was built using the Javascript API and I'm envisioning a button to run the geoprocessing service as I do with so many others. Here's the workflow I need: 1) Click button on web map built with ArcGIS API for Javascript 2) It runs a geoprocessing service on the server. This geoprocessing service contains the arcgis module. 3) arcgis module logs into AGOL or Portal (I haven't figured it out yet), navigates to a group, and pulls down the markup layers. I will then use arcpy to manipulate them how I want (inside the same script) and then send an email to the user with the resulting FGB in a zip file. I have many geoprocessing services running arcpy scripts when a button is clicked on the web map built with JS, but I'm unsure if the arcgis module can be run on the server (ArcGIS Enterprise 10.7). Has anybody successfully done something like this?
... View more
11-12-2020
06:15 AM
|
0
|
1
|
1562
|
|
POST
|
On the screen to share markup, I only want to share it with one group in my organization. I do not want to share it with my whole organization or publicly. When I slide the button to share it with this group and hit okay, everything appears to work fine. When I log into ArcGIS Online on my desktop though, the Markup is only viewable in my content and it is was not shared with the group I selected in the Field Maps app. Any insight?
... View more
11-12-2020
06:05 AM
|
1
|
5
|
2868
|
|
POST
|
Thanks for the suggestion - I ended up doing that first and when I found I could have simultaneous edit sessions on the same workspace, I went a step further to make sure that "update row" could be done simultaneously on different feature classes in the same workspace. I made two identical python files using a different feature class in each and set them up to run on task scheduler to launch at the same time; worked just fine. Then I tried putting two editors in the same script with one editor stopping editing before the other: arcpy.env.workspace = os.path.join(aPro_db_con, "CollectorSpatialData_CollectorWriter.sde")
cc = "CollectorSpatialData.DBO.HbTestLine"
fc = os.path.join(arcpy.env.workspace, cc)
cc2 = "CollectorSpatialData.DBO.HbTest"
fc2 = os.path.join(arcpy.env.workspace, cc2)
editor = arcpy.da.Editor(arcpy.env.workspace)
editor.startEditing(False, False)
editor.startOperation()
editor2 = arcpy.da.Editor(arcpy.env.workspace)
editor2.startEditing(False, False)
editor2.startOperation()
with arcpy.da.UpdateCursor(fc, ['TestField']) as uCursor:
for row in uCursor:
row[0] = 1
try:
uCursor.updateRow(row)
except:
print(traceback.format_exc())
del uCursor
editor.stopOperation()
editor.stopEditing(True)
if editor2.isEditing == True:
with arcpy.da.UpdateCursor(fc2, ['TestField']) as uCursor:
for row in uCursor:
row[0] = 1
try:
uCursor.updateRow(row)
except:
print(traceback.format_exc())
del uCursor
editor2.stopOperation()
editor2.stopEditing(True)
del editor2
print("Finished.") This is where the problems begin. In reality, my two scripts that edit the same workspace are not identical and one will finish editing in that workspace before the other one; if an edit session ends on that workspace in one script, will it still keep the edit session in the other script alive? Using the script above, the answer is seemingly yes; when I checked editor2.isEditing it was True, but when I updated the row and ran editor2.stopOperation() I received this error: editor2.stopOperation() SystemError: <built-in method stopOperation of Workspace Editor object at 0x000002473EEF8FC0> returned NULL without setting an error My guess is that edit session is now "confused" by the other edit session stopping in the same process, thus it will not be able to save edits. To test my theory further, I went back to my two identical scripts that launch at the same time. I wondered if the fact that they're launching in entirely separate processes made a difference. I added time.sleep(60) after instantiating the edit session in one of them to make the script pause for a full minute. That full minute gave the other script a chance to finish editing and stop the edit session on the workspace before the other script starts the update the row on a feature class in its own edit session on that same workspace. Both scripts completed without error. Conclusion: If the edit sessions are launched in different processes, then they should be able to run simultaneously without erroring, regardless if one finishes editing before the other.
... View more
10-13-2020
06:36 AM
|
0
|
0
|
4117
|
|
POST
|
I have two python scripts that are scheduled to run at 12:00 AM everyday that edit different feature classes in the same non-versioned enterprise geodatabase. I haven't yet run them at the same time because I'm not sure if two edit sessions being launched within minutes of each other on the same database is possible, and I don't want to screw with any existing data until I have a better answer. Basically, each script calls this exact same piece of code (same workspace): #Start editing session
arcpy.AddMessage("Starting editing session...")
try:
editor = arcpy.da.Editor(collector_db_con)
editor.startEditing(False, False)
editor.startOperation()
except:
raise EditingErr(traceback.format_exc()) I looked at information about locks and it appears that locks apply to individual datasets so there shouldn't be conflicts there since the feature classes being edited by the two scripts are different, but I would like more clarity since editing sessions are initialized on the entire workspace. I can foresee getting errors. Before anyone suggests I merge the two scripts together, there are reasons they are separate and I will not be merging them. If two edit sessions cannot be done on the same workspace simultaneously, then I will just schedule them differently.
... View more
10-10-2020
04:26 PM
|
0
|
2
|
4177
|
|
POST
|
Well...my code works again after doing absolutely nothing that makes any logical sense to fix it. I have absolutely no confidence that I won't encounter this problem again, so it'd be nice to still find a real solution to this problem. Anyway, these are the exact steps I took: 1) Set up script to run an update cursor on another feature class (I did not test with a feature layer) from the same SDE database. 2) Put a breakpoint on a line or two before you create the update cursor 3) Run in debug mode, and when you hit the breakpoint, hit continue to run through the rest of the code without stepping through it 4) Check that it updated the field you wanted it to when it's finished running 5) Change the value to update and run in debug mode again, this time stepping through each line. It should work as expected. 6) Run script that was having issues before (which had a feature layer in the update cursor instead of a feature class in this case - I did not change it to a feature class and left it as a feature layer), putting a breakpoint a line or two before you create the cursor and step through. It should work as expected. Note that this was specific to each IDE. I had to follow the same steps in each IDE to fix it for each one. Fixing one IDE does not mean the code will run in the other one.
... View more
09-26-2020
05:11 PM
|
0
|
0
|
1856
|
|
POST
|
Not sure what you mean by I ruled it out? I don’t see a difference between your code and my code other than being in one line instead of two. The Get Count will resolve before it tests the conditional if that’s what you’re concerned about. You can definitely have breakpoints inside of conditionals or on an "if" line. Even if I put the breakpoint one line before the "if" statement, I get the same results. Regardless, in my actual script I don’t have that conditional there, I just put that in to show that list(uCursor) should have items in it if it gets past that conditional, which when I step through, it does get inside the conditional when I test my code with one. I really don't think this is a code problem because otherwise my code wouldn't run if I run it without debugging.
... View more
09-26-2020
03:06 PM
|
0
|
0
|
1856
|
|
POST
|
I am trying to debug my scripts which include multiple search/update cursors in them. Any time I set a breakpoint, the cursors will not populate. If I set no breakpoints, the script runs exactly as I want it too, so it does not appear to be a coding problem. I am working with Pro 2.6.1. I have tried two different IDEs, Visual Studio Enterprise 2019 version 16.7.4 and PyCharm 2019.3. I have also tried using ArcMap Python 2.7 interpreter and a regular file geodatabase instead of an SDE db to no avail. These are the two different ways in which I have tried to set my breakpoints and step through the code. First, I tried to set the breakpoint before initiating the cursor and then I just step over lines until the for loop is hit. It then skips directly to the "del" statement and does not enter the for loop, even though the cursor should be selecting many features: if int(arcpy.GetCount_management(coveyCountFL).getOutput(0)) >= 1: ### BREAKPOINT HERE ###
with arcpy.da.UpdateCursor(coveyCountFL, ['GlobalID', 'EditingPhase', 'created_date']) as uCursor:
for coveyCountRow in uCursor:
coveyCountRow[1] = 'Not available for editing.'
try:
uCursor.updateRow(coveyCountRow)
except:
print(traceback.format_exc())
del uCursor If I place the breakpoint inside the for loop, it does actually stop (like it should), but then it errors when trying to update the row. if int(arcpy.GetCount_management(coveyCountFL).getOutput(0)) >= 1:
with arcpy.da.UpdateCursor(coveyCountFL, ['GlobalID', 'EditingPhase', 'created_date']) as uCursor:
for coveyCountRow in uCursor:
coveyCountRow[1] = 'Not available for editing.' ### BREAKPOINT HERE ###
try:
uCursor.updateRow(coveyCountRow) ### THROWS EXCEPTION HERE ###
except:
print(traceback.format_exc())
del uCursor Traceback (most recent call last): File "E:\NET_Projects\CollectorGPServices\FallCoveyCount\test.py", line 63, in <module> uCursor.updateRow(coveyCountRow) StopIteration: iteration not started As I step through the code, I have checked list(uCursor) in the watch window to see what it returns. Sometimes it remains an empty list [], other times it returns things, but then if you add "coveyCountRow" in the watch window, list(uCursor) turns to [] so it seems the cursor is always empty even if it says it is not for a second. I really need to be able to debug my code outside of Pro... has someone figured this issue out yet??
... View more
09-26-2020
12:29 PM
|
0
|
3
|
1939
|
|
POST
|
Whenever I export my layout to a PDF, the labels don't show up. They're not in a separate label layer or anything, they're just simply labeled features. I'm using ArcGIS Pro 2.6. I'm new to Pro - is there some sort of option I need to switch on to get the labels to show when the map is exported as a PDF? I've tested exporting to a JPG and the labels export fine that way. Edit: I tested printing to a PDF and it worked. So exporting to a PDF must just be a bug?
... View more
09-14-2020
08:51 AM
|
0
|
8
|
17154
|
|
POST
|
Sorry - it's not the actual path, I just didn't want to put the whole thing in.
... View more
08-25-2020
12:54 PM
|
0
|
1
|
1837
|
|
POST
|
I recently switched from ArcMap to ArcGIS Pro and am having trouble getting multiprocessing to work in an old script. It worked at one point in ArcMap, but recent testing shows it no longer works with a Python 2.7 interpreter either, so it needs to be overhauled in a way I can't figure out. Literally the only reason I need to run this in a separate process is because calling a script tool (TableToExcel) in a standalone script while debugging means none of the breakpoints will be hit after I run that line in my IDE (Debugging with ArcPy breakpoints after Point to Line). Any insight on how to get this working a separate process would be appreciated... import os, arcpy, multiprocessing
def tbl2excl(lyr, path):
arcpy.TableToExcel_conversion(lyr, path, 'ALIAS')
arcpy.env.overwriteOutput = True
if __name__ == '__main__':
#Get the data and do a couple things
fileName = now.strftime("%Y-%m-%d")
p = multiprocessing.Process(target=tbl2excl, args=(countSelection, os.path.join("E:\GIS_Testing\xxx", fileName + "_Counts.xls")))
p.start()
p.join() It just gets hung up after running p.join() and never stops. I assume it's erroring out in the new process somewhere, but I can't bring those error messages up to the parent script despite my efforts. If I don't try to run it in a separate process it doesn't error, so it's something specific to the multiprocessing, not using the TableToExcel tool itself.
... View more
08-25-2020
12:41 PM
|
0
|
5
|
1910
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-18-2020 10:31 AM | |
| 2 | 09-16-2025 02:17 PM | |
| 3 | 09-12-2025 09:26 AM | |
| 1 | 08-16-2023 05:11 PM | |
| 1 | 02-27-2024 06:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
09-16-2025
02:16 PM
|