POST
|
I am building a Python Toolbox out of ArcPro 2.5 and setting a MapFrame_Element Camera scale as well, and originally had the Layout Map Frame element with a Display Options Constraint of Fixed Scale. If this was set to Fixed, the python code could not change the scale, but if it was set to None, and I saved the Project (important if you're doing arcpy.mp.ArcGISProject('CURRENT'), it would change the map frame scale from the map frame. The problem is that there is no indication of this fact. It is very implicit (maybe it should seem obvious) Thank you @ThomasKölbel for making this point evident.
... View more
01-08-2021
06:42 AM
|
0
|
0
|
3505
|
POST
|
This is a continuing question to another I asked recently. I have a toolbox that is being used to update versioned data using arcpy.da.Editor using a user-provided database connection which points to their version. When the script has completed successfully, the user would then review the changes made by the toolbox to ensure it had the intended effect (manual QA/QC). The issue is that if the changes were not correct, the user would then have to delete their used version to drop the implicitly, reconciled information stored upon the completion of the arcpy.da.Editor edit session. The other issue is that in the past, deleting a version, then recreating it with the same name seems to re-point the new version to the deleted version (I need to test this part more). Is there a better process behind undoing a versioned edit session than deleting the version used?
... View more
10-10-2019
10:33 AM
|
0
|
0
|
432
|
POST
|
You're welcome, I also made a thread about the error SystemError: error return without exception set where I tested a number of cases where the error arose, and I found that it seems to happen in one case where you try to enter an edit session from arcpy.da.Editor, then later (after successful completion) with the ArcMap Editor Toolbar Editing tools. I linked it below. SystemError: error return without exception set ; arcpy.da.Editor
... View more
10-10-2019
06:23 AM
|
0
|
0
|
3169
|
POST
|
EDIT: It seems this did not resolve my problem entirely as it still seems to randomly lock the version. Here is the interesting part, if I use Reconcile Versions using the Database Connection point to the Version that did the edits and will be Reconciled and Posted, it may lock the version, and block entering an edit session with that version. If I do not use a Database Connection that points to that Version, it may still lock the version, but I will be able to enter an Edit Session using the Editor Toolbar, and then use the Versioning toolbar to Reconcile and Post, and it will remove the lock. Like I mentioned originally, it is absolutely bizarre to me. You made a good point, so I decided to test out a number of cases to determine what would cause the error and resulting version lock. There is some difference on how the arcpy.da.Editor editing session works / ends and how ArcMap's Editor Toolbar > Versioning Toolbar (GUI Session) works in the end. The way I have avoided this error was to only use the Data Management Reconcile Versions geoprocessing tool. By reconciling and posting with that, I could continue using my tool without the error arising. The error seemed to occur when I would run my tool successfully, enter an edit session using the Editor Toolbar and Reconciling and Posting, then running my tool again wherein it would fail before the arcpy.da.Editor Session could begin. The testing process was as follows: All cases of running my tool were outside of an ArcMap Editor Toolbar editing session. Case 1 (FAIL): Run tool many times and reconcile and post using Editor Toolbar and Versioning Toolbar. I ran my tool using a database connection that was pointed to a specific version numerous times without reconciling and posting. I then entered an edit session using the Editing Toolbar and using the Versioning Toolbar to reconcile and post. I ran my tool again, and it failed with the SystemError: error return without exception set. I closed ArcMap and killed it's process. I ran the tool again numerous times, and followed the above bullet, failing again. Case 2 (SUCCESS): Restart ArcMap, run tool, use Reconcile Versions geoprocessing tool to Reconcile and Post on my version. Ran tool again, and it successfully runs. Case 3 (FAIL): Consider possibility of there being a hidden lock after ArcMap GUI Reconcile and Post Ran my tool, use ArcMap GUI, and wait some arbitrary time (~5 Minutes) Ran my tool again, SystemError: error return without exception set Case 4 (SUCCESS): Test to see if ArcMap GUI works after Reconcile Versions geoprocessing tool Ran my tool successfully, run Reconcile Versions geoprocessing tool Enter ArcMap GUI editing session and reconcile and post Run my tool again after successfully. This might resolve my immediate issue, but I still hesitate to consider this solved without there being further discussion on the differences between the ArcObjects/Arcpy editing versus the toolbars in ArcMap.
... View more
10-09-2019
01:17 PM
|
0
|
0
|
1507
|
POST
|
I have had this never-ending question regarding how to run a Python Script to make updates to Versioned data. How can I enter an Edit Session, on a pre-existing version, complete the edit session, review the changes, then reconcile and post WITHOUT causing a schema lock. For some background, the below script is not in it's entirety: I have created a database connection that is pointing to the intended, pre-existing version. The update cursor reads and updates a feature class using the above database connection. The update cursor completes successfully, updating correctly. It is intended that the user will then manually review the changes, if the changes are good, reconcile and post. If bad, delete the version (I need a better process for this as well). The Problem: If the user enters an ArcMap Editor Toolbar Edit Session post update, checks everything, reconciles and posts. It works, no locks. Then, if you run the tool again, SystemError: error return without exception set. If I go to the Version Manager to view current locks, there is a lock on that version even after successful rec/post. How does one prevent this lock from occurring. The python editing process is not documented in depth enough, and does not touch on how the delta tables are affected (I have tried to research the ArcObjects docs, which are mostly copied and pasted into arcpy). Why would I have schema locks if I am editing in one toolset vs. the other, but they're taking place after operations? I have tried many workarounds, numerous times, yet I am clearly missing something. ## Editor Class
"""
https://gis.stackexchange.com/a/158627
"""
def find_ws(path, ws_type=''):
"""finds a valid workspace path for an arcpy.da.Editor() Session
Required:
path -- path to features or workspace
Optional:
ws_type -- option to find specific workspace type (FileSystem|LocalDatabase|RemoteDatabase)
"""
# try original path first
if os.sep not in path:
path = arcpy.Describe(path).catalogPath
desc = arcpy.Describe(path)
if hasattr(desc, 'workspaceType'):
if ws_type and ws_type == desc.workspaceType:
return path
elif not ws_type:
return path
# search until finding a valid workspace
SPLIT = filter(None, path.split(os.sep))
if path.startswith('\\\\'):
SPLIT[0] = r'\\{0}'.format(SPLIT[0])
# find valid workspace
for i in xrange(1, len(SPLIT)):
sub_dir = os.sep.join(SPLIT[:-i])
desc = arcpy.Describe(sub_dir)
if hasattr(desc, 'workspaceType'):
if ws_type and ws_type == desc.workspaceType:
return sub_dir
elif not ws_type:
return sub_dir
class EditorUpdateCursor(object):
"""Wrapper class for arcpy.da.UpdateCursor to automatically
implement editing (required for versioned data, and data with
geometric networks, topologies, network datasets, and relationship
classes"""
def __init__(self, *args, **kwargs):
"""init wrapper class for update cursor Supported args:
in_table, field_names, where_clause=None, spatial_reference=None
explode_to_points=False, sql_clause=(None, None)"""
self.args = args
self.kwargs = kwargs
self.edit = None
def __enter__(self):
ws = None
if self.args:
ws = find_ws(self.args[0])
elif 'in_table' in self.kwargs:
ws = find_ws(self.kwargs['in_table'])
self.edit = arcpy.da.Editor(ws)
self.edit.startEditing()
self.edit.startOperation()
return arcpy.da.UpdateCursor(*self.args, **self.kwargs)
def __exit__(self, type, value, traceback):
if traceback is None:
self.edit.stopOperation()
self.edit.stopEditing(True)
self.edit = None
else:
self.edit.abortOperation()
self.edit.stopEditing(False)
self.edit = None
## Update Logic
if updatedStructuresCount > 0:
arcpy.AddMessage('\nPole Numbers are being updated...')
for structure in structureDict:
where = """GLOBALID = '{}'""".format(structure)
with editUpdCursor.EditorUpdateCursor(strPath, ['POLENUMBER'], where) as cursor:
for row in cursor:
newPoleNum = structureDict.get(structure)
row[0] = newPoleNum
cursor.updateRow(row)
arcpy.AddMessage('Pole Numbers update complete...')
... View more
10-09-2019
07:04 AM
|
0
|
2
|
1730
|
POST
|
You should have a syntax error 'SyntaxError: EOL while scanning string literal' due to your fields variable, which should be a list. You have a logical error that prevents the row from being updated within the Update Cursor unless the conditional is satisfied; disregard if that is intentional.
# Original
fields = "CREATE_BY", "CHANGE_BY" # Not a list as would be expected
for fc in fcList:
if len(arcpy.ListFields(fc,"CREATE_BY"))>0:
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
if row[0] == "domain" + "\\" + user_old:
row[0] = "domain" + "\\" + user_new
if row[1] == "domain" + "\\" + user_old: #<--- Conditional
row[1] = "domain" + "\\" + user_new
cursor.updateRow(row) # <------ Here
arcpy.AddWarning("field in " + fc + " updated")
# Updated
fields = ["CREATE_BY", "CHANGE_BY"] # Is a list, and is expected
for fc in fcList:
if len(arcpy.ListFields(fc,"CREATE_BY"))>0:
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
if row[0] == "domain" + "\\" + user_old:
row[0] = "domain" + "\\" + user_new
if row[1] == "domain" + "\\" + user_old:
row[1] = "domain" + "\\" + user_new
arcpy.AddWarning("field in " + fc + " updated")
cursor.updateRow(row) # <------ Will update if first cond. True
"""The original would only update your row when the conditional below is True:
if row[1] == "domain" + "\\" + user_old:
The cursor.updateRow(row) was placed inside of the first conditional
since it is assumed that you'd like it to only update when an update
occurs.""" As for the 'SystemError: error return without exception set' error, this error is fleeting, and I have not figured out the exact reasoning for it either, but what you will likely find is that the version you were accessing has a schema lock on it. The only way to remove this lock is to have your SDE admin disconnect it, or close out of ArcMap, and possibly kill the ArcMap.exe process in the Task Manager. I have found that this schema lock will happen when you are in an edit session through ArcMap's Editor Toolbar, and you try to run the arcpy.da.Editor tools on that versioned data, or the opposite, you run arcpy.da.Editor, then try to use the Editor Toolbar. I have yet to figure out the best way to be able to view the changes, and completely prevent this lock from occurring. On another note, after a successful run of your script, if your Table of Contents in ArcMap is set to the versioned data source of your update, you can go up to the Versioning Toolbar, and click on Refresh, and it will pull your changes to be viewed, in or out of a Editor Toolbar Edit Session.
... View more
10-09-2019
06:37 AM
|
1
|
2
|
3169
|
POST
|
Phil, That seems fair. We have opened the survey on mobile devices without issue. I resized those images while following this link: https://community.esri.com/groups/survey123/blog/2017/09/19/optimizing-images-for-survey-forms So the final consensus is the image resolution causing the crashes? That makes more sense due to the images occasionally not loading on Connect. Thank you for working with me on this. Paul
... View more
02-05-2018
06:03 AM
|
1
|
0
|
1144
|
POST
|
Philip, Generally speaking, the crashing seems to occur whenever I do anything while the survey is loading, and especially when I am signed into AGO. Location Services: As for the crash pop-up box, I do not even receive that. I have attached an example from Jan. 1, 2018 from the Windows Event Viewer (.txt) detailing the crash. I have attached the survey folder (.zip) for the 'complex' one. ~~Frustratingly, now Survey123 is not crashing on me through the usual means. I have made some small changes as you will see in the zipped folder, but the three images are unchanged. Thanks, Paul
... View more
02-02-2018
06:10 AM
|
0
|
2
|
1144
|
POST
|
Generally it seems that my 'complex' survey has a lot going on in such a way that it causes Survey123 Connect to crash. It almost seems like there may be a memory leak. The crashes always seem to occur when anything is done while the 'complex' survey is opening, or when logged into AGO. I have attached my .xlsx(s) for both the 'complex' survey and a more simple one. Complex = 'Southerly_Quarterly......xlsx' Simpler = 'FleetServices' Another issue with the Complex survey is the embedded images do not open consistently. Thanks, Paul
... View more
02-01-2018
05:35 AM
|
0
|
5
|
1144
|
POST
|
John, I have had some success logging into AGO from Survey123 Connect, but I still have the same issue. Here is the scenario: I open Survey123 Connect on my PC. I use the 'Sign In' button in the upper-right hand corner of the Front Page. I sign-in, no problem. I go to open my survey: If I open a simple survey, I have no crashes. Simple surveys include typical questions, the ability to take pictures or geopoints, or were designed from an existing Feature Layer The complex survey, the only survey I have issues with involves stored media, many questions with constraints or relevancies, and at least one complex calculation. This is the survey that crashes on me. The other option includes not signing into AGO using Scenario 1, opening my complex survey, and signing into AGO after the survey form has been opened. The sign-in button is the 'person-shaped' icon in the lower-left hand corner of 'My Survey.' No crashes. This leads me to think that both the complexity of my form, and other background processes always lead Survey123 Connect to crash. To add to this, I even tried, in the same session, logging out of AGO, and trying to open my complex survey, which still leads to a crash. Are there any other ideas for me to try?
... View more
01-31-2018
12:34 PM
|
0
|
7
|
1144
|
POST
|
John, I will try my best since the PCs are maintained separately by our IT Department. I am certainly running Windows 7 Professional with SP1. Microsoft: .NET Framework 4.5.2 Visual C++ 2005 Redistrib. Visual C++ 2005 Redistrib. (x64) Visual C++ 2008 Redistrib. x86 9.0.30729.17 Visual C++ 2010 x64 Redistrib. 10.0.40219 Visual C++ 2010 x86 Redistrib. 10.0.40219 Visual C++ 2012 Redistrib. (x64) 11.0.50727 Visual C++ 2012 Redistrib. (x86) 11.0.50727 There are no further windows updates available to me. I have attached my system specs to this post.
... View more
01-31-2018
05:51 AM
|
0
|
0
|
1144
|
POST
|
Hello, I am writing this to potentially report a bug. I am running Version 2.6.4 of Survey123 Connect, and it runs perfectly fine when I create and run surveys locally. As soon as I log into ArcGIS Online (AGO) and open my existing survey, Survey123 crashes. At first I thought this had to do with certain fields that I had added, but this does not seem to be the case. I have attached the three log files that all represent attempts to login withing minutes of each other. The smaller files seem to indicate why the program crashed.
... View more
01-30-2018
08:48 AM
|
0
|
10
|
1613
|
POST
|
Thanks for getting back to me James, I have looked into your formula, and it was close to what I needed. I looked through other solutions for excel, and came up with this formula. concat("Q",int((int(format-date(${INSPECTION_DATE}, '%n'))+2) div 3)) This ensures my quarters are: Q1: Jan 1 - Mar 30 Q2: Apr. 1 - Jun 30 Q3: Jul 1 - Sept 30 Q4 Oct 1 - Dec 31 I appreciate you giving me the right footing. This will not somehow be affected by epoch timing, or some other standard, correct?
... View more
01-29-2018
01:39 PM
|
1
|
0
|
1000
|
POST
|
Hello all, I wanted to see if anyone had an idea for auto-filling a text field with the correct year quarter based on a series of IF-THEN statements. I am having an error. This is what I presently have: IF(AND(${INSPECTION_DATE}>=DATE(YEAR(${INSPECTION_DATE}),1,1),${INSPECTION_DATE}<=DATE(YEAR(${INSPECTION_DATE}),3,31)),"Q1",IF(AND(${INSPECTION_DATE}>=DATE(YEAR(${INSPECTION_DATE}),4,1),${INSPECTION_DATE}<=DATE(YEAR(${INSPECTION_DATE}),6,30)),"Q2",IF(AND(${INSPECTION_DATE}>=DATE(YEAR(${INSPECTION_DATE}),7,1),${INSPECTION_DATE}<=DATE(yEAR(${INSPECTION_DATE},9,30)),"Q3",IF(AND(${INSPECTION_DATE}>=DATE(YEAR(${INSPECTION_DATE}),10,1),${INSPECTION_DATE}<=DATE(YEAR(${INSPECTION_DATE}),12,31)),"Q4")))))
Basically, there are a series of nested IF statements where I am trying to define the range for each quarter of the year. I am using a field that uses a TODAY() [${INSPECTION_DATE} is TODAY()] function to define the correct year for this calculation. Of course this statement works well within Excel itself, but not so much for Survey123 where it cannot parse through my statement. I think it has everything to do with not having the AND(), DATE(), YEAR() functions added into its framework, or having different functionality. I may also be overwhelming the parser. My ultimate question is if there is a way to calculate a range of dates that are based on set quarters (month and day), and auto-fill a text field with the correct quarter (Q1, Q2, Q3, Q4) based on the result. Like I said, the above function works in Excel, but not for the XLSForm syntax. This is all there really is to it. This field is intended to be read-only and auto-calculated for field inspections.
... View more
01-29-2018
08:39 AM
|
0
|
2
|
2737
|
POST
|
I was having an issue with this as well, and your solution proved to be the solution. My guess is this is simply due to the change in HTML protocol (HTML 5), and the general migration to that protocol by virtually all current websites. ArcMap, unfortunately, is still routed to the old domain name.
... View more
12-08-2017
06:10 AM
|
0
|
0
|
878
|
Title | Kudos | Posted |
---|---|---|
1 | 01-29-2018 01:39 PM | |
1 | 10-09-2019 06:37 AM | |
1 | 02-05-2018 06:03 AM |
Online Status |
Offline
|
Date Last Visited |
01-08-2021
02:28 PM
|