|
POST
|
. I am having a problem executing this file. It keeps saying there is a error. The maximum record length has been exceeded. The file only has 87000 records. The error has to do with the record length, not the number of records. Dbase tables have some pretty serious limitations compared to GDB tables -- I suspect that is your issue. Field names cannot be longer than 10 characters. The maximum record length for an attribute is 4,000 bytes. The record length is the number of bytes used to define all the fields, not the number of bytes used to store the actual values. The maximum number of fields is 255. A conversion to shapefile will convert the first 255 fields if this limit is exceeded. The dBASE file must contain at least one field. When you create a new shapefile or dBASE table, an integer ID field is created as a default. dBASE files do not support type blob, guid, global ID, coordinate ID, or raster field types. dBASE files have little SQL support aside from a WHERE clause. Attribute indexes are deleted when you save edits, and you must re-create them from scratch. Arc 10 Help: Geoprocessing considerations for shapefile output
... View more
01-30-2012
09:25 AM
|
0
|
0
|
2454
|
|
POST
|
1) it is possible to export directly from ArcGis to Excel using Model Builder (select a tool and automatically open Excel with the .dbf selected) Normally .dbf are associated with .dbf files by the MS Office installation, so you should be able to do this with the Calculate Value tool, using Python and the Windows "start" command to launch the file as if you had double-clicked it in Windows Explorer. Be sure you have the the .dbf (element "output_dbf") be a precondition so it will launch after the .dbf is created The syntax below r, double quotes, model element name in percents, double quotes) is critical so python gets the path unmodified by parsing. Calculate Value tool arguments: Expression: launch(r"%output_dbf%") Code block:
def launch(path):
import os
dir = os.path.dirname(path)
file = os.path.basename(path)
os.system("start /d \"%s\" %s" % (dir,file))
If the file is open in ArcGIS and Excel at the same time, you will likely run into file locking issues and will have to close either one or the other to write to the file. You have been warned!
... View more
01-30-2012
08:27 AM
|
0
|
0
|
1056
|
|
POST
|
Dan Patterson has posted some Python code in arcscripts (not arcpy, but the translation is not difficult) here: http://arcscripts.esri.com/details.asp?dbid=14173 If you want to take the approach of creating a python list, there are some great methods in python: http://adorio-research.org/wordpress/?p=125 Another tack would be to build a little script or model that uses Get Count, Sort and Calculate Field to just do an integer division to determine the class number. This would be simple and fast but wouldn't be very sophisticated for distributions that don't break into quantiles so easily.
... View more
01-30-2012
08:05 AM
|
0
|
0
|
3129
|
|
POST
|
Python format strings can make query (and calculation) expressions even a little easier to read, write, and debug. For example, a way to create your query expression using format strings could be: whereExpr = "\"%s\" = \'%s\'" % ("date_idx50",tanggal) Within the SQL expressions, field names may* be enclosed in double quotes and string literals must be in single quotes. In the above expression, the back slashes are to include quotes literally in the resulting string. The "%s" format string has a nice property of converting the corresponding values in the tuple after the "%" operator to a string format, avoiding clouding your code up with a str() function. *Double quotes around field names may avoid problems with field names that could be SQL keywords, for example, COUNT.
... View more
01-27-2012
10:03 PM
|
0
|
0
|
804
|
|
POST
|
Is there a way to write out percent milestones through python (as far as percent completed) or am I hoping for too much? If the messages are only going into the progressor bar - that's not doable. But if your model building is looping all messages you see in the dialog will show up in the log. You can of course view the log as long as you don't edit it. (I have the GNU unix utilities so I can for example, look at the last few lines with the tail command.
... View more
01-27-2012
08:57 AM
|
0
|
0
|
2585
|
|
POST
|
I am hoping that this is possible. I am running cache processes (currently through Model Builder) that sometimes last past the time I leave for the day. At the same time, overnight (late) I have routines that run updates and close out my connections to GIS (if it is still open). Occasionally my cache processes will have errors, i.e. the "Failed to Manage tiles.." errors. These show up on the GP window but for some reason do not write out to the GP log file. If you run the model as a model tool (ie. double click the model and click OK) and you have gp logging clicked on in the application options, everything should write to the the gp log file. An approach that may be more appropriate for a job you often repeat is to run your model using a simple python script, such as: # e:\work\runmodel.py
import arcpy
arcpy.CheckOutExtension("Spatial") # extension, if needed
arcpy.ImportToolbox(r"e:\work\mytoolbox.tbx")
arcpy.MyModel_mytools() # "mytools" is your toolbox's alias
arcpy.AddMessage("Processing completed.") Start your python script before you go home like this: 1. Open a command window: Windows -> Run... -> cmd.exe 2. In the command window, run your python script: cd /d e:\work
runmodel.py > runmodel.log 2<&1 The ">" sends script output to the log file, and the fancy foot work "2<&1" redirects any system errors to go into the log file instead of to the command window. (Good old DOS!) You could also put the above DOS commands in a .bat file.
... View more
01-26-2012
09:56 PM
|
0
|
0
|
2585
|
|
POST
|
But I didn't think it was possible to use python with Arc 9.3.1....is it? Sure can, see the Arc 9.3 doc for Calculate Field The VBScript syntax you're looking for is this. Note the Mid() function and the double-quote.
Mid([Row_Col],1,InStr([Row_Col],"-")-1) Here's my bookmarked VBScript reference: http://www.w3schools.com/vbscript/vbscript_ref_functions.asp
... View more
01-25-2012
09:57 AM
|
0
|
0
|
2392
|
|
POST
|
You can then use a search cursor on that table to get a complete list of values and easily select the next lowest value by sorting your list. Just a thought -- you don't need to use the Sort tool; just specify the sorting when you request the search cursor.
... View more
01-25-2012
09:09 AM
|
0
|
0
|
843
|
|
POST
|
however the documentation says that you can use a raster for the cell size. Not sure where I am going wrong here. By "raster" I believe they mean an ArcGIS-recognized raster dataset or raster band, not a numpy array.
... View more
01-24-2012
08:50 PM
|
0
|
0
|
1775
|
|
POST
|
I have seen this AttributeError when there are two toolboxes active with the same alias. In this situation, ArcGIS has trouble accessing the correct tool because of the alias conflict.
... View more
01-24-2012
08:45 PM
|
0
|
0
|
1753
|
|
POST
|
Bill, thank you very much for this! I worked out a more detailed implementation of your idea here: $$NCOLS + $$ROWMAP in ArcGIS 10 Python map algebra
... View more
01-24-2012
02:16 PM
|
0
|
0
|
3286
|
|
POST
|
Sorry, you're right, this tool (and the python script it calls, D:\ArcGIS\Desktop10.0\ArcToolbox\Scripts\ExportXYV.py), only supports feature class input. You could manipulate your output csv file using python code in a Calculate Value tool with a function embedded inside, it, for example: expression: fixfile(r"%Output file%") ("Output File" is a model element; note the "r" and the quotes, they are important. Make "Output file" a precondition so it will exist when the Calculate Value is run.) Code block: def fixfile(infile):
# read file into a list,
f = open(infile,"r")
lines = readlines(f)
f.close()
# for each line, delete first column, write back
f = open(infile,"w")
for line in lines:
linelist = line.split(",")
lineout = ",".join(linelist[1:])
f.write(lineout)
f.close() I'm assuming there are no embedded commas in your data. That would break the script.
... View more
01-23-2012
09:53 AM
|
0
|
0
|
904
|
|
POST
|
OK, well... I spoke too soon. I looked at the help that you linked and I still don't really get it. I still don't see how to tell it to display the step progressor each time it updates (steps). The help I linked is about printing messages -- which is what you have to do in scripts not run as a toolbox's script tool. The help for SetProgressor has a code sample at the bottom on how to update progressor messages and the progressor "bar graphic". I've found that sometimes progressor messages from tools you are running (especially spatial analyst tools) trump your progressor settings. In those cases the progressor doesn't always do exactly what you want.
... View more
01-23-2012
09:44 AM
|
0
|
2
|
2952
|
|
POST
|
There is a better tool for this in the Spatial Statistics Tools. It doesn't include any fields you do not want. Export Feature Attribute to ASCII
... View more
01-23-2012
09:35 AM
|
0
|
0
|
904
|
|
POST
|
In a stand-alone script, your script isn't being called from an ArcGIS application, so there is no progress dialog box, result, or Python window where your messages can be viewed. Arc 10 Help: Writing messages in script tools
... View more
01-23-2012
08:17 AM
|
0
|
0
|
2952
|
| 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
|