POST
|
I've tried looking at the value of 'cursor' on each iteration of the block, and the memory location is exactly the same as in the previous iteration, even though the file 'inputvesselfile' has been deleted and the variable reassigned to a new physical file in between each iteration. Is that to be expected??
... View more
01-22-2018
07:28 PM
|
0
|
0
|
215
|
POST
|
Hi all: I've just updated to ArcGIS Pro 2.1.0 and get the following error on code that has been working perfectly well in ArcGIS Pro 2.0.1 for months: cursor = arcpy.da.InsertCursor(inputvesselfile, ['SHAPE@X', 'SHAPE@Y','SHAPE@Z', 'SHAPE@M'] + headers)
count = 0
for row in reader:
newrow = [float(row[0]), float(row[1]), float(row[2]), int(row[5])] + row
line_name = row[6]
cursor.insertRow(newrow)
count += 1
if count%100 == 0:
arcpy.SetProgressorPosition(count)
del cursor
The error I get is: Traceback (most recent call last): File "D:\roger\Documents\2_scripts_SS\p190_ss.py", line 1201, in <module> main() File "D:\roger\Documents\2_scripts_SS\p190_ss.py", line 1196, in main showGpMessage(logFile) File "D:\roger\Documents\2_scripts_SS\p190_ss.py", line 1016, in main showGpMessage(logFile) File "D:\roger\Documents\2_scripts_SS\p190_ss.py", line 1009, in main cursor.insertRow(newrow) RuntimeError: workspace already in transaction mode The error is happening on the second iteration of the code block, at cursor.insertRow(newrow). Can anyone see why it's happening? If not, can anyone tell me how to roll back to v2.0.1 which was working just fine? Thanks, Roger
... View more
01-22-2018
07:16 PM
|
0
|
1
|
337
|
POST
|
Has anyone figured out how to hatch the M values in polylines in ArcGIS Pro 2? I know how to do it in Desktop but not Pro.
... View more
10-03-2017
08:23 PM
|
0
|
0
|
436
|
POST
|
Thanks Dan - that's what I thought; map and map frame don't seem to have any concept of spatial reference, even though from the help: "A Map in ArcGIS Pro represents a collection of tabular and symbolized geographic layers and also persists information like coordinate system, default views of the data, and various other metadata." So clearly the map works with the CRS - it just doesn't allow the poor old user access to it! Maybe in the next version... Cheers, Roger
... View more
02-09-2016
06:49 PM
|
0
|
0
|
991
|
POST
|
I tried doing this, but it doesn't work: # get the map document p = arcpy.mp.ArcGISProject("CURRENT") # get the data frame m = p.listMaps("Map")[0] sr = m.spatialReference
... View more
02-09-2016
06:17 PM
|
0
|
2
|
991
|
POST
|
Dan - yes, I'm looking at it now. I can see how to do it by referencing a layer, but what if I don't have any layers when I invoke my tool?
... View more
02-09-2016
06:16 PM
|
0
|
0
|
991
|
POST
|
I can't figure out how to get the equivalent of this arcpy.mapping code into arcpy.mp # Set the CRS values based on the current data frame CRS # get the map document mxd = arcpy.mapping.MapDocument("CURRENT") # get the data frame df = arcpy.mapping.ListDataFrames(mxd)[0] sr = df.spatialReference Can anyone help please?
... View more
02-09-2016
06:04 PM
|
0
|
5
|
3925
|
POST
|
Thanks Duncan, Finger trouble with upper/lower case - misdirection from ESRI helpfile. Cheers, Roger Roger, I just tried the following code on a river network I have and it did not produce an error. # Layer name in Map Document
s = "Rivers"
# Describe object and print name string to confirm it worked
desc = arcpy.Describe(s)
print desc.namestring
# Get spatial reference and print name
sr = desc.spatialreference
print sr.name
# Get FeatureClass and check if M aware
fc = desc.featureclass
print fc.hasm
# Set M domain
sr.setmdomain( -1000,1000)
This would suggest that there is something odd with your layer as your code looks sound? Duncan
... View more
01-17-2012
06:37 PM
|
0
|
0
|
205
|
POST
|
Anyone know why this doesn't work: sr = arcpy.Describe(my_bathy).spatialReference sr.setMDomain(-100000, 100000) ZM are both enabled for my_bathy. Thanks, Roger
... View more
01-02-2012
06:17 PM
|
0
|
2
|
705
|
POST
|
Is working now - finger trouble 😞 Many thanks Jeff 🙂
... View more
11-08-2011
02:13 PM
|
0
|
0
|
409
|
POST
|
Thanks for the advice Jeff. I'm trying UpdateLayer but it's not working yet - but (oddly enough) not throwing an exception either. Will have another play today. Roger
... View more
11-08-2011
12:56 PM
|
0
|
0
|
409
|
POST
|
I have a polyline ZM layer into which I want to apply symbology, route/hatching and labels from an eixsting layer on disk. I know how to do the symbology: arcpy.ApplySymbologyFromLayer_management(out_layer, in_layer) Does anyone know how to apply route/hatching and lables programmatically? Cheers, Roger
... View more
11-06-2011
10:00 PM
|
0
|
6
|
2980
|
POST
|
That was it! Many, many thanks Chris. I'm using cursors instead of the project tool in the hope it will be faster. Both methods seem very slow though. R I spoke too soon!! The code runs OK and it is now quite fast (using in-memory feature classes). However, the results for latitude, longitude, easting and northing are always the same, no matter what input/output datums and projections I specify. What seems to happen is that the latitude and longitude project in WGS84 and the datum transformation itself does not work. I've tried this using searchcursors and updatecursors with the same result. Any ideas?? Will project_management work on in-memory feature classes? (I am already specifying arcpy.env.geographicTransformations so ArcGIS knows which one to use). R
... View more
08-09-2011
08:10 PM
|
0
|
0
|
620
|
POST
|
The spatial refernce object is the 3rd parameter in the update & search cursor statments (2nd parameer for the insercursor statment). So it would be: rows = arcpy.UpdateCursor(fc, "", inCRS)
#instead of
rows = arcpy.UpdateCursor(fc, inCRS) That was it! Many, many thanks Chris. I'm using cursors instead of the project tool in the hope it will be faster. Both methods seem very slow though. R
... View more
08-09-2011
04:09 PM
|
0
|
0
|
620
|
POST
|
What is you initial coordinate system, and which coordinate system are you attempting to re-project to? From AGD84 to GDA94 and MGA50. Why would that make a difference?
... View more
08-09-2011
04:03 PM
|
0
|
0
|
620
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|