|
POST
|
As the name implies the arcpy.GetParameterAsText() method always brings values from the toolbox GUI into the script as string values. Three Python functions I use all the time: convert to interger: int(myVariable) convert to float: float(myVariable) convert to string: str(myVariable) Variables must be of the same type to do math operations or string concatenation. For example: buffDist = arcpy.GetParameterAsText(0)
newBuffDist = float(buffDist) / 3.14159
arcpy.Buffer_analysis(myFC, myBuffFC, str(newBuffDist) + " METERS")
... View more
07-31-2012
08:18 AM
|
0
|
0
|
3481
|
|
POST
|
Try using this tool: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/RefreshCatalog/000v0000004z000000/ to give ArcGIS a kick in the ... before you make the table list.
... View more
07-31-2012
06:57 AM
|
0
|
0
|
1717
|
|
POST
|
Sometime after "import arcpy" and sometime before running a tool that overwrites an existing dataset.
... View more
07-30-2012
03:46 PM
|
0
|
0
|
869
|
|
POST
|
In the script, be sure to add this line of code: arcpy.env.overwriteOutput = True Also of course, make sure that you aren't looking at the table to be updated while you are running your script.
... View more
07-30-2012
03:02 PM
|
0
|
0
|
869
|
|
POST
|
PythonWin gets my vote too... It's simple, clean, does what I need, and is free. I've been using it since ArcGIS v9.0 (6-7 years?). Secret Hint: The PythonWin install package is actually included on the ArcGIS install CD/DVD... but it is not auto installed like Python is... you have to manually install it yourself.
... View more
07-30-2012
01:30 PM
|
0
|
0
|
1508
|
|
POST
|
It'd look something like this: myFC = arcpy.GetParameterAsText(0)
var1 = arcpy.GetParameterAsText(1)
var2 = arcpy.GetParameterAsText(2)
arcpy.AddField_management(myFC, "FIELD1", "SHORT")
arcpy.AddField_management(myFC, "FIELD2", "SHORT")
arcpy.CalculateField_managment(myFC, "FIELD1", int(var1), "PYTHON")
arcpy.CalculateField_managment(myFC, "FIELD2", int(var2), "PYTHON")
... View more
07-30-2012
01:00 PM
|
0
|
0
|
3481
|
|
POST
|
Singlepart to Multipart? Use the Dissolve tool and specify 'MULTIPART' Multipart to Singlepart? Use the MultipartToSinglepart tool
... View more
06-20-2012
08:58 PM
|
0
|
0
|
533
|
|
POST
|
That looks very interesting Kim, although I don't have much hardcore SQL skill... I think for my purposes I will stick with my Python 64-bit subprocess solution... I am using these large dictionaries to traverse/trace segments of a stream network, and speed is very critical as there are so many features involved - eventually there will be 100's of millions of features. I am comfortable writting my own code in Python to emulate fancy SQL-type stuff using dictionaries and basisically see dictionaries as a great and flexible format for creating my own RDBMS with whatever "custom" features I can dream up. I am amazed at the speed of these hash table-type structures - and I seem that the code you suplied uses some sort of formal SQL hash functionality (sadly, of which I am totally ignorant of!) - very cool.
... View more
05-31-2012
09:19 AM
|
0
|
0
|
4314
|
|
POST
|
Related to this post: http://forums.arcgis.com/threads/58348-Large-Dictionary-Compression, I am having troubles when the dictionaries get too big! Although it's slower, especially for multiple fields, I am finding the ole' "Join and Calc" method is much more memory efficient.
... View more
05-29-2012
09:19 AM
|
0
|
0
|
4115
|
|
POST
|
Can compression occur as a side-effect of another process? Not that I know of.
... View more
05-29-2012
08:36 AM
|
0
|
0
|
1111
|
|
POST
|
Yes, but that does not answer the question for the problem with Zonal Stats. Actually, for the original question posted, I did offer a plausable explaination for the error message (ERROR 999999: A column was specified that does not exist). For your error message, which is different than the error message in the original post, I speculate that you might have compressed your FGDB. Running the Compress FGDB tool (instead of a Compact) makes the FGDB read only. Try running the Uncompress FGDB tool on your .gdb, and see if you are then able to run the Zonal Stats tool.
... View more
05-29-2012
08:09 AM
|
0
|
0
|
4265
|
|
POST
|
Jason, after looking at stuff... Hmmm - seems a bit over my head I think. But my work around solution (not working quite 100% yet) is to just: 1. export the FGDB tables to .txt format (thankfully the txt versions are < 2GB!). 2. call 64-bit Python.exe as a subprocess (which actually seems to work) 3. have that 64-bit python.exe process read the "tables" (txt files) into dictionaries, do the analysis, write the results out to .txt format 4. back in 32-bit "arcpy-compliant" Python land, read the analysis txt table back into FGDB table format, and then *** big inhale *** proceed with the rest of the script. Here's to 64-bit :cool: and the hope that we may be have a 64-bit version of ArcGIS some day!
... View more
05-24-2012
11:09 AM
|
0
|
0
|
4314
|
|
POST
|
I have a simple dictionary like this: exampleDict[123444556] = (1785,2234544,3545456, 165765.47654) where all the keys are intgers and the values are either integers or floats. My issue is that I have the need to store/access about 20 million keys at a time, and I am running out of 32-bit memory. I'd rather do this in 32-bit Python as I need (or would like) access to arcpy for its FGDB table reading/writting abilities. Anyone know of a way to somehow "compress" keys and/or values in a dictionary? I'm looking into the binascii module, and I see lots of methods to compress strings, but not ints or floats. Maybe you can't meaningfully compress these since they are already quite numeric? Anyone ever do something like this?
... View more
05-23-2012
10:34 AM
|
0
|
8
|
5879
|
|
POST
|
This should work: rows_LDC = arcpy.SearchCursor(mapTable.dataSource, "INDEX_ = 'CPA' and TR = '" + str(TR_Select) + "'", "", "", "DATE_FIELD A")
... View more
05-22-2012
09:24 PM
|
0
|
0
|
767
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-25-2014 12:57 PM | |
| 1 | 08-29-2024 08:23 AM | |
| 1 | 08-29-2024 08:21 AM | |
| 1 | 02-13-2012 09:06 AM | |
| 2 | 10-05-2010 07:50 PM |
| Online Status |
Offline
|
| Date Last Visited |
08-30-2024
12:25 AM
|