|
POST
|
There's an old ArcInfo Workstation command that did this (PULLITEMS) with INFO tables. I miss it. A list comprehension is definitely the right approach here. This has a bit more checking, because: - You can't delete the OID field - Shape_Length and Shape_Area cause DeleteField to throw an exception.
keepList = ["FIELD1","FIELD2"]
fieldNames = [f.name for f in arcpy.Describe(inTable).Fields if not \
(f.type in ["OID","Geometry"] or \
f.name in ["Shape_Length","Shape_Area"] or \
f.name.upper() in keepList )]
if fieldNames:
arcpy.DeleteField_management(inTable,fieldNames)
... View more
11-30-2012
03:03 PM
|
0
|
0
|
3420
|
|
POST
|
Bumping this up as it's still an issue for me. Anyone else experience this, or find a solution? Rosie, I can reproduce this. A fix that works for me is to reload arcpy: >>> reload(arcpy)
... View more
11-30-2012
08:05 AM
|
0
|
0
|
2338
|
|
POST
|
An approach that may work for you is to try the ProjectAs method of the geometry object to create a new geometry in the new coordinate system. Geometry (arcpy) http://resources.arcgis.com/en/help/main/10.1/index.html#//018z00000070000000
... View more
11-28-2012
10:27 AM
|
0
|
0
|
1351
|
|
POST
|
I found that when I opened it up and ran it as a tool, this problem went away. This because when the script is run as a tool the buffer got flushed in the script cleanup when the script completes. In IDLE, you're running things from an interactive Python root process that does not go away when you run the code in a window. (This is so you can do debugging.)
... View more
11-28-2012
07:20 AM
|
0
|
0
|
1259
|
|
POST
|
One oddity - the first time I run it, I don't get results. I click run a second time (using IDLE) and it works. Any idea why? Looks like the file buffer didn't get written to disk. Did you close the file? outputTxtFile.close() If that didn't work you may want to try this: outputTxtFile.flush()
outputTxtFile.close() You don't need an external script, you could do this with the Calculate Value tool. Set up the input features as a precondition. Expression: writeFile(r"%Input Features%","FTEXT",r"c:\outfolder\outFile.txt") Code Block:
import arcpy
def writeFile(inTable,Field,outFile):
f = open(outFile, 'w')
rows = arcpy.SearchCursor(inTable)
for row in rows:
f.write(str(row.getValue(Field)) + "\n")
f.close()
Output type: File
... View more
11-27-2012
11:50 AM
|
0
|
0
|
1259
|
|
POST
|
Is this your issue? KB 38099 - Bug: Internet Explorer Script Errors are generated when running any Geoprocessing tool from ArcToolbox on some systems that implement Folder Redirection
... View more
11-26-2012
09:42 PM
|
0
|
0
|
1513
|
|
POST
|
Very nice, Marcin! Here's how I would go at it, at the risk of being accused of "gilding the lily"... (As usual, I'm pushing Python's excellent string formatting capabilities!) Expression: FindLabel([Field1],[Field2]) Code block: def FindLabel (f1,f2):
if f1 >= 1:
lbl = "# {0}, <CLR red='255'><FNT size='16'> Field 2: {1:.2f}</FNT></CLR>"
else:
lbl = "# {0}, Field 2: {1:.2f}"
return lbl.format(f1,f2)
... View more
11-26-2012
09:21 PM
|
0
|
0
|
1807
|
|
POST
|
I set the path and name of the symbology layer variable to be: %workspace%\%Name%.lyr , assuming that all the values of Name variable in earlier part of the model can be picked up here one by one. One more thing, use preconditions to make sure the tools run in the order needed to make paths valid at runtime.
... View more
11-26-2012
06:47 AM
|
0
|
0
|
3909
|
|
POST
|
Does anybody know how to extend the bounding envelope of a feature? I have a multipoint feature and have been using euclidean distance on it, then reclassifying this data for use in a weighted sum or weighted overlay but the output is only within the very small bounding envelope of one of the input data sets.... is there a way to expand this envelope so that it will include all of the data on the whole map....??? I'm a little unclear on what you are doing, but have you tried setting the geoprocessing environment to Union Of Inputs or a fixed extent -- instead of Default?
... View more
11-21-2012
08:14 PM
|
0
|
0
|
566
|
|
POST
|
I have a Python Toolbox that converts a file geodatabase table to a format useful in external analysis. However, I would like to be able to export a subset of data by selecting a specific date on a calendar. Seems to me the best approach would be to treat the date as a string and in the validation code read the date values out of the file, unique and sort them, and populate a pick list (filter property) of strings for the user to choose from. This would probably be easier to navigate than the calendar widget anyway.
... View more
11-20-2012
07:47 AM
|
0
|
0
|
2685
|
|
POST
|
Well at least I'm not alone. I guess I'm gonna have to fix it that way. Thx for your reply anyway, jehall In my experience, the most common reason intermediate datasets are not deleted by ModelBuilder are active joins, and issues with iteration. Feel free to post a model that is failing to delete intermediate data and I'm sure someone can help you figure out what's up.
... View more
11-20-2012
07:06 AM
|
0
|
0
|
1093
|
|
POST
|
Buffer, Clip, Intersect, Merge, and Dissolve all cause immediate program crashes. Since all these topological processing tools are all failing, it sure looks like I may be right about the source of the issue being the topology engine temp file problem documented in KB 29559. Can you try running your tools logged in with an admin login? If that works, can you give yourself change access to the Desktop10.1\bin folder? There's more about this in the above KB and related links. A total system failure like this may write system log errors to the Windows Event Viewer that may give you a clue what is going wrong. Anything this serious is worth opening a support incident with Esri if the KB doesn't address it.
... View more
11-20-2012
07:00 AM
|
0
|
0
|
2474
|
|
POST
|
You'll probably not going to like this, but they both buffer fine on my not-a-high-end XP machine running 10.1 SP1. Since Melita has had no problem with your data, you may want to look into this permissions-related issue: KB 29559: Problem: Certain geoprocessing tools will not execute or work unless the user is an administrator
... View more
11-19-2012
02:04 PM
|
0
|
0
|
2474
|
|
POST
|
Unfortunately before moving away from the input box ArcGIS is placing a workspace in front of the inputted name. I am just going to go with a warning for users and move on. Your code helped me figure out how to do this, so thanks!
if self.params[0].value and self.params[6].altered:
outFC = str(self.params[6].value)
self.params[6].clearMessage
import os
if os.path.dirname(outFC)!= str(self.params[0].value):
self.params[6].setWarningMessage("Output location not within project folder!") You're right, the internal validation for output filenames gets there before we can alter it (when the output parameter is initialized). For best results, be sure and update parameter values in the updateParameters function -- and set validation messages (like setWarningMessage above) in the updateMessages function. Here's the way I'd do it:
def updateMessages(self):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
if self.params[0].value and self.params[6].value:
import os
inWS = os.path.dirname(str(self.params[0].value))
outWS = os.path.dirname(str(self.params[6].value))
if inWS != outWS:
self.params[6].setWarningMessage(
"Output will be written to a different workspace than input!")
return
... View more
11-19-2012
12:57 PM
|
0
|
0
|
1958
|
|
POST
|
There is a bug in the system for 10.1 Buffer Tool NIM083208 - The Buffer tool with Dissolve Type set to ALL fails or is very slow with certain feature classes at Version 10.1 but works correctly with the same data at Version 10.0. Medium severity. ("Ya Think So?") 🙂
... View more
11-19-2012
12:02 PM
|
0
|
0
|
2474
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-11-2021 01:26 PM | |
| 5 | 12-10-2021 04:58 PM | |
| 1 | 02-27-2017 09:30 AM | |
| 2 | 12-04-2023 01:05 PM | |
| 1 | 04-12-2016 10:17 AM |
| Online Status |
Offline
|
| Date Last Visited |
06-19-2024
12:10 AM
|