POST
|
I'm not sure why this works on my computer (10.1, SP1... it's probably a bug), but it's worth a shot: Un-check the "Rotate Marker Symbols with Data Frame" option in the "Data Frame" tab of the window that comes up when you run the AdvancedArcMapSettings.exe tool (found in C:\Program Files (x86)\ArcGIS\Desktop10.1\Utilities). For some reason, on my computer the point marker symbols only rotate with the data frame when that option is un-checked, and line marker symbols only rotate with the data frame when that option is checked. Weird, eh? Rotating symbols with data frames supposedly only works if you set symbol rotation using the "Rotate Points by Angle in this field" option in the Symbology/Advanced/Rotation... window, so I chose the field "<expression>", and put the value 0 as the expression. If you have another version of ArcGIS, maybe all you have to do is check the "Rotate Marker Symbols with Data Frame" rather than un-check it like I had to do. I don't blame you for not wanting to write df1.rotation values to a Feature Class every time you rotate a data frame... that would make map automation rather inefficient! Good luck, Kerry
... View more
09-12-2013
11:17 AM
|
0
|
0
|
984
|
POST
|
Thanks for the insight Rhett! I was about to try using feature datasets to see if they would help, so you saved me from more frustrated blundering. It is extremely unlikely that anybody else had opened anything relevant to my workflow. While writing this post, an officemate stepped out to lunch so I jumped on his computer to test everything out on that machine. I was not able to reproduce the issues unless I used preexisting FGDB and MXDs (that I presume had been corrupted). I started troubleshooting to determine what part of my workflow could be corrupting the FGDB and/or MXD, but now I can't reproduce the problems on my computer either. I still get the errors, however, if I use the FGDBs and MXDs that I created earlier today and yesterday, and a compact doesn�??t change that. I�??m assuming that those files were permanently corrupted. Whatever the issue was before, it was evident after each of my 3 complete "fresh starts" (creating a new FGDB and MXD after rebooting) and many partial fresh starts (various combinations thereof). In addition to getting Error 210 from Python and Model Builder, I also couldn�??t export a data selection from ArcMap to the FGDB (the ArcMap errors weren�??t numbered: �??Workspace or data source is read only.�?� and �??The table was not found. [Export_Output]�?�). If the problem returns, I�??ll post more information. Otherwise I'm keeping my fingers crossed! Thanks for all the help!
... View more
06-12-2013
11:56 AM
|
0
|
0
|
679
|
POST
|
Oops! Thanks Rhett for pointing out my typos! However, those typos were only in my forum post, and not in my script. I did have my workspace environment set, and had the �??mxd = �?? in my line defining the map document. I�??m also using standalone IDEs. Since Rhett confirmed that the workflow should work, I just gave up, and started implementing work-arounds�?� However�?� Today I can get my scripts to work if I use personal geodatabases instead of file geodatabases! I have no clue why I had problems with a personal geodatabase yesterday (operator error?? #$%&*!). So I may have prematurely discarded my original assumption that my issues are related to the Windows updates. However, I don�??t have any of the listed �??offending�?� updates installed on my computer (http://support.esri.com/en/knowledgebase/techarticles/detail/41119), and my issues have a slightly different flavor than those described in the Tech Article. For the record, I observed other related issues while troubleshooting my attempts to create a buffer feature class in a file geodatabase: - Model Builder errors implied that my workspace was �??read only�?� when it wasn�??t. - Arcpy.Buffer_analysis(�?�) caused ERROR 000210: Cannot create output. - running the buffer tool from ArcMap doesn�??t seem to have a problem. Occasionally I can successfully run the delete, buffer, or other tools using a file geodatabase without getting errors, but I can�??t for the life of me figure out why because the successes are so infrequent and seem to be independent of rebooting or creating new workspaces/mxd�??s. I have one project that is usually successful in deleting/creating feature classes in a file geodatabase, but the workspace database was created using ArcCatalog 10.0 a year ago. So, any ideas what's up?
... View more
06-12-2013
06:56 AM
|
0
|
0
|
679
|
POST
|
I have a short geoprocessing script with an arcpy.Delete_management() line that keeps throwing a lock error: "ERROR 000464: Cannot get exclusive schema lock. Either being edited or in use by another application." Details: (code pasted below too) I can successfully delete "lrs_buffer" if I skip the lines of code defining the mxd and the layers. However, I can't think of why there would be a lock on "lrs_buffer" due to creating the map document object, since "lrs_buffer" had never been added to the mxd. Also, if I'm using a file geodatabase as a workspace and observe through Windows Explorer, no lock files for "lrs_buffer" are created in this workflow. I am having the same problem if I use a personal geodatabase as my workspace.
import arcpy
arcpy.env.overwrite = True
workspace = r"V:\Projects\Shared\RouteLogSystem\ArcGIS_10_Prototype\Prototype_V10\rtlogptsQAQC\RouteLogPointsQAQC.gdb"
arcpy.mapping.MapDocument(r"V:\Projects\Shared\RouteLogSystem\ArcGIS_10_Prototype\Prototype_V10\rtlogptsQAQC\RouteLogPoints.mxd")
rtlogpts = arcpy.mapping.ListLayers(mxd, "*rtlogpts")[0] #feature class on SDE
lrs = arcpy.mapping.ListLayers(mxd, "*lrs_route_twn")[0] #feature class on SDE
rdsmall_copy = arcpy.mapping.ListLayers(mxd, "rdsmall_arc")[0] #feature class in workspace
bufferFC = "lrs_buffer"
if arcpy.Exists(bufferFC):
arcpy.Delete_management(bufferFC)
arcpy.Buffer_analysis(lrs.dataSource, bufferFC, "2 Meters", dissolve_option = "ALL")
Any ideas about what is happening? Thanks! Kerry
... View more
06-11-2013
12:49 PM
|
0
|
10
|
5403
|
POST
|
Hi Lawrence, It isn't possible to have multiple "Symbol Classes" that behave similarly to "Label Classes," with or without Python. Whenever I want to apply different symbologies to the same layer/dataset, I create multiple copies of the original layer and then give each copy its own definition query and symbology. Even if you wanted to automate this process with Python, you'd still have to have pre-existing layer files with the desired definition queries and symbologies, which could then be imported into your new layers. Good luck! Kerry
... View more
06-05-2013
12:45 PM
|
0
|
0
|
1591
|
POST
|
I'm having the same problem. Someone reported the bug on May 8 (NIM-091487), but there is no information regarding when/if it will be fixed. Simple workaround: Include the layer's definition query in the cursor's "where clause" and refer to the layer.dataSource instead of the layer itself when creating the cursor. For example: This doesn't work: MRDroutelogEvents.definitionQuery = "\"TWN_TID\" = '%s'" %twnlr
ghost_query = "\"SR_CATEG\" = 'GHOST'" %twnlr
ghost_points = sorted([item[0] for item in (arcpy.da.SearchCursor(MRDroutelogEvents, ["SR_CATEG"], ghost_query))])
This does work: ghost_query = "\"TWN_TID\" = '%s' AND \"SR_CATEG\" = 'GHOST'" %twnlr
ghost_points = sorted([item[0] for item in (arcpy.da.SearchCursor(MRDroutelogEvents.dataSource, ["SR_CATEG"], ghost_query))]) #(doesn't matter if there is a definition query on MRDroutelogEvents or not)
... View more
06-03-2013
06:39 AM
|
1
|
0
|
317
|
POST
|
Thanks for the tip John...putting ArcMap commands in buttons using the Config.xml file is a cool shortcut for commands that have a ProgID! However, I haven't been able to figure out how to use buttons to allow me to undo edits made with the add-in. As far as I can tell, the command buttons would be functionally equivalent to the buttons (or menu options) that are in ArcMap. My limitation is that the arcpy.da.editor in an add-in is always a unique instance limited to the the scope of the add-in. Actually, it's limited to whichever class it was created in. In short, I can't find a way to refer to an ArcMap editing session from a tool class, or a way to refer to a tool class's arcpy.da.editor editing session from outside the class. If only editing sessions were properties of add-in tool classes... I did consider using an add-in extension class because it can be aware of a series of ArcMap events before, during, and after an editing session within the class. Unfortunately extensions don't have the same functions/methods as tool classes. Even though an extension can access tool properties (e.g. change the "enabled" property), they are still two distinct classes and can't access the same arcpy.da.editor. I'm exploring the possibility of using comtypes (accessing ArcObjects with Python wrappers), but it's still a little over my head so it's going slow!
... View more
05-10-2013
06:33 AM
|
0
|
0
|
486
|
POST
|
The "isTimeEnabled" property is actually a property of the "LayerTime" property, and "LayerTime" is a property of the layers you're working with. Both of those properties are Read Only, so you can't edit them *directly* with Python code. Fortunately, layer time properties can be "updated" in Python (using the UpdateLayerTime function that I mentioned in my last post). As long as you enable the time on the layer file that you're using as a "time properties template," then any layer that you update with it will be time enabled. I don't know why Esri won't let us change the "isTimeEnabled" property directly. Kerry
... View more
04-19-2013
05:53 AM
|
0
|
0
|
199
|
POST
|
Hi Nadeem, You'll need another layer that already has it's time properties set as desired (set manually in ArcMap). Then when you create a layer, you can update its time properties using the other layer as a source using arcpy.mapping.UpdateLayerTime(). It should only update the time properties. Good Luck! Kerry
... View more
04-18-2013
08:39 AM
|
0
|
0
|
199
|
POST
|
Based on a post in a similar thread: http://forums.arcgis.com/threads/60725-Python-Addin-and-Undo-Redo?p=280913&viewfull=1#post280913 I now think that .Net is probably the way to go for addin editing flexibility. More addin editing observations in case someone finds them useful: I've found that the behavior I observed in scenario #2 (in my previous post) is not consistently reproducible, and addins that edit SDE data only run reliably if the edit session is controlled from within the addin. However, if I am already in an ArcMap editing session when I run my addin (addin with code controlling its own editing session), that the features are indeed created because the addin doesn't break until it reaches the line where I attempt to stop editing and save edits. New features created by the "unsuccessful" run of the addin can then be seen with a "refresh", and saved via "Save Edits" in the ArcMap editing session, or discarded via "Stop Editing" without saving edits. At least this means that if an absentminded user (like me) runs an addin editing tool when already in an editing session, the edits can be "salvaged" even if the addin doesn't finish its execution. I'm reluctant to use "try" statements to bypass legitimate errors since they might be useful when the tool is used "properly." Time to learn .Net!
... View more
03-15-2013
10:37 AM
|
0
|
0
|
486
|
POST
|
Hi Babak, In the query, try stripping the double quotes: lyr.definitionQuery = '{0} in ({1})' .format(newName.strip('"'), queryList)
... View more
03-15-2013
07:00 AM
|
0
|
0
|
234
|
POST
|
Sorry, I should have been more clear... I was refering to line 68 (I think, based on the error message in your initial post) that was: uc=arcpy.UpdateCursor(parcel) Because 'parcel' is an integer, the UpdateCursor wasn't being created. It was just my guess that the data you wanted the cursor to access was your parcelsFL feature layer. If that is the case, you can replace 'parcel' in your line that matches the one I pasted above with 'parcelsFL', like this: uc=arcpy.UpdateCursor(parcelsFL) Regardless of what dataset you want to access with your cursor, you need to refer to it by its path which is a string. Hope that clarifies what I was trying to say!
... View more
03-13-2013
01:15 PM
|
0
|
0
|
672
|
POST
|
Your error is occurring because arcpy.UpdateCursor requires a string input (path to dataset), and your variable 'parcel' is an integer. Try: uc=arcpy.UpdateCursor(parcelsFL)
... View more
03-13-2013
12:24 PM
|
0
|
0
|
672
|
POST
|
I have a Python AddIn that edits SDE feature classes. I???d like to have the option to Undo/Redo edits made with the AddIn. So far I???ve tried several approaches (below), and am wondering if anybody can shed some insight on my observations. If you have any other ideas about how to undo/redo AddIn edits, let me know! Alternatively, if this is not possible using Python AddIns, what would be my best approach to reproduce some VBA tools requiring user input that are now obsolete? Unsuccessful attempts to undo Python AddIn edits: 1) Managing the edit session from within the Addin. Code structure: edit = arcpy.da.Editor(workspace)
edit.startEditing()
edit.startOperation()
Cur.insertRow([geometry])
edit.stopOperation()
edit.stopEditing(True)
arcpy.SelectLayerByAttribute_management(layer, "CLEAR_SELECTION") Observation: When I run my AddIn, the Undo button activates with a single operation in the stack, and I can apparently undo the clear selection (but only if the initial selection was made using a tool in my AddIn rather than the standard ArcMap ???select by rectangle??? button). I???m not surprised that the AddIn edits are not visible to the operation stack in ArcMap, but have no idea what the selection is doing there. Any insights? 2) Alternatively, if I starting an edit session in ArcMap before running the AddIn (with the editing code commented out) I see this: The AddIn edits are undoable only incidentally when there are manually generated edits on the operation stack before the AddIn is run (i.e. undoing the last manual edit also undoes any AddIn edits that were made after the manual edits).
... View more
03-13-2013
12:12 PM
|
0
|
4
|
3340
|
POST
|
Thanks mvolz47! What you said finally sank into my thick head... and set off a whole cascade of Eureka moments. I simply changed the workspace (using the .workspacePath of a layer instead of its .dataSource): workspace = rdsmall_lyr.workspacePath which was equivalent to the SDE connection path: workspace = r"C:\Users\kalley\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\GDB_HMSDEV.sde" and everything went smoothly! Thanks again!!
... View more
03-12-2013
01:55 PM
|
0
|
0
|
902
|
Title | Kudos | Posted |
---|---|---|
1 | 03-06-2015 08:46 AM | |
1 | 07-24-2014 11:07 AM | |
1 | 06-03-2013 06:39 AM | |
2 | 09-14-2015 08:32 AM | |
3 | 07-23-2014 01:57 PM |
Online Status |
Offline
|
Date Last Visited |
11-03-2021
02:31 PM
|