|
POST
|
Thanks for the reply. The code works fine in that it runs without errors, but for whatever reason it's keeping those quotes in the resulting definition query. Using the code I provided above, my expected result is: SHAPE.STLength() and I'm getting: 'SHAPE.STLength()' which is a syntax error in the definition query. I've tried swapping out double quotes/single quotes and the code will bring over either one that is used in the script. Removing the quotes altogether generates the following error: File "C:\temp\DefQueryScript\ReplaceStatement.py", line 25, in <moldule> 'shape_length' : SHAPE.STLength(), NameError: name 'SHAPE' is not defined. which is to be expected. If I go into the MXD and create the same definition query manually, no quotes are used. Is it possible there is a setting somewhere that allows DQs to run without the quotes or would put them back in?
... View more
12-16-2015
07:20 AM
|
0
|
3
|
1783
|
|
POST
|
I've got a series of MXDs with definition queries with file gdb-specific syntax. I'd like to batch modify those DQs to work with enterprise gdb syntax. Not every layer has a DQ, and not all DQs are the same. The problem I'm running into is with the expressions portion... the function is passing 'SHAPE.STLength()' with the quotes to the definition query, which doesn't match the syntax (need it without the quotes). Changing them to double quotes returns similar results, and removing the quotes all together causes the function to fail. Any ideas? import arcpy from arcpy import env from os import path env.workspace = ws = r"C:\temp\DefQueryScript\test1" expressions = { 'shape_length' : 'SHAPE.STLength()', 'shape_area' : 'SHAPE.STArea()', 'SHAPE_Length' : 'SHAPE.STLength()', 'SHAPE_Area' : 'SHAPE.STArea()', 'SHAPE_length' : 'SHAPE.STLength()', 'SHAPE_area' : 'SHAPE.STArea()', } def letsGetThisPartyStarted(): ''' For each Map Document in the workspace, check each layer for a definition query, and if found, update it according to the contents of the expression dictionary.''' print "Let's get this party started!\n" mxds = getMXDs() for i, mxd in enumerate(mxds): for layer in getLayers(mxd): evaluateExpression(layer) saveMXD(mxd, i) def getMXDs(): ''' Create a list of each Map Document in the workspace(s).''' mxds = [arcpy.mapping.MapDocument(m) for m in arcpy.ListFiles("*.mxd")] return mxds def getLayers(mxd): ''' Collects all feature layer in a Map Document.''' print "{0} layers:\n".format(mxd.filePath) layers = [l for l in arcpy.mapping.ListLayers(mxd) if l.isFeatureLayer] return layers def evaluateExpression(lyr): ''' If the layer has a Definition Query, update that query using the dictionary of expressions.''' if lyr.definitionQuery: for exp in expressions.items(): key, value = exp[0], exp[1] if key in lyr.definitionQuery: updateDefinitionQuery(lyr, key, value) else: print " {0}: No Definition Query found\n".format(lyr.name) pass def updateDefinitionQuery(lyr, old_exp, new_exp): ''' Replaces the old expression with the new one. Fill in the old/new associations in the "expressions" dictionary above.''' print " {0}:".format(lyr.name) print " Old expression: {0}".format(lyr.definitionQuery) lyr.definitionQuery = lyr.definitionQuery.replace(old_exp, new_exp) print " New expression: {0}\n".format(lyr.definitionQuery) def saveMXD(mxd, i): ''' Saves a copy of the Map Document which has had it's layers Definition Queries updated.''' mxd.saveACopy(path.join(ws, "COPY_" + mxd.filePath + "_{0}.mxd".format(i))) del mxd if __name__ == "__main__": letsGetThisPartyStarted() print "'fin.'"
... View more
12-16-2015
05:31 AM
|
0
|
5
|
5042
|
|
POST
|
Answer: Enable the Information Model on the Parcel Fabric prior to attempting to use workflows.
... View more
10-18-2015
09:31 AM
|
0
|
0
|
1040
|
|
POST
|
I just loaded a corrected topology into the parcel fabric and was attempting to edit a parcel. I chose the Merge Parcels workflow and got this error: "This Parcel Fabric layer is not compatible with the Parcel Workflows, please update your current map by replacing the Parcel Fabric and its associated layers with a new one." Anyone have any ideas how I can get rid of the error and start editing?
... View more
10-16-2015
01:53 PM
|
0
|
2
|
3690
|
|
POST
|
There doesn't appear to be 🙂 We create custom response zones which are different enough from ESNs that the ESN layer can't be used. Although I would appreciate a template or workflow for applying ESN values to road ranges.
... View more
09-28-2015
11:02 AM
|
0
|
0
|
1218
|
|
POST
|
Brian, As it turns out, I'm working on the exact same thing. We're using the RoadCenterline feature class as it does have fields for ESN left/right and MSAG left/right. I don't even care to try and understand what the rest are for right now. When you state that ESN and PSAP are domain entries - the version of the LGM I'm using (10.2), they don't appear to be set up that way. Has that changed with newer versions? I suppose you could force them to be domain based if you so choose; not a bad idea! What sort of layer are you using to store your ESN shapes? That's what I found to be missing from the LGM.
... View more
09-28-2015
09:38 AM
|
0
|
2
|
1218
|
|
POST
|
Aaron, We've simply appended extra fields onto the schema of layers in the parcel fabric. The original LGIM schema is intact, so the fabric operates as expected, templates work, etc., but we have the added information stored in the appended columns. We're also starting to use a series of relates and .lyr files for more common and repeated functions. --Sallie
... View more
09-24-2015
11:25 AM
|
1
|
0
|
1037
|
|
POST
|
Have you looked at the Building layer in the FacilitiesStreets dataset? It's a poly layer, but I see no reason you couldn't use the schema and have a point layer instead. The description of that layer indicates that it's a subset of another layer only representing buildings managed by a local government or other land holder.
... View more
09-24-2015
11:19 AM
|
0
|
0
|
612
|
|
POST
|
Now I'm with you. You've got me on this one . They appear to be a property of a feature and not stored in the attribute table, which is what you likely discovered before posting here. Best of luck -- would love to know the answer.
... View more
08-04-2015
12:13 PM
|
0
|
0
|
2038
|
|
POST
|
I'm not sure I fully understand the question. Are you asking about the origin of the annotation? If so, that's stored in the ParcelFabric_Lines feature class as Distance. The Distance is updated automatically as you edit the ParcelFabric_Parcels feature class.
... View more
08-04-2015
11:57 AM
|
0
|
2
|
2038
|
|
POST
|
Blaine, You are correct, there does not seem to be a place in the model for this kind of data. It's really good idea though, as many college campuses, medical facilities, and military installations have this sort of infrastructure. I'd recommend submitting an idea to ESRI: http://ideas.arcgis.com/ For now, however, you could probably create your own feature dataset and feature classes that is similar to other LGIM data. --Sallie
... View more
07-17-2015
09:16 AM
|
0
|
1
|
1156
|