|
POST
|
myField = "Date_Gener" >>> rows = arcpy.UpdateCursor("Parcels") >>> for row in rows: ... row.setValue(myField,'Date ( )') ... rows.updateRow(row) ... Why not get the date as a string and use the Calculate Field tool? This is easier and much faster than a cursor, even the newfangled arcpy.da flavor.
import datetime
Today = str(datetime.date.today())
arcpy.CalculateField_management("Parcels","date_Gener","'" + Today + "'","PYTHON") This will only calculate the value for selected rows of the layer "Parcels".
... View more
08-23-2012
07:40 PM
|
0
|
0
|
1767
|
|
POST
|
I'm not too sure what the question is... but... You can set the coordinate system and transformation used in the model properties geoprocessing environment. Or, you can create model elements, assign to the model environment in the model properties, and make them model parameters so users can modify them if they need to.
... View more
08-22-2012
12:33 PM
|
0
|
0
|
644
|
|
POST
|
There is generally no forward compatibility for ArcGIS documents (mxd,lyr,tbx, for example). If you want to access toolboxes created or edited in 10.1 using 10.0, you need to save them to previous version. Arc 10.1 help: Saving toolboxes to earlier versions
... View more
08-22-2012
11:25 AM
|
0
|
0
|
567
|
|
POST
|
Sure looks like a bug to me, but in the meantime, you could always use python to do a text replace on the asciigrid file to replace "-1" with "0" before you read it into R (or do the replace in R). (This should be easy to do as standard deviation will always be non-negative values.)
... View more
08-22-2012
10:25 AM
|
0
|
0
|
1105
|
|
POST
|
. I also miss having functionality right in the Spatial Analyst toolbar when working within ArcMap. Now I have to go into the toolbox just to use the raster calculator. I certainly do not miss having four different map algebra environments, each with its own architecture and quirks: Arc 9x Map Algebra Parser: Historical source Raster Calculator: ArcGIS 8x / ArcView 3x "raster engine" (note, does not honor GP environment!) Single-Output Map Algebra: ArcGIS 9x Multi-Output Map Algebra: ArcInfo Workstation "grid engine" (only reads grids) Tool interface: ArcToolbox In 10.x only one Python Map Algebra syntax and toolset is used, regardless of interface (python, modelbuilder, tool, Raster Calculator Tool), and honors the same geoprocessing environment as all other non-Spatial Analyst ArcGIS tools. Not to mention it directly reads and writes non-grid raster formats! I recommend trying the python command window with its intellisense if you do a lot of interactive raster processing. Change is a hassle, I agree, but I believe you'll eventually really like it. I suppose I will have to use the Mosaic mentioned above instead The Mosaic tool is tricky because you need to create an empty raster and mosaic into it. I highly recommend setting the bit depth explicitly to avoid issue with NoData. (I usually set it to 32-bit signed if the input is a grid, just to make sure the NoData stays that way.) Mosaic To New Raster is okay, but I've found the Mosaic tool slight more robust because of the bit depth issue. As mentioned above, another possible replacement in your workflow (if you don't need Mosaic's nifty edge-merging in overlap areas) is the Cell Statistics tool, which does a cell by cell statistical merge and has the (neat) option to ignore NoData cells.
... View more
08-22-2012
08:52 AM
|
0
|
0
|
1130
|
|
POST
|
gp.JoinField_management (inlayer, joinField, tempfcnome, joinField, fieldList) # tempfcnome
-- snip --
gp.RemoveJoin_management (inlayer, tempfcnome) # will not work!
[post=226407]Caleb[/post] is correct. Add Join creates a temporary join that can be removed with Remove Join. Join Field does a permanent join, i.e. it copies over fields permanently from one table to another based an a join field match. You can't Remove Join to undo an Join Field operation -- it's permanent. A nice feature of Join Field is you can specify a subset of fields to copy over, say, just the one you're interested in.
... View more
08-22-2012
08:30 AM
|
1
|
1
|
5916
|
|
POST
|
Parsing error <type 'exceptions.IndentationError'>: unindent does not match any outer indentation level (line 10). Your indentation syntax online 10. The "else" statement must be at the same indent level as "if". (see" rel="nofollow" target="_blank">http://docs.python.org/tutorial/controlflow.html](see the Python help) (This was my error - I moved your else in the wrong direction when I was fixing your code.) I highly recommend going through the Python" rel="nofollow" target="_blank">http://docs.python.org/tutorial/index.html]Python tutorial, it gets you up to speed on things like this fast. I also tried your "def function(): ......." No "Hello world" is printed out in the Python Window of my ArcGIS 10 Desktop program!!?? Any comments on this thing I tried? You need to use arcpy.AddMessage to send messages from script tools. Print only works in your IDE, command line, or an interactive python prompt (">>>") (btw a great place to test code). Arc 10.1 help: Writing" rel="nofollow" target="_blank">http://resources.arcgis.com/en/help/main/10.1/index.html#//00150000000p000000]Writing messages in script tools
... View more
08-22-2012
08:23 AM
|
0
|
0
|
4375
|
|
POST
|
Knowing that it couldn't be some ArcGIS-specific folder that would've been wiped by the uninstall/reinstall, I tried looking for system-wide temp folders that ArcGIS touches. After clearing out Users/myusername/AppData/Local/Temp, my viewshed completion time is now back to normal. This makes sense. The Windows %TEMP% folder is folder used by GP tools when the current or scratch workspace is not specified or is specified to a path that is invalid. (I suppose it is also possible that some tools always use TEMP, but I have not ever noticed that.) Cleaning up your TEMP from time to time is a good idea for stability of all Windows software, not just ArcGIS. Also I tried the in_memory workspace but viewshed doesn�??t seem to honor the fields in the observer features (OFFSETA, OFFSETB, etc.) unless they�??re in a saved file. This sounds like a bug you should report to support.
... View more
08-21-2012
12:58 PM
|
0
|
0
|
2013
|
|
POST
|
Scott, here's what you sent: [ATTACH=CONFIG]17142[/ATTACH] The error is the entire function's contents need to be indented. The docstring is not a comment, it's actual code, so it must be indented too.
def function():
"""This is my function"""
print "Hello world"
return
... View more
08-21-2012
11:43 AM
|
0
|
0
|
4375
|
|
POST
|
Does anyone have any idea why Viewshed (and Observer Points) would now take such a long time to run, considering that I�??ve run them just fine tens of thousands of times before using the default geodatabase as the scratch workspace, but once I switch to a file directory it becomes slow as molasses over time, staying slow when I change it back? Help! If you are generating a large number of files in your scratch workspace, any tool that has to create a scratch name (or your own call to the ScratchName method) has to look through the whole workspace to find a new unique dataset name to assign scratch files. This can really kill you when you have thousands of files to look through. Some tools are better at cleaning up after themselves than others. My advice: Set up your scripts and workflows to create work with an empty scratch workspace, and then clean up when you are done. Make sure your own scripts clean up after themselves! Delete your own temporary features etc. when you are done with them so they aren't clogging up your workspace. In scripts and models, consider using the in_memory workspace for your own temporary tables and features, if they are small (viewset inputs are a great example). (Be double sure you delete them when you're done!) I�??m using ArcGIS 10.0 with no service pack (which is what our customer uses, and I�??m afraid to upgrade out of fear of losing compatibility of some kind) on Windows 7 32-bit. Background processing is off, and logging geoprocessing operations to a log file is now off. Almost all compatibility issues have to do with "dot" versions (ie 10.0 vs 10.1), and those have to do with the old version reading new version files, not the other way around. Service packs by design should not cause compatibility issues. I highly recommend staying up to date (though to be fair, we wait about a month to see if users report show-stopper issues in the forums before pushing out to our default installs -- although these tend to be rare).
... View more
08-20-2012
10:16 AM
|
0
|
0
|
2013
|
|
POST
|
I don't see the Add Join or Remove Join tools in your code, did you leave that out? Maybe this is your issue: Join Field it does not create a join (so you can't remove one after it runs). The tool that does a tempary join (which is what you are describing in your question) is Add Join. Join Field permanently copies data -- join/add field,calculate across/remove join in one step.
... View more
08-20-2012
08:44 AM
|
1
|
0
|
5916
|
|
POST
|
the zone is determined by two parameters - the DLS range and the Meridian value which i found to be missing in your equation. Please can you take a look once more at the equation. I'm sorry, you are clearly not talking about UTM zones, which are 60 Transfers Mercator zones (really 120 if you can north and south) defined merely by zone numbers that are basically a lookup to one of 60 a central meridians. Sounds to me like the DLS zones is what you are working with [post=224323]as Christopher Thompson suggested above [/post]
... View more
08-20-2012
08:14 AM
|
0
|
0
|
2986
|
|
POST
|
how do I do the same thing for Current Workspace outputs that I want to keep, %currentworkspace% does not work? The variable names are the same as those used in python (arcpy.env) In this case the current workspace is %workspace%. Though, in practice the usual way to do this is to let the user specify where the outputs go by exposing the output model elements as output parameters. When the user runs the model, the outputs paths will fill in at the current workspace, just like with other tools.
... View more
08-17-2012
03:56 PM
|
0
|
0
|
939
|
|
POST
|
This one just creates the geodatabase name d{0}.gdb (it does not substitute the 0 with the names specified in the format(), i dont understand why) This line in your code is wrong: arcpy.CreateFileGDB_management("C:/data", "d{0}.gdb" Should be arcpy.CreateFileGDB_management("C:/data", "d{0}.gdb".format(year) and also should be inside the loop. Python 2.7 docs: string methods
... View more
08-17-2012
12:27 PM
|
0
|
0
|
1873
|
|
POST
|
The 10.1 help '>Adding an ASCII or text file table says: There is one instance in which a schema.ini file will be created by ArcGIS when opening a delimited text file: when the format for a certain field cannot be reliably determined. In this case, a schema.ini file will be created containing the presumed format of the field. Could you post the first few lines of your text file? It looks like your particular file may be hard to interpret. You may have to re-write your schema.ini code to make it ingest properly. (This doesn't explain why it worked okay in 10.0 though.)
... View more
08-17-2012
12:17 PM
|
0
|
0
|
2568
|
| 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
|