POST
|
I keep running into the same issues regarding both syntax and code structure and I was hoping someone or some folks might be able and willing to shed light on the issue(s). Situation: In the course of our work, we often, in broad terms, need to do something like the following: 1) Create a set of new fc records. And often this is done by grabbing some existing data and updating some of the attiributes. 2) Polulate the attributes of those new records by linking them to other (object) tables and pushing in those values. So, from what I just described above, there are two things that come up, over and over and over. 1) I don't work in *an* environment, in my current map. I work in multiple environments---all the time--line by line. So with that, when I see that all of the examples in the "HELP" begin by setting the environment, well, that is NOT helpful, as I am typlically operating against multiple SDE domains all at once, all the time. So, for instance, ADDRESS = "Database Connections\\SewerViewerREADONLY.sde\\sde_web.GEO.ADDRESS" PARCEL_table = "Database Connections\\SewerViewerREADONLY.sde\\sde_web.GEO.ADDRESS_PARCEL" ADDR_WORK = "Database Connections\\GISDEV_EDITOR.sde\\EDITOR.SASD.ADDR_WORK" So as long as I assign a variable to a specific fc from a specific domain in my that is in my current map document up at the top of the script, can I just ignore this explicit environment setting monkey business? And again, I ask because we are constantly working with, for, and against multiple environmenst ALL THE TIME for most of our work. And it would only make sense that others would too. And this because I know we are not the only organization that are continually attempting to maintain current record accuracy between an address db and a parcel db. 2) I need to joint an object table to a fc, I then need to access the attribues of those new available attributes after the join is made successfully in my current map document. And so the question arises, what syntax is used in Python and ArcPy to access those attributes? Is is it simply using a "dot operator" before the joined attribute? Or are no explicit references needed? That is, as long as you spell it right, the code will see it? Or does it want a "forward slash" ? And these are sde fcs turned into variables, mind you. So again, how to access and populate them? And is the syntax the same for both accessing and populating? Or is it different ? 3) With the worflow needs of Address FCs (points) and Parcel Tables (or polygon FCs) above, it is rather unclear where and where to use an AddJoin_management (in_layer_or_view, in_field, join_table, join_field, {join_type}) and when to use an arcpy.JoinField_management (inFeatures, joinField, joinTable, joinField, fieldList). And this confusion is compounded, syntax-wise, when the very next action includes a with arcpy.da.UpdateCursor(fc, fields) as cursor: I have looked in the "HELP" documentation in ARCGIS Resources, in ArcPy Cafe, and in StackExchange and cannot find any resource that discusses this workflow, that, to me, seems to be a very fundemental essential one. Together, these 3 issues: environment settings, join syntax and construction, and subsequent update(cursor) construction and syntax keep putting up huge hurdles to my development and understanding efforts. Please help! And thanks in advance, y'all
... View more
10-03-2014
11:36 AM
|
0
|
0
|
2819
|
POST
|
I am trying to build some tools using Toolbox and Python for users who are in the ArcMap environment, in an ArcMap session. So the first thing I want to to is get a list of the feature classes and/or layers in the current "Data Frame", pass them into the Toolbox as a parameter, so that the user can then pick one (or more) of them and then begin doing stuff like comparing attributes between 2 feature classes and so forth. But the problem or challenge is that a "Workspace" is a file folder or a Geodatabase or similar and NOT a "Data Frame". And this is not handy, because to the user, the "Data Frame" is, in fact a storage place for the things they wish to do geoprocessing against. Does anyone have any ideas for developing a framework for using the Map Document, instead of traditional "Workspaces", as a place to assemble various feature classes, tables, etc. from various domains, file folders, file geodatabases, etc.? Conceptually, I need to do something like this: import arcpy mxd = arcpy.mapping.MapDocument arcpy.env.workspace = mxd And this, so I can start doing things like creating lists and other sorts of things, but in the context of the map as the current workspace.
... View more
09-25-2014
09:03 AM
|
0
|
1
|
6241
|
IDEA
|
-->
I want to use Python rather than VBScript to label items for various reasons. However, Python is proving to be very, very finicky in regards to syntax and context, relative to VBScript. An example: in order to show labels of a date stamp in the "mm/dd/yyyy" format using VBScript, you simply apply the following code: FormatDateTime(d,2) Yes, that is it! However, I have tried in many, many ways to accomplish the same thing using Python---for hours. And no success. So I called tech. support and they don't know either. So they are going to "explore the idea" and get back to me. Meanwhile, I asked them why there are not more expamples in the ESRI Resources Help [ http://resources.arcgis.com/en/help/main/10.1/index.html#//00s800000027000000 ] regarding, for instance, date labels and they suggested that I submit that "idea" (complaint?) here.
... View more
07-16-2014
09:52 AM
|
14
|
1
|
491
|