|
POST
|
You just want to edit the built in dynamic text to display a custom title? Something like this? Which uses the page number as the Pit title. Pit <dyn type="page" property="number"/> Site Plan
... View more
05-03-2012
10:44 AM
|
0
|
0
|
1161
|
|
POST
|
Kind of messy, but here is how I have accessed SDE feature classes in a dataset before. It is exporting all the feature class in each dataset in the target SDE. dsList = arcpy.ListDatasets("TFM.TFM_*", "Feature")
for ds in dsList:
fcList = arcpy.ListFeatureClasses("","",ds)
ds = str(ds).partition(".")[2]
print "Starting "+ds
arcpy.CreateFeatureDataset_management(output, ds, sr)
for feature in fcList:
featout = str(feature).partition(".")[2]
try:
if not arcpy.Exists(output+ds+"\\"+featout):
arcpy.FeatureClassToFeatureClass_conversion(feature, output+ds, featout)
... View more
05-03-2012
07:37 AM
|
0
|
0
|
2763
|
|
POST
|
You are correct, you should not need to change your workspace to the dataset. Are you sure that is the name of the feature class? SDE feature classes usually have the username appending to the beginning of the feature class EG SDE.FEATURECLASS.
... View more
05-02-2012
03:00 PM
|
0
|
0
|
2763
|
|
POST
|
How is your memory usage during the processing? Have you tried running it using the ONLY_FID Join Attributes value? I'd try a Repair Geometry on both feature classes. When you run the intersect, try setting a larger XY tolerance in your environment settings. 1m should be a good test. If that doesn't work, try running it from the python window. If that still doesn't work, try exporting them both to a FGDB and repeat the previous steps. Final attempt, try intersecting using a subset of the data. Still doesn't work? Contact Esri support.
... View more
05-02-2012
02:55 PM
|
0
|
0
|
1836
|
|
POST
|
We are using ArcSDE 10.0 SP 4, SQL 2008 R2, direct connections and using python to execute the CalculateField tool. It takes about 12 minutes to calculate about 70 rows within a child version of default in a parcel fabric. I was curious if there was a performance enhancement request pending or a workaround to this behavior. Thanks. Does using a cursor to calculate the geometry work better? Something like this? import arcpy
layer = "some_layer_or_path_to_fc"
desc = arcpy.Describe(layer)
shapeField = desc.shapeFieldName
field = "Area_field_to_update"
ucurs = arcpy.UpdateCursor(layer)
for row in ucurs:
area_set = row.getValue(shapeField).area
row.setValue(field,area_set)
ucurs.updateRow(row)
... View more
05-02-2012
02:15 PM
|
0
|
0
|
3860
|
|
POST
|
Sorry to be a pest with this simple task, but still not working. Appears that is is treating the expression as the field.......confused. It now returns the following error: ERROR 000728: Field str(!Segment_Code!).zfill(6) does not exist within table Failed to execute (CalculateField). You are using the wrong syntax. Check your tool documentation here. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000004m000000 The expression is the third variable passed to the tool, the field is the second.
... View more
05-02-2012
01:52 PM
|
0
|
0
|
3737
|
|
POST
|
Never tried importing built ins, not sure what the reason you would want to do that is. For what it is worth, the problem is in SP3 as well. Test Code import arcpy import os toolDir = r"C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes" for file in os.listdir(toolDir): box = os.path.join(toolDir,file) try: arcpy.ImportToolbox(box) except: print "Error found in "+file pass Output <module '3d' (built-in)> <module 'analysis' (built-in)> <module 'ArcPad' (built-in)> <module 'cartography' (built-in)> Error found in Conversion Tools.tbx <module 'arc' (built-in)> <module 'interop' (built-in)> Error found in Data Management Tools.tbx <module 'edit' (built-in)> <module 'geocoding' (built-in)> <module 'ga' (built-in)> <module 'lr' (built-in)> <module 'md' (built-in)> <module 'na' (built-in)> <module 'fabric' (built-in)> <module 'samples' (built-in)> <module 'schematics' (built-in)> <module 'server' (built-in)> <module 'sa' (built-in)> <module 'stats' (built-in)> Error found in toolbox.lic <module 'ta' (built-in)> So looks like problem importing Conversion and Data Management Toolboxes.
... View more
05-02-2012
09:22 AM
|
0
|
0
|
1727
|
|
POST
|
Your paths are incorrect. Valid path formats are as follows.
arcpy.env.workspace = r"G:\Imagery\Orthos_2009\Photos\TIFF"
arcpy.env.workspace = "G:\\Imagery\\Orthos_2009\\Photos\\TIFF"
arcpy.env.workspace = "G:/Imagery/Orthos_200/Photos/TIFF"
The proper way to combine a path and file name are as follows. Both of these require importing the os module
input = os.path.join(InFolder,raster) # Much preferred
input = InFolder + os.sep + raster
... View more
05-02-2012
08:45 AM
|
0
|
0
|
2833
|
|
POST
|
Depending on the level of control you want over your mapped fields, here's an example of what I use. As taken from this thread.
def GetFieldMappings(fc_in, fc_out, dico):
field_mappings = arcpy.FieldMappings()
field_mappings.addTable(fc_in)
for input, output in dico.iteritems():
field_map = arcpy.FieldMap()
field_map.addInputField(fc_in, input)
field = field_map.outputField
field.name = output
field_map.outputField = field
field_mappings.addFieldMap(field_map)
del field, field_map
return field_mappings
dico = {
'OBJECTID': 'O_OID',
'BLOCKSTAGE': 'BLOCKSTAGE',
'AREAGIS': 'AREAGIS',
'OPERATIONSTYPE': 'OPTYPE',
'BLOCKTYPE': 'BLOCKTYPE',
'HARVESTSEASON': 'HARVSEASON',
'ROADPERCENTAGE': 'ROADPERCNT',
'SOURCECODE': 'SOURCECODE',
'ZONECODE': 'ZONECODE',
'TOWNSHIP': 'TOWNSHIP',
'RANGE': 'RANGE',
'MERIDIAN': 'MERIDIAN',
'BLOCKSECTION': 'BLOCKSEC',
'GRIDNUMBER': 'GRIDNUMBER',
'PASS': 'PASS'
}
Mapper = GetFieldMappings(fc_in, fc_out, dico)
... View more
05-02-2012
07:48 AM
|
0
|
0
|
1388
|
|
POST
|
That sounds more like an intersect operation than a clip.
... View more
05-01-2012
10:40 AM
|
0
|
0
|
1047
|
|
POST
|
Here's an example of something close to what I do. Each sheet is it's own table. import arcpy, os arcpy.env.workspace = r"C:\GIS\xlsxTest" outPath = r"C:\GIS\xlsxTest\output" fileList = arcpy.ListFiles("*.xlsx") for file in fileList: arcpy.env.workspace = os.path.join(r"C:\GIS\xlsxTest", file) tabList = arcpy.ListTables() # Convert excel to DBF tabNum = 0 for tab in tabList: tabNum += 1 arcpy.TableToTable_conversion(tab, outPath, "Table"+tabNum+".dbf")
... View more
05-01-2012
10:36 AM
|
0
|
0
|
1337
|
|
POST
|
You'll want to use python for this (or model builder if you are so inclined). For this example I assume each township extent is it's own feature class in a directory. It appends a unique count number to the end of the output if they don't have unique names. This should give you a good place to start. import arcpy
import os
ws = r"C:\your_township_dir"
arcpy.env.workspace = ws
outdir = r"C:\outdir"
soils_fc = "path_to_soils_fc"
soils_temp = r"in_memory\soils_temp"
arcpy.MakeFeatureLayer_management(soils_fc,soils_temp)
twp_temp = r"in_memory\twp_temp"
fc_list = arcpy.ListFeatureClasses()
unique = 1
for fc in fc_list:
arcpy.MakeFeatureLayer_management(fc,twp_temp)
arcpy.Clip_analysis(soils_temp,twp_temp,os.path.join(outdir,fc+unique))
unique += 1
... View more
05-01-2012
09:55 AM
|
0
|
0
|
1047
|
|
POST
|
Close. You can't make a feature class a workspace though. And you just want a temp layer for selection not a permanent layer file. Try something like this. import arcpy
arcpy.env.overwriteOutput = True
tempLayer = r"in_memory\templayer"
field = "Label"
value = "drillhole"
where = "%s = '%s'" % (field,value)
dhList = []
for w in ws:
arcpy.env.workspace = w
gdb = arcpy.ListWorkspaces("*", "Access")
for fc in gdb:
arcpy.env.workspace = fc
fcl = arcpy.ListDatasets("*", "Feature")
for fcc in fcl:
arcpy.env.workspace = fcc
fccl = arcpy.ListFeatureClasses("*", "All")
for stil in fccl:
arcpy.MakeFeatureLayer_management(stil, tempLayer, where)
arcpy.SelectLayerByAttribute_management(tempLayer)
count = int(arcpy.GetCount_management(tempLayer).getOutput)
if count > 0:
dhList.append(stil)
for item in dhList:
print item
... View more
05-01-2012
05:12 AM
|
0
|
0
|
1846
|
|
POST
|
I'm trying to find an add-in that allows me to enter a parcel#, select, then zoom to that parcel. I have seen "zoom to attribute" examples but nothing that allows me to enter parcel numbers. The add-in would be used by me to zoom to the parcel without having to open attribute table find the parcel number (out of thousands) then zoom to. This is the code I have used, which selects all the parcels and then zooms to extent the layer name is "Parcel_Link" and the Field that holds the parcel number is PIN mxd = arcpy.mapping.MapDocument('CURRENT') ... df = arcpy.mapping.ListDataFrames(mxd, "Layers") [0] ... Parcel_Link = arcpy.mapping.ListLayers('CURRENT', Parcel_Link, df)[0] ... whereClause = "PIN ='%s'" % Parcel_Link ... arcpy.SelectLayerByAttribute_management("Parcel_Link", "NEW_SELECTION", whereClause) ... df.extent = Parcel_Link.getSelectedExtent(True) ... df.scale *= 1.5 ... arcpy.RefreshActiveView() Any input would be nice Thanks Joby Here is a script I use to zoom to an attribute passed from a script tool. import arcpy
arcpy.AddMessage("Starting")
pu = arcpy.GetParameterAsText(0)
arcpy.AddMessage(pu)
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Main Map")[0]
lyr = arcpy.mapping.ListLayers(mxd, "PLANNING UNIT", df)[0]
arcpy.AddMessage(lyr.name)
expression = "PLANNINGUNIT = '"+pu+"'"
arcpy.AddMessage(expression)
arcpy.SelectLayerByAttribute_management(lyr,"NEW_SELECTION",expression)
df.extent = lyr.getSelectedExtent()
df.scale = df.scale*1.1
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "PU"):
if elm.name == "PU":
elm.text = (pu)
arcpy.SelectLayerByAttribute_management(lyr,"CLEAR_SELECTION")
arcpy.RefreshActiveView()
arcpy.AddMessage("Completed")
... View more
04-30-2012
02:04 PM
|
0
|
0
|
1904
|
|
POST
|
I hear your frustration, i don't understand why ESRI is not going to be using VBA anymore. Because VBA is no longer going to be supported by Microsoft. If you are interested you can read details on it here to garner an understanding. http://blogs.esri.com/esri/arcgis/2009/03/30/vba-and-vb6-the-road-ahead/
... View more
04-30-2012
01:57 PM
|
0
|
0
|
1904
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-17-2011 10:36 AM | |
| 1 | 08-16-2012 10:48 AM | |
| 1 | 10-31-2012 08:39 AM | |
| 1 | 07-16-2012 01:52 PM | |
| 1 | 03-15-2012 10:57 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-22-2024
11:12 PM
|