POST
|
I've got a similar issue. I'm running 10.2.2 and for each row the updateCursor processes with a field annotation is derived from in the field list, instead of regenerating the annotation attributes after each updateRow call, mine is setting the SHAPE_Length and SHAPE_Area of the annotation feature to 0 (effectively vanishing the annotation for that feature). This has happened using unversioned data in a MS SQL SDE and a copy of the same data in a local file geodatabase. Triggering an annotation update through editing the feature in ArcMap will restore the correct annotation geometry and the annotation is visible again. This only happens when running the script from a standalone Python file, setting up an edit session and using startEditing(False, False), startOperation(), stopOperation(), and stopEditing(True). When run through ArcMap's Python console, with en edit session started through the ArcMap interface, the cursor runs as expected and the annotation is fine. Is this already logged as a bug? Was an official solution ever offered or discovered?
... View more
01-27-2016
06:59 AM
|
0
|
0
|
1014
|
POST
|
I didn't do any further testing, but I suspect this is some kind of arcpy issue (either with feature linked annotation, versioned data, or some combination of the two.) I ended up deleting the features, running all cursors on local copies of the data, and then reloading it in the SDE and all my labels were generated properly as expected.
... View more
04-03-2015
05:25 AM
|
1
|
0
|
328
|
POST
|
I have a bunch of annotations in my anno layer with Null values in SHAPE.STArea() and SHAPE.STLength() fields. This seems to make them not appear, even when Placed. They are part of feature linked annotation and these null values all are related to recently created and updated features. I created the features, then ran a couple of arcpy cursor to update their attributes. There are 38 features that the last cursor updated, and these feature all have null Shape fields. The annotation uses an expression that includes the fields that the cursors updated, so I'm guessing that's somehow part the problem. I just don't know if there's a way to update the annotation layer to correct itself, or if I just have to delete and re-create all the misbehaving features. Any idea what's going on or how to fix it? Thanks.
... View more
03-31-2015
01:54 PM
|
0
|
1
|
3884
|
POST
|
I have consulted this help doc: ArcGIS Help (10.2, 10.2.1, and 10.2.2) on rebuilding indexes. I am unclear as to what happens when I pass an empty string for in_datasets. Does this rebuild indexes on every dataset available to that input DB Connection? The reason I ask is because I have a script that generates a list of datasets in my SDE, then rebuilds indexes on all of them (very much like the example code listed in the help doc above):
##get datasets
data_list = arcpy.ListTables() + arcpy.ListFeatureClasses()
for dataset in arcpy.ListDatasets("", "Feature"):
env.workspace = os.path.join(workspace, dataset)
data_list += arcpy.ListFeatureClasses() + arcpy.ListDatasets()
##Rebuild indexes
env.workspace = workspace
try:
arcpy.RebuildIndexes_management(workspace, "SYSTEM", data_list, "ALL")
emailMessage += "<br>indexes rebuilt"
except:
emailMessage += "<br>Rebuild indexes failed. " + time.asctime()
traceback.print_exc(file=log)
where workspace is a variable pointing to my .sde connection file for the DB owner (sde user). This code worked without errors for several weeks. Since upgrading from 10.1 to 10.2.2, When I pass data_list, I get permission/not found errors for each dataset:
ExecuteError: Could not rebuild indexes for dataset ... [Operation Failed [42000:[Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot find the object ... because it does not exist or you do not have permissions.]]
However, when I've tried running the script passing an empty string instead of data_list, it runs without an error. I am hoping that I can work around the ExecuteError by skipping the in_datasets argument all together. Is passing '' instead of my full list of datasets accomplishing the same index rebuilding, or do I need to pass the whole list to rebuild indexes on each dataset in the DB? As a side question, where is the geoprocessing tool in the script getting its permissions? Is it from the .sde connection file or is it from the user who is executing the script? Thanks!
... View more
10-14-2014
08:01 AM
|
0
|
3
|
3960
|
POST
|
This is now filed as a bug: BUG-000082426: arcpy.da.UpdateCursor() returns duplicate rows when run against large, versioned SDE feature classes From my understanding, it also appears to only affect datasets larger than 10K or so records, and only those using SQL Server. The best work-around appears to be to manipulate the data directly in the DB environment through SQL.
... View more
10-07-2014
10:10 AM
|
1
|
3
|
455
|
POST
|
Richard, Thanks for your comments. Correct me if I am wrong, but I was under the impression that the da cursor needs to run in an edit session. I have accomplished this as in the code snipped below:
edit = arcpy.da.Editor(WORKSPACE)
edit.startEditing(False, True)
edit.startOperation()
... (Cursor runs here) ...
edit.stopOperation()
edit.stopEditing(True)
Aside from this, I have no other Editors, or extensions working on the feature class. As far as I'm aware, the relationship is static and has no listener events. It is only accessing the globalID field of the related feature class to match it to rows in the attachment table. I will try re-writing the script to use the legacy cursors (which I know will work outside of an edit session) and report back if it still generates the same count issues. Thanks again for all your input.
... View more
09-30-2014
11:27 AM
|
0
|
1
|
1101
|
POST
|
Richard, Thanks for your reply. The script is being run on a feature class in a Composite Relationship (Attachments enabled using GlobalID as the relate field) however, we are not including the GlobalID field in the field list for the UpdateCursor. We've also run it on a feature class that does not participate in any relationships with the same results. I've enabled attachments on my 1100 record subset (in the SDE) of the larger feature class and the script still returns the proper count when run on it. Do you think the issue with the relationship could still be cause of the inconsistent count? Another workaround I am considering is using the legacy update cursor. This will allow me to run the script without starting an edit session. Do you know if the legacy cursor behaves in the same way when updating records in a feature class that participates in a relationship?
... View more
09-30-2014
10:29 AM
|
0
|
5
|
1101
|
POST
|
James, Here's the code snippet of the UpdateCursor() loop:
edit = arcpy.da.Editor(WORKSPACE)
edit.startEditing(False, True)
edit.startOperation()
count = 0
with arcpy.da.UpdateCursor(parcels, fields) as updateCur:
for row in updateCur:
row[0] = newValue
...
updateCur.updateRow(row)
count += 1
edit.stopOperation()
edit.stopEditing(True)
I need to update the entire dataset, so I haven't tried to use an SQL where clause to limit the number of records returned.
... View more
09-30-2014
10:22 AM
|
0
|
0
|
1101
|
POST
|
I'm running a Python script using the data access update cursor on a versioned feature class with 16,814 rows stored in a SQL Server SDE. I am using a for loop to go through each row and iterating a count variable each time through the loop. Without running the updateRow() method, things are as expected: my count is equal to the number of rows I have. However, when I run the updateRow() method, the count gets much higher and is inconsistent from one execution to the next. It's anywhere from 20K to 30K. I suspect this has something to do with the time it takes to manipulate so many records, similar to this question: arcpy - Scaling DA UpdateCursor to large datasets? - Geographic Information Systems Stack Exchange When I run the same script on a smaller subset of the data (~1100 records), things are consistent and normal. This is also the case when running the script on the full dataset exported to a local file geodatabase (instead of in the SDE.) Has anyone else run into this issue? Can anyone explain what is happening with more certainty? I'm not sure of the ideal workaround just yet (either use SQL in a while loop to break up the records returned in the cursor--as was suggested in the linked question, or running the script on local data and then copying it up to the SDE), so if anyone has any other ideas, I'm all ears as well. Thanks!
... View more
09-30-2014
09:08 AM
|
0
|
15
|
5430
|
POST
|
Thanks a million Ken! map.resize() does just the trick. Thanks for your help.
... View more
06-24-2014
05:03 AM
|
0
|
0
|
471
|
POST
|
I thought I had solved my problem, but I'm still pulling my hair out over this. I've tried placing all the objects in a container div and tried having them all as independent divs. The only workaround I've found is using 'position: absolute' on everything in that div (the map, the layer list, and the legend header). However, after doing this, all the rest of the non-absolutely positioned divs are no longer positioned properly. Excluding the legend from the page entirely also seems to resolve the problem (is this a known bug in the legend dijit?)
... View more
06-23-2014
09:21 PM
|
0
|
0
|
471
|
POST
|
For anyone interested, I think I've solved the problem by using position: absolute on the divs that hold the map and the legend. I think the resizing of the legend was messing with the map position on the page. Not sure if this is standard best practice or if this is a bug in the legend dijit, but this workaround works for me.
... View more
06-23-2014
08:02 PM
|
0
|
0
|
471
|
POST
|
Hello, My application has a problem where after the map loads, when I use the mouse wheel to zoom in, the map zooms in at a location that is not where the cursor is centered. Also, my info windows pop-up in the wrong place. Both the zoom and the pop ups are happening too far 'south' of the cursor/feature. Strangely, I can get the problem to disappear if I resize the browser window. After I resize the window, the zoom works as usual and info windows show up right next to their features. I don't know if this is related, but I also notice the map 'jumps around' during the page load. At the start of the load, the home button, base map switcher and esri logo load higher up on the page, then they jump down to where I want them positioned. I suspect this has something to do with my CSS, but I can't seem to figure it out. If anyone has any advice for how to solve this issue, it would be greatly appreciated. Below are the respective codes for the page. HTML: [HTML]<div class="col-md-12"> <div class="col-md-6"id="legend"> <h2 class="text-muted">Legend</h2> <div id="LayerList"> </div> </div> <div class="col-md-6" id="Map"> <div id="HomeButton"> </div> <div id="baseMapToggler"> </div> <div id="scale"> </div> </div> </div>[/HTML] CSS: #Map { height: 940px; width: 75%; padding-bottom:150px; margin-left: 250px; margin-top:-705px; } #legend { padding:10px; left: 25px; width: 25%; } #LayerList { left: 25px; width: 25%; } JS: function(Map, Legend, FeatureLayer, InfoTemplate, HomeButton, BasemapToggle, Scalebar, dom, domConstruct, on) { var pointTemplate = new InfoTemplate("<b>${Name}</b><br>${Address}", "${Comment}<br><br>${URL}<br><br>${Picture}"); var otherTemplate = new InfoTemplate("${Name}", "${Comment}"); var Layers = [] var legendLayers = [] var map = new Map("Map", { autoResize: true, center: [-86.513039, 39.152544], zoom: 11, basemap: "streets" }); var scalebar = new esri.dijit.Scalebar({ map:map, scalebarStyle:"ruler", scalebarUnit:"english", }, dojo.byId("scale")); var home = new HomeButton({ map: map }, "HomeButton"); home.startup(); //push several layers into array var arrayLength = Layers.length; for (var i = 0; i < arrayLength; i++) { map.addLayer(Layers); legendLayers.push({ layer: Layers, title:Layers.id }); }; var myLegend = new Legend({ layerInfos: legendLayers, map: map }, "LayerList"); myLegend.startup(); var toggle = new BasemapToggle({ map: map, basemap: "hybrid" }, "baseMapToggler"); toggle.startup(); });
... View more
06-21-2014
09:11 PM
|
0
|
4
|
2128
|
Title | Kudos | Posted |
---|---|---|
1 | 04-03-2015 05:25 AM | |
1 | 10-07-2014 10:10 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|