POST
|
Hi guys, Thanks for all the inputs, much appreciated. And yes, the features I'm deleting are derived from some other features, so if the input features have changed, I have to delete the irrelevant derived features. Cool pic, btw! Xander Bakker Thanks for the compliment! I'm good in some things, but not so in others. Well, like all of us. Did you see this presentation? Arcpy is a new thing I'm learning for my CityEngine services, so I'm trying to get the things I need in a workflow prototype I'm working on for Esri Germany to work. Huge thanks! Matt
... View more
09-26-2016
12:41 AM
|
0
|
1
|
1397
|
POST
|
Hi guys, thanks for the replies - on a sunday!! Oh - I think the key is in understanding that the OBJECTID in a FC is NOT always enumerated from 1 to n. I was under the impression this is the case. (I'm not a GIS expert) I have just tried manually deleting a feature and adding an other one manually and the result shows me that the OBJECTID of the newly drawn does not replace the last (missing) spot, but is 1 higher than the highest existing OBJECTID value. --> 1] Can you guys confirm that arcpy handles this the same as when doing stuff manually? 2] If so, then the whole question would be answered by this very important detail. Thanks guys! matt
... View more
09-25-2016
06:10 AM
|
0
|
3
|
1397
|
POST
|
ps. if possible, I'd like not to have to operated with temp layers.
... View more
09-25-2016
03:02 AM
|
0
|
0
|
1397
|
POST
|
Hi, Question: I have read that cursors can only be iterated forward, not in reversed order. Not if I have e.g. 5 features and the following code structure: delCursor = arcpy.da.UpdateCursor(fc, field) for row in delCursor: if testIfRowNeedsToBeDeleted(..): delCursor.deleteRow() # messes with the number of elements in the loop!! How can I guarantee that the correct features are deleted when I delete features with 'early' OBJECTIDs out of the list, as after the first deletion, the number of elements in the field is already not the same as the cursor's number. How is this handled internally? * * * In the end, I just need to delete specific rows out of a feature class, depending on specific field values and I want to avoid any issues with the order. My favourite would be this structure in pseudo code: to deleteFeatureOBJECTIDs = [] loop over cursor: if feature needs to be deleted based on multiple field values: deleteFeatureIDs.append(current feature) arcpy.deleteFeaturesInFC(deleteFeatureOBJECTIDs) [[ I have also tried code-based creation of the SQL 'where_clause', with a string list, but this type of search crashes ArcGIS PRO quite easily. ]] Any input welcome! Thanks! matt
... View more
09-25-2016
02:47 AM
|
0
|
11
|
2613
|
POST
|
Ok, true. This is the error: Traceback (most recent call last): File "Y:\..\pyScripts\createCables.py", line 25, in <module> cc.createCables(pPath, pName, gdbPath, gdbName, pfc, mfc, rpk, lfc, a) File "Y:\..\cableCode.py", line 456, in createCables map.addLayer(lyr, add_position = 'AUTO_ARRANGE') File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\utils.py", line 191, in fn_ return fn(*args, **kw) File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\_mp.py", line 1041, in addLayer return convertArcObjectToPythonObject(self._arc_object.addLayer(*gp_fixargs((add_layer_or_layerfile, add_position), True))) ValueError: myLayer Failed to execute (createCables).
... View more
09-23-2016
06:38 AM
|
0
|
0
|
604
|
POST
|
Hi, Yes, they are defined as: pPath = project Path on disk (e.g. 'D:/..') pName = project file name ('.aprx') gdbName = path to GDB (usually sitting in the project path) gdbName = GDB name It indeed may be more a question, sorry about that.. matt
... View more
09-23-2016
04:37 AM
|
0
|
1
|
604
|
POST
|
Hi, [ ArcGIS PRO 1.3.1 ] I'm a bit stuck with arcpy when adding a feature class in the Map_3D viewer as a layer. Basically I'm trying to emulate the same thing that happens when drag-n-dropping a FC into the Contents pane, resp. the Map_3D viewer. Code so far .. import arcpy aprx = arcpy.mp.ArcGISProject(pPath + pName) fc = gdbPath + gdbName + '/myFeatureClass' lyr = arcpy.MakeFeatureLayer_management(fc, 'myLayer') for map in aprx.listMaps(): if map.mapType == 'SCENE': map.addLayer(lyr, add_position = 'AUTO_ARRANGE') But this produces an error .. What am I missing? Thanks for any input! Matt
... View more
09-23-2016
03:16 AM
|
0
|
4
|
1460
|
POST
|
Hi, I'm trying to solve this issue: I have 2 feature classes, with 2 states of the same point features. I'm not trying to find which specific features have changed by comparing (position or attribution). I found those tools: 1 - Detect Feature Changes—Data Management toolbox | ArcGIS for Desktop 2 - Feature Compare—Data Management toolbox | ArcGIS for Desktop but they don't help me in my case, as: 1 - only works with lines 2 - only compares the whole feature class, but does not report which features have changed. Is there a way around this without explicitly writing a method for this (which will be super slow)? Any input welcome! Thanks, matt
... View more
09-19-2016
09:18 AM
|
0
|
2
|
723
|
POST
|
Hi, the arcpy tool mentioned before (Detect Feature Changes—Help | ArcGIS for Desktop) can compare two feature classes for changes. But is it somehow possible to detect from the 'begin' to the 'end' of a session of the edit mode, which features have changed and pass that list on to arcpy?
... View more
09-16-2016
10:00 AM
|
1
|
0
|
1407
|
POST
|
Hi, Sorry, I've been out of town for work for 2 weeks .. and this week's been busy too. But thanks for checking back. The compiling part did work, yes. Though what I ended up using are the automatically generated .pyc files in the same folder. I am not sure why I did not see them being produced in the first place, this is puzzling. It may be a folder refresh issue. So basically, the structure I'm using now is 1 py file and 1 pyc file, where in the first file I just call a method in the second file, passing on the relevant parameters / user settings. Thanks !! matt
... View more
09-16-2016
12:36 AM
|
0
|
1
|
3520
|
POST
|
Hi, I never leave CityEngine for coding, as the CGA specific syntax/keyword highlighting and especially command-completion (ctrl-space) cannot be accessed outside CityEngine. Hope this helps, Matt Matthias Buehler Founder, vrbn, www.vrbn.io
... View more
09-14-2016
08:35 AM
|
0
|
0
|
638
|
POST
|
I'm glad I could help! Matt Matthias Buehler Founder, vrbn www.vrbn.io
... View more
09-14-2016
08:31 AM
|
0
|
5
|
1303
|
POST
|
oh boy. got it working: import importlib cd = importlib.import_module('code') importlib.reload(cd) cd.runCode() thanks for the inputs.. much appreciated! matt
... View more
09-03-2016
07:02 AM
|
0
|
2
|
808
|
POST
|
Hi, when using imported modules and one of the modules changes, ArcGIS PRO does not reflect that change, but runs the old version. it seems to cache it somehow. the only way to get the changes to run is to restart PRO. py script 1 that is actually run via toolbox: import myFile myFile.runCode() py script 2 that is imported: def runCode(): import arcpy arcpy.AddMessage('change me!') Is there a way around this? Any input welcome! Matt
... View more
09-03-2016
05:33 AM
|
0
|
4
|
1863
|
POST
|
Ok, thanks for the inputs, as always! I'll try! Matt
... View more
09-03-2016
04:22 AM
|
0
|
3
|
3520
|
Title | Kudos | Posted |
---|---|---|
1 | 09-16-2016 10:00 AM | |
1 | 10-02-2014 04:38 AM | |
1 | 02-26-2015 03:39 AM | |
1 | 02-23-2015 09:07 AM | |
1 | 10-06-2014 07:39 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|