POST
|
Does the map document have data-driven pages enabled? Is the picture element set to either 1) use a field as the image path or 2) use an attachment as the image source? If so, that is the reason you can't set the image path.
... View more
06-19-2014
09:12 AM
|
0
|
0
|
644
|
POST
|
There is a geoprocessing tool to create SDE connection files that you could use.
... View more
06-16-2014
12:42 PM
|
0
|
0
|
314
|
POST
|
Try the IApplication.OpenDocument method. There is an example with code here.
... View more
06-10-2014
04:27 PM
|
0
|
0
|
1854
|
POST
|
It's only refreshed in the updateParameters() method. Add this to it: gridFC = os.path.dirname(arcpy.mapping.MapDocument("CURRENT").filePath) + r"\SourceData.gdb\Grid_Index"
parameters[0].values = sorted([[r[0] + " pg. " + str(r[1])] for r in arcpy.da.SearchCursor(gridFc, ["MXD_NAME", "PAGE_NUM"])])
... View more
06-05-2014
03:37 PM
|
0
|
0
|
483
|
POST
|
Try casting to string: gp.CalculateField_management(lcp_name+".shp", "COST", str(cost1), "PYTHON")
... View more
06-04-2014
11:55 AM
|
0
|
0
|
1144
|
POST
|
Mike: we're bundling xlrd and xlwt with newer versions of ArcGIS, would that be adequate for your needs? I'm aware of the demand for Pandas (I want it too), I'm going to see what I can do with that.
... View more
05-30-2014
10:01 AM
|
3
|
7
|
848
|
POST
|
I'm surprised this works at all for you. Describe is not the appropriate function to use here. Try this: import arcpy
from arcpy import env
# Loop through all MXDs in the specified folder and list layers in each MXD
folderPath = r"mydata"
env.workspace = folderPath
maps = arcpy.ListFiles("*.mxd") # makes a list of maps in folderPath
for map in maps:
mxd_path = os.path.join(env.workspace, map)
print mxd_path
mxd = arcpy.mapping.MapDocument(mxd)
lyrlist = arcpy.mapping.ListLayers(mxd)
for lyr in lyrlist:
print lyr.dataSource
... View more
05-22-2014
12:15 PM
|
0
|
0
|
280
|
POST
|
Could you paste the full traceback? Try this: import io
with io.open(myfile, "w", encoding="utf-8") as txtFile:
for fd in fdList:
arcpy.env.workspace = wksp+'/'+fd
fcList = arcpy.ListFeatureClasses()
txtFile.write(fd)
txtFile.write(os.linesep)
for fc in fcList:
arcpy.env.workspace = wksp+'/'+fd+'/'+fc
fields = arcpy.ListFields(arcpy.env.workspace)
txtFile.write(u' '+fc)
txtFile.write(os.linesep)
for field in fields:
fieldname = field.name
txtFile.write(fieldname)
txtFile.write(os.linesep)
print "done"
... View more
05-20-2014
01:48 PM
|
0
|
0
|
583
|
POST
|
I'd just do it as a script: featureclass = r"c:\my.gdb\myfc"
field = "idfield"
id = 1
with arcpy.da.UpdateCursor(featureclass, field) as cur:
for row in cur:
cur.updateRow(["FIT-{0}".format(id)])
id += 1 but this modification to yours works too: rec=0
def autoIncrement():
global rec
pStart = 2555 #adjust start value, if req'd
pInterval = 1 #adjust interval value, if req'd
if (rec == 0):
rec = pStart
else:
rec = rec + pInterval
return "FIT-{0}".format(rec)
... View more
05-20-2014
01:45 PM
|
0
|
0
|
5473
|
POST
|
For the time being, you'll probably just want to use print statements to let your users know you're doing work in a non-blocking manner and tell people to look at the Python window for some indication of progress. James' message box solution works well, too, but the script will block on the dialog until the user has pressed OK. In 10.3 we've thought about this and we're adding a progress dialog into the pythonaddins module. Its usage will look something like this:
with pythonaddins.ProgressDialog as dialog:
dialog.title = "Doing work..."
dialog.label = "Opening cursor..."
# Do some work here
dialog.label = "Working..."
# More work here
dialog.label = "Cleaning up..." as long as your code is inside that with block the dialog will display on-screen, giving you a way to indicate that you're working and automatically clean up/hide the dialog window when you're done.
... View more
05-15-2014
10:30 AM
|
0
|
0
|
724
|
POST
|
You need to convert the strings you get in GetParameterAsText into Raster objects. # -*- coding: utf-8 -*-
import arcpy
from arcpy.sa import *
arcpy.CheckOutExtension("spatial")
QC = arcpy.Raster(arcpy.GetParameterAsText(0))
NDVI = arcpy.Raster(arcpy.GetParameterAsText(1))
GoodNDVI = arcpy.GetParameterAsText(2)
GoodNDVI_raster = (QC==0)*(NDVI>2000)*NDVI
GoodNDVI_raster.save(GoodNDVI + ".tif")
... View more
05-13-2014
05:52 AM
|
0
|
0
|
644
|
POST
|
I think you want to use filter.list in your validator.
... View more
05-12-2014
02:10 PM
|
0
|
0
|
287
|
Title | Kudos | Posted |
---|---|---|
1 | 09-26-2012 02:46 AM | |
2 | 01-06-2011 08:22 AM | |
1 | 03-25-2014 12:18 PM | |
1 | 08-12-2014 09:36 AM | |
1 | 03-31-2010 08:56 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:22 AM
|