POST
|
Well, this thread certainly help explain things. I was having the exact same problem, and it was interfering with selections in my table and map (the map was jittery, flashing between multiple selections from multiple sources). I rather wish I had the ability to just make the Feature Info a reactive source - so that someone could select an asset in a table or on the map and it would show the feature info and attachments since the order of my assets is not of importance. A list wouldn't really help with my issue, so I'm going to try the filter widget and see if that helps.
... View more
Wednesday
|
0
|
0
|
14
|
POST
|
I'm having an issue with a map series / data driven pages set of scripts.
... View more
a week ago
|
0
|
1
|
78
|
POST
|
First thing I did. Compared it and it is exactly the same, baring the connection pathway. This is driving me nuts. I've also got a Reconcile Versions python tool holding onto a previous run settings where I ran only one version, even when the tool has 5 versions as inputs. Lord save me! 😑
... View more
a week ago
|
0
|
1
|
78
|
POST
|
So I have a script that is supposed to update tile caches on the server, and it is putting out messages that it is completing successfully. However, this tool is completing in less then 10 seconds for two different service caches. Running the tool manually is around 10 minutes or more for one of these, as the tiles are updating based on an AOI with hundreds of polygons. My server is old and slated for upgrade, and we routinely have to restart it as it's hanging onto old cache tiles. I don't think the python cache update is working, but again it is difficult to tell due to the server hanging onto old tiles. My Spidey senses are tingling - the script really shouldn't take less then 10 seconds, should it? Edit: I just converted this to Python 3, it worked perfectly in 2.7 and took about 12 minutes.
... View more
a week ago
|
1
|
9
|
116
|
POST
|
My shapefile was located on a shared network drive, so I'd verify the file path you are using or try the project template idea.
... View more
a week ago
|
0
|
4
|
109
|
POST
|
I put your code in a blank ArcPro with my own shapefile and it worked fine. Edited: add some print statements? Here is a link to someone with the same issue
... View more
a week ago
|
0
|
8
|
124
|
POST
|
Looks like he might have used QTCreator or QT Designer to make the GUI part - can you access his computer and see if QT has a recent file that points to a .UI extention?
... View more
12-16-2020
05:51 AM
|
0
|
1
|
116
|
POST
|
Looking for some insight into a script that runs nightly. It creates property record cards, and after updating from Python 2.7 to 3.6, it's slower. I've got two parts, and the one with a single page is just as slow as the one with multiple pages. I used to get 3-4 per minute, now I get one single page output every every minute but eventually going to once every 20 minutes. I'm newer to Python and I've tried figuring out where my memory leak is, but I'm not overly familiar with how to understand things like tracemalloc. This is a weird combination on an inherited script I have been trying to upgrade from 2.7 to 3.6, but it's slower now. Any help would be appreciated! It makes a CSV based on two shapefiles of all of the parcel IDs, and then uses them to feed into a map series and export the PDFs to a specific location. import arcpy, os, csv
mxdPath = r"C:\PublicCard.aprx"
outFolder = r"C:\Output"
ParcelChangesFile = r"...Geodatabase.gdb\ChangedRECORDSExtentProj" # Location of Dataset Containing Changes Made Polygons - Parcels
ParcelChangesFileCAMA = r"...Geodatabase.gdb\ChangedRecords_CAMA" # Location of Dataset Containing CAMA Changes Made (determined by last CAMA edit date) Polygons - Parcels
ParcelCSVFile = r"...\PythonScriptsUsedInModels\CSVFiles\ChangedPubParcelUPIs_%s.csv" % dateToday
logFile = r"...\PythonScriptsUsedInModels\LogFiles\Public Card Creation_%s.txt" % dateToday # Date formatted as month-day-year (1-1-2020)
KeepField = "Name" # Field to Keep and Report in Output .csv - UPI Number
ParcelPDFCount = 0 # Counts Number of Parcel PDFs Created
ChangedParcelUPIsCount = 0
reportPub = open(logFile, 'w') # Open the Newly Created Log File in Write Mode
reportPub.write(" *** EXECUTING SCRIPT Card Generation *** \n \n")
try:
# Create CSV of all Parcel UPIs Changed |
# Then use CSV to make list of which PRCs need to be rebuilt
ParcelCSVWrite = open(ParcelCSVFile,'w') # Open the Newly Created CSV File in Write Mode
rows = arcpy.SearchCursor(ParcelChangesFile) # Open a Search Cursor for Attribute Obtaining
rowsCAMA = arcpy.SearchCursor(ParcelChangesFileCAMA) # Open a Search Cursor for Attribute Obtaining
def message(message): # Code to write any prescript messages to Log File
time_stamp = time.strftime("%b %d %Y %H:%M:%S") # Obtain timestamp of message
reportPub.write(time_stamp + " " + message + "\n \n")
try:
CSVStartTime = datetime.datetime.now() # Local DateTime for Log File Reporting
CSVStartReportTime = CSVStartTime.strftime('%Y-%m-%d %H:%M:%S - ') # Local DateTime Formatting (Year-Month-Day Hour-Minute-Second) for Log File Reporting
reportPub.write("\n" + "CSV: " + CSVStartReportTime + "Starting Creation of Changed UPIs CSV \n") # Log File Reporting of Start Time with Timestamp
for row in rows: # FOR loop iterates through each row dataset
UPI_Unicode = row.getValue(KeepField) # Declaration of Variable to Hold Attribute "Name" AKA the UPI Number which is Unicode
UPI = str(UPI_Unicode) # Variable to Hold Attribute "Name" AKA the UPI Number and Conversion from Unicode to String
ParcelCSVWrite.write(str.strip(UPI) + "\n") # Write the UPIs to Output .csv while removing all white spaces in UPI; each UPI gets new line
ChangedParcelUPIsCount = ChangedParcelUPIsCount + 1 # Increase Count by One
reportPub.write("\n" + " Changes from GIS finished, now adding CAMA CHANGED UPIs to CSV \n") # Log File Reporting of CAMA edits start with Timestamp
for row in rowsCAMA: # FOR loop iterates through each row dataset
UPI_Unicode = row.getValue(KeepField) # Declaration of Variable to Hold Attribute "Name" AKA the UPI Number which is Unicode
UPI = str(UPI_Unicode) # Variable to Hold Attribute "Name" AKA the UPI Number and Conversion from Unicode to String
ParcelCSVWrite.write(str.strip(UPI) + "\n") # Write the UPIs to Output .csv while removing all white spaces in UPI; each UPI gets new line
ChangedParcelUPIsCount = ChangedParcelUPIsCount + 1 # Increase Count by One
CSVEndTime = datetime.datetime.now() # Local DateTime for Log File Reporting
CSVElapsedTime = CSVEndTime - CSVStartTime # Calculation of Elapsed Time for Task
CSVEndReportTime = CSVEndTime.strftime('%Y-%m-%d %H:%M:%S - ') # Local DateTime Formatting (Year-Month-Day Hour-Minute-Second) for Log File Reporting
reportPub.write(" " + CSVEndReportTime + "Creation of Changed UPIs CSV: SUCCESS \n") # Log File Reporting of Success with Timestamp
reportPub.write(" " + CSVEndReportTime + "Total # of Parcel Fabric Polygons Edited in Past 30 Days: " + str(ChangedParcelUPIsCount) + "\n") # Log File Reporting of Number Parcel Polygons Edited in Past 30 Days
reportPub.write(" " + "Task Elapsed Time - " + str(CSVElapsedTime) + "\n") # Log File Reporting of Elapsed Time of CSV Creation
except Exception as e: # Error Handling for TRY Statement
tb = sys.exc_info()[2] # Assign Traceback Value (i.e. [2]) to Variable
reportPub.write("CSV: Failed at Line %i \n" % tb.tb_lineno) # Write Line Where Error Occurred to Log File
reportPub.write("CSV: Error: {} \n".format(e)) # Write Error Message to Log File
ParcelCSVWrite.close() # Close the CSV Write Mode File
ParcelCSVRead = open(ParcelCSVFile, 'r') # Open the CSV File in Read Mode for Subsequent Steps
try:
with ParcelCSVRead as f: # With statement for CSV file
reader = csv.reader(f, delimiter = ',') # Set up reader for CSV file
UPI_List = [] # Create empty list called UPI_List *list will be populated in subsequent steps*
for row in reader: # FOR loop to go through each row of CSV
UPIChange = row[0] # Find attribute (UPI) we are looking for *In this case there is only one attribute per row, which is in the [0] position*
UPI_List.append(UPIChange) # Append attribute (UPI) to the list UPI_List
#print("List of Parcel UPIs Changed: ") # Print to console
# print(UPI_List) # Print the list of UPIs to console
print ("Number of Parcel UPIs Changed: " + str(ChangedParcelUPIsCount) + "\n") # Print the number of changed UPIs to console
del reader, row, f, UPIChange, rowsCAMA, rows, UPI_Unicode, ParcelCSVWrite, ParcelCSVFile #delete reader to free up memory
except Exception as e: # Error Handling for TRY Statement
tb = sys.exc_info()[2] # Assign Traceback Value (i.e. [2]) to Variable
reportPub.write("Public: Failed at Line %i \n" % tb.tb_lineno) # Write Line Where Error Occurred to Log File
reportPub.write("Public: Error: {} \n".format(e))
# print ("CSV Generation:--- %s seconds ---" % (time.time() - start_time))
#---------------------------- ----------------------------#
# #
# Starting Public PRC Generation #
# #
# #
try:
# Time stamp variables
currentTimePUBLIC = datetime.datetime.now()
# Date formated as month-day-year-hours-minutes-seconds
dateTodayTimePUBLIC = currentTimePUBLIC.strftime("%m-%d-%Y-%H-%M-%S")
# Create text file for logging results of script
# Each time the script runs, it creates a new text file with the date1 variable as part of the file name
# The example would be GeoprocessingReport_1-1-2017
startTimePUBLIC = datetime.datetime.now()
reportPub.write("Public PRC Creation started at " + str(startTimePUBLIC))
ParcelStartTime = datetime.datetime.now() # Local DateTime for Log File Reporting
ParcelStartReportTime = ParcelStartTime.strftime('%Y-%m-%d %H:%M:%S - ') # Local DateTime Formatting (Year-Month-Day Hour-Minute-Second) for Log File Reporting
reportPub.write("\n" + "STEP 2/11: " + ParcelStartReportTime + "Starting Creation of New Parcel PDFs \n \n") # Log File Reporting of Start Time with Timestamp
reportPub.write(" PDFs Created \n" ) # Log File Reporting - Header for writing of listing of PDFs Created
reportPub.write(" --------------------\n" ) # Log File Reporting - Header for writing of listing of PDFs Created
for pageName in UPI_List: # FOR loop to interate through each pageName AKA UPI in the UPI_List
UPI = u'{0}'.format(pageName)
# publicWorker(mxdPath, outFolder, UPI)
mxdFile = arcpy.mp.ArcGISProject(mxdPath)
cleanName = UPI.replace("/", "_")
l = mxdFile.listLayouts()[0]
if not l.mapSeries is None:
ms = l.mapSeries
if ms.enabled:
ms.currentPageNumber = ms.getPageNumberFromName(UPI)
file = os.path.join(outFolder, cleanName)
ms.exportToPDF(file, "CURRENT", resolution=300)
ms.refresh()
del mxdFile, UPI, cleanName
ParcelPDFCount = ParcelPDFCount + 1 # Increase Count by One
reportPub.write(" " + pageName + "\n") # Log File Reporting - Writing UPI to listing of PDFs updated
reportPub.write("\n") # Log File Reporting - Formatting Space between list and next write statement
ParcelEndTime = datetime.datetime.now() # Local DateTime for Log File Reporting
ParcelElapsedTime = ParcelEndTime - ParcelStartTime # Calculation of Elapsed Time for Task
ParcelEndReportTime = ParcelEndTime.strftime('%Y-%m-%d %H:%M:%S - ') # Local DateTime Formatting (Year-Month-Day Hour-Minute-Second) for Log File Reporting
reportPub.write(" " + ParcelEndReportTime + "Creation of New Parcel PDFs: SUCCESS \n") # Log File Reporting of Success with Timestamp
reportPub.write(" " + ParcelEndReportTime + "Total # of New Parcel PDFs: " + str(ParcelPDFCount) + "\n") # Log File Reporting of Number PDFs Made with Timestamp
if (ParcelPDFCount == 0): # Test to see if there were no PDFs created
reportPub.write(" - No Parcel PDFs Created " + "\n") # Log File Reporting of Elapsed Time of PDF Creation
reportPub.write(" " + "Task Elapsed Time - " + str(ParcelElapsedTime) + "\n") # Log File Reporting of Elapsed Time of PDF Creation
ParcelCSVRead.close() # Close the CSV Read Mode File
message = arcpy.GetMessages()
reportPub .write(message)
endTimePUBLIC = datetime.datetime.now()
elapsedTimePUBLIC = endTimePUBLIC - startTimePUBLIC
reportPub.write("\n" + "Public PRC Creation finished at Elapsed Time - " + str(elapsedTimePUBLIC) + "\n")
del currentTimePUBLIC, dateTodayTimePUBLIC, startTimePUBLIC, endTimePUBLIC, elapsedTimePUBLIC, ParcelEndTime, ParcelElapsedTime,ParcelEndReportTime, UPI, ParcelCSVRead, ParcelCSVWrite
except Exception as e: # Error Handling for TRY
tb = sys.exc_info()[2] # Assign Traceback Value (i.e. [2]) to Variable
reportPub .write("\n Failed at Line %i \n" % tb.tb_lineno) # Write Line Where Error Occured to Log File
reportPub.write("Error: {} \n".format(e))
# print ("Public Cards Generation:--- %s seconds ---" % (time.time() - start_time))
ParcelCSVRead.close() # Close the CSV Read Mode File
message = arcpy.GetMessages()
reportPub .write(message)
endTimePub = datetime.datetime.now()
elapsedTimeSUB = endTimePub - startTimePUBLIC
report.write("\n" + "Subscription PRC Creation finished at Elapsed Time - " + str(elapsedTimeSUB) + "\n")
del currentTimeSUB, dateTodayTimePub, startTimePUBLIC, elapsedTimeSUB, endTimeSUB, UPI_List
except Exception as e:
tb = sys.exc_info()[2] # Assign Traceback Value (i.e. [2]) to Variable
reportPub.write("\n Failed at Line %i \n" % tb.tb_lineno) # Write Line Where Error Occured to Log File
reportPub.write("Error: {} \n".format(e))
finally:
# write message to log file
reportPub.close()
del mxdPath
... View more
12-15-2020
12:18 PM
|
0
|
0
|
58
|
Online Status |
Offline
|
Date Last Visited |
yesterday
|