|
POST
|
You shouldn't need to manually close your file if you open it with the "with" statement. Try removing the f.close() and see what happens. Are you sure whatever reference you are using to this function isn't the problem?
... View more
07-24-2012
12:50 PM
|
0
|
0
|
1188
|
|
POST
|
Have you tried using a function? Do you get this issue even after you end the process of whatever program is executing your script?
... View more
07-23-2012
07:38 AM
|
0
|
0
|
1024
|
|
POST
|
Off the top of my head I can think of two ways. Option 1: Cursor up_curs = arcpy.UpdateCursor(fc,"FIELD IS NULL")
for row in up_curs:
if not row.getValue(FIELD):
row.deleteRow(row) Option 2: Select/Delete Features
arcpy.MakeFeatureLayer_management(fc,layer)
arcpy.SelectLayerByAttribute_management(layer,"FIELD IS NULL")
desc = arcpy.Describe(layer)
feat_count = int(arcpy.GetCount_management(parcel).getOutput(0))
feat_ids = desc.FIDSet
if feat_count > 0 and len(feat_ids) > 0:
arcpy.DeleteFeatures_management(layer) Note: I haven't tested either of these so make sure you do some trials in a test environment.
... View more
07-19-2012
12:34 PM
|
0
|
0
|
6202
|
|
POST
|
The "CitySDE.GIS.Parcel" I assume is the name of the feature class not the layer "Parcels" in your mxd correct? What you want to do is your second case where you have "Parcels" as the referenced layer the user is making the selection on. The error you are receiving in your second case is that target = "Cases" references a feature class in env.workspace = r"\\ServerA\Planning\Cases_Geodatabase.gdb" not the layer in your mxd. So you can either references the layer in the mxd that is pointing to the "Cases" feature class, or you can create a feature layer using Make Feature Layer.
... View more
07-19-2012
11:57 AM
|
0
|
0
|
768
|
|
POST
|
When you are making selections you need to make your feature classes layers.
... View more
07-18-2012
02:58 PM
|
0
|
0
|
768
|
|
POST
|
Since you're accessing personal geodatabases, you will want to keep your eye on the size of the MDB files, and run a Compact and Repair in Access if they start growing too large. Whenever I am dealing with PGDB I throw a Compact in at the end of the script to clean it up again. I remember it solved some issues for me at one time and I do it just out of habit now. Also, I'd recommend putting everything in a function to help deal with persisting variables.
... View more
07-18-2012
07:00 AM
|
0
|
0
|
2048
|
|
POST
|
The help document reference VB and from what I can tell, the syntax for text formatting in python is a bit different. This seems like something that should be really easy...but for the life of me I am just not getting it 😞 I am a little confused, it is the formatting style for map document elements. What text are you trying to format?
... View more
07-17-2012
09:55 AM
|
0
|
0
|
4311
|
|
POST
|
What version of python are you using? Also if you are using a domain log in you will need to send it raw, otherwise it may be interpreted as an escape. r"xxxxxx\xxxxx" I assume you are trying to run this on a schedule when you are not logged in? Is that why you need to specify specific log on credentials? More detail of what you are trying to accomplish and your environment would help. You would probably get a better response from a more general python forum like stack exchange since this really doesn't have anything to do with ArcGIS.
... View more
07-17-2012
06:53 AM
|
0
|
0
|
4625
|
|
POST
|
Are they multipart features? You may need to strip out each part first to access the X,Y geometry. If you are translating anyways, I would suggest using cursors instead of field calculator. Also, VBA is supported in 10.0 still, you just need to authorize the VBA license. It's a good idea to start switching though, since 10.1 will be the last version you can even use VBA from what I understand; after which it will be fully deprecated.
... View more
07-16-2012
02:51 PM
|
0
|
0
|
747
|
|
POST
|
Thanks! ...and sorry to be totally useless 😕 ...but I also can't figure out the text formatting. I only need the LegText to be adjusted...but I can't get the formatting correct either. Also not sure if making the spacing negative is appropriate (as I want the spacing to go smaller) Below is what I tried, and I am not finding much help on the resource center about formatting text in python... #iteate through each row, update appropriate table/text
for row in NHRows:
if len(LegText.text) > 32:
LegText.text = '<CHR spacing="-25">'LegText'</CHR>'
LegNum.text = LegNum.text + row.getValue("SUBAREA_CODE") + "\n"
LegText.text = LegText.text + row.getValue("LAND_USE_DESIGNATION") + "\n"
else:
LegNum.text = LegNum.text + row.getValue("SUBAREA_CODE") + "\n"
LegText.text = LegText.text + row.getValue("LAND_USE_DESIGNATION") + "\n" I believe what you are looking for can be found here under your local help files. "C:\Program Files (x86)\ArcGIS\Desktop10.0\help\esri_csHTML_ArcMap.chm" Also, here is the code I used to get a large comment field to print over multiple lines. import string
import arcpy
mxd = arcpy.mapping.MapDocument("current")
elm = arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENT","element_name")[0]
line = ""
entry = str()
for word in string.split(comments):
if len(line) == 0:
line = word
else:
line = line+" "+word
if len(line)>50:
print line
entry = entry+"\r\n"+line
line=""
print line
entry = entry+"\r\n"+line
elm.text = entry
... View more
07-16-2012
02:18 PM
|
0
|
0
|
4311
|
|
POST
|
Enter customize mode through Customize menu drop down > Customize Mode. Right click on icon you want to change, change button image or browse for image.
... View more
07-16-2012
12:19 PM
|
0
|
0
|
3238
|
|
POST
|
I'm not sure what your issue would be here. This method works for me. I came across this old forum thread with a similar issue, could it be related? http://forums.esri.com/Thread.asp?c=93&f=995&t=283135
... View more
07-12-2012
08:11 AM
|
0
|
0
|
1397
|
|
POST
|
Are you getting the same error? Try this as your loop. for filename in RasterFiles:
print "Processing: {0}".format(filename)
inRaster = os.path.join(input_dir,filename)
outRaster = os.path.join(OutputFolder,"Avg_" + filename)
# Process: Zonal Statistics
saveRaster = arcpy.sa.ZonalStatistics(ZoneShapefile, "FID", inRaster, "MEAN", "DATA")
saveRaster.save(outRaster)
... View more
07-12-2012
05:51 AM
|
0
|
0
|
3775
|
|
POST
|
Dear Matt, This what I got when I used arcpy.sa.ZonalStatistics(ZoneShapefile, "FID", inRaster, outRaster, "MEAN", "DATA") Traceback (most recent call last): File "S:/Work/Risa/Python codes/zonalStats_test.py", line 38, in <module> arcpy.sa.ZonalStatistics(ZoneShapefile, "FID", inRaster, outRaster, "MEAN", "DATA") TypeError: ZonalStatistics() takes at most 5 arguments (6 given) Now, i can see what you mean by those temporary raster files. That is now a minor problem. The major problem is (I think), the program can't read the raster files. Risa Oh right you are using the wrong syntax. ZonalStats returns a raster that you have to then save. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z000000w7000000.htm
... View more
07-11-2012
08:31 AM
|
0
|
0
|
3775
|
| 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
|