POST
|
Dear All, We are still on arcmap 10.3.1. and now we migrate from Windows 7 to Windows 10. Users who already migrated experience severe performance issues. What i'm trying to achieve is to log ArcMap startup time as an indicator of user-performance. I tried to start ArcMap from python and that works even launching a blank MXD. What doesn't work is the measure for t2. The script walks on while ArcMap is loading. Does anyone see how this could be achieved? I thought maybe the is a way to lauch arcmap and running a script which would write a timestamp to a file... Or should I forget this Idea and just use a stopwatch? Thanks.. import os, time
blank = r'P:\civ\Geo-Projecten_PT\HotFIX_KG\10.3.1_bwTools\_Proj\performance2020\Blank.mxd'
tfm = '%H:%M:%S'
t1 = time.time()
st1 = time.strftime(tfm)
print 'start-time : ' + st1
os.startfile(blank)
t2 = time.time()
st2 = time.strftime(tfm)
print 'time loaded : ' + st2
print 'ArcMap load-time: ' + str(round((t2-t1),1))
print '----------------------'
print '-----Script end!------'
... View more
02-04-2020
05:53 AM
|
0
|
2
|
433
|
POST
|
Hi Rebecca, I know I can save manualy from the results window. I also could use a logger. But since we have this nice results window. I was hoping to be able to write all message contents to a file at once. I will have a close look at your logging code. It looks like what I used in 9.3. Back then I used a custom addmessage-function and used it for every addMessage in my scripts and write to a logfile simultaniously. Thanks!
... View more
08-24-2016
02:45 PM
|
0
|
0
|
313
|
POST
|
I'm used to log everything I do in my python scripts to the tool-message window with like this.. arcpy.AddMessage("!!!!ERROR!!!!, unable to delete existing folder: " + fpth) At the end of my script I'd like to grab all messages and write them to a textfile at once. something like: allmsgs = arcpy.getMessages() #but this only gets the last geoprocessing message
logfile = open("c:\\temp\mytoollog1.txt", 'w')
logfile.write(allmsgs)
logfile.close Maybe it can be grabbed from the results window? Thanks
... View more
08-24-2016
02:17 PM
|
0
|
2
|
720
|
POST
|
I got it! I was just not using proper syntax on the array. This works. sArr = arcpy.da.FeatureClassToNumPyArray (tmppt_sel, ["OID@","SHAPE@XY"], "#", rd) oArr = arcpy.Array() cnt = 0 for oi, xy in sArr: if cnt==0: arcpy.AddMessage("start point in: " + str(loid) + ": id: " + str(oi) + ", " + str(xy)) elif (cnt==selectionCount-1): arcpy.AddMessage("end point in: " + str(loid) + ": id: " + str(oi) + ", " + str(xy)) else: arcpy.AddMessage("thisID: " + str(oi)+ " nextid: " + str(sArr[cnt+1][0])) cnt+=1 produces: thisID: 7 nextid: 8 thisID: 8 nextid: 9 thisID: 9 nextid: 10 thisID: 10 nextid: 11 thisID: 11 nextid: 12 thisID: 12 nextid: 27 thisID: 27 nextid: 28 thisID: 28 nextid: 29 thisID: 29 nextid: 30 Now I can identify the proper points.
... View more
01-12-2016
03:18 PM
|
0
|
2
|
892
|
POST
|
Hi Dan, Thanks for your reaction. I think I understand what youre showing me. I see I can just grab the proper rows from the array when i identified them. But how do I extract the ID from the next element in the array when looping?
... View more
01-12-2016
02:53 PM
|
0
|
0
|
892
|
POST
|
Here's my problem, hope anybody can get me on the way... I need to remove the "caps" of long polygon(road) features. The caps are created by boundary lines. Each line can slice the same polygon multiple times. After converting the line to points I'm able to select the points touching the polygon. But the selection can contain multiple start-end-points for each slice. Here's the array of selected points. [ (6, [163320.90700000152, 379580.6550000012]) (7, [163320.90900000185, 379580.34699999914]) (8, [163320.92320000008, 379577.6838000007]) (9, [163320.941300001, 379574.2791999988]) (10, [163320.95899999887, 379570.9439999983]) (11, [163320.97700000182, 379567.63800000027]) (12, [163320.98000000045, 379567.12000000104]) (27, [163321.24599999934, 379517.67599999905]) (28, [163321.26900000125, 379513.493999999]) (29, [163321.28799999878, 379509.9620000012]) (30, [163321.3040000014, 379506.8920000009]) ] And this is my goal output-array. I need these corners! [ (6, [163320.90700000152, 379580.6550000012]) (12, [163320.98000000045, 379567.12000000104]) (27, [163321.24599999934, 379517.67599999905]) (30, [163321.3040000014, 379506.8920000009]) ] At first I tried to use the searchcursor, but i was unable to identify the next-id in a loop to see if it's ID is just+1. So my thought is to use the numpy array, but i'm still on the ground... How do I loop this numpy array or mayby use some smart numpy function to remove unwanted rows from the array? This is the code that created the array: tmppt_lay = arcpy.MakeFeatureLayer_management(tmppt, "tmppoints_lay", "", "", "OBJECTID OBJECTID VISIBLE NONE;SHAPE SHAPE VISIBLE NONE;ORIG_FID ORIG_FID VISIBLE NONE") tmppt_sel = arcpy.SelectLayerByLocation_management(tmppt_lay, "INTERSECT", bit2, "0,02 Meters", "NEW_SELECTION") #now loop these selected points and identify future split-points srows = arcpy.SearchCursor(tmppt_sel) sdesc = arcpy.Describe(tmppt_sel) selectionCount = len(sdesc.fidset.split(";")) arcpy.AddMessage(" selected points: " + str( selectionCount)) #for srow in srows: #got stuck here! #try the numpy way.. sArr = arcpy.da.FeatureClassToNumPyArray (tmppt_sel, ["OID@","SHAPE@XY"], "#", rd) oArr = arcpy.Array() cnt = 0 for oi, xy in sArr: if cnt==0: #this is always the startpoint arcpy.AddMessage("start point in: " + str(loid) + ": id: " + str(oi) + ", " + str(xy)) elif (cnt==selectionCount-1): #this is always the endpoint arcpy.AddMessage("end point in: " + str(loid) + ": id: " + str(oi) + ", " + str(xy)) else: #here i need to findout if the next point has an ID 1 larger thn the current arcpy.AddMessage("counter + 1: " + str(int(cnt+1))) nextcnt = cnt+1 nextrow = sArr[nextcnt]) # this does NOT work #nextid = nextrow[0] #arcpy.AddMessage("nextid: " + str(nextid)) cnt+=1 Het bericht is bewerkt door: Bart van der Wolf
Added a loop for the array, but stuck on the same point as with using the searchcursor.
... View more
01-12-2016
01:37 PM
|
0
|
7
|
2928
|
POST
|
Hi All, I have a multivalue toolbox item containing the folowing defaults: 405 RDY Flevoland en Afsluitdijk 539 DLB Wegendistrict Venlo 549 DLB Wegendistrict St. Joost 580 DNB Wegendistrict Breda 581 DNB Wegendistrict Eindhoven 582 DNB Wegendistrict `s-Hertogenbosch 410 DNH Wegendistrict Alkmaar 420 DNH Wegendistrict Amsterdam 704 DNN Wegendistrict Friesland 711 DNN Wegendistrict Groningen-Drenthe 611 DOM Wegendistrict Zwolle 622 DNN Wegendistrict Veluwe 629 DON Wegendistrict Twente en Achterhoek 644 DON Wegendistrict Arnhem-Nijmegen 433 DUT Wegendistrict Utrecht 510 DZL Wegendistrict Zeeland 424 DZH Wegendistrict Haaglanden 428 DZH Wegendistrict Rijnmond 448 DZH Wegendistrict Zuid-Hollandse Waarden The idea is the user selects 1 item from the list. However, now in 9.3, they have become checkboxitems which are checked by default. Using the "UnselectAll" button clears the list of items?! I want the user to be able to select 1 by 1 klick (or 2), not having to uncheck al others one-by-one. Am I missing something here, is it a bug or is there an other way? Thanks in advance
... View more
05-24-2011
04:22 AM
|
0
|
0
|
554
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|