|
POST
|
Or do the following steps shorten the computation time? - same cell size - same projection - Output float/integer If the flow direction and weight grid are not in the same coordinate system, and the cell size and snap aren't set to match the flowdirection grid, you are unlikely to get the correct results. The kind of output will always be float. You may have some performance gain if the weight raster is integer because this could minimize the amount of I/O required to access the values due to the run-length compression used for integer grids. If both inputs are grids and the output is a grid you probably will see better performance. (Definitely if using 9.x.)
... View more
07-19-2011
03:25 PM
|
0
|
0
|
431
|
|
POST
|
generally, reading writing grid format in SA tools is way faster than FGDB raster format. If you use FGDB format stuff, behind the scenes it is formats to grid, runs the SA tool algorithm, and then, writes the grid output back to FGDB raster fromat. There is a lot of time that is potentially lost in all that reformating... This is true at 9.3 but not at 10.0. Most raster formats are now supported natively by the tools. ESRI Team Raster people have told me that they have committed themselves GRID and FGDB will probably be the fastest (and probably will have less bit-depth weirdness problems, IMHO). I have heard good things from users, some of which who have moved to FGDB for their raster processing at 10. What's" rel="nofollow" target="_blank">http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/What_s_new_in_ArcGIS_Spatial_Analyst/00qp0000001n000000/]What's new in ArcGIS Spatial Analyst 10 - look for the heading: Native Read/Write
... View more
07-01-2011
02:48 PM
|
0
|
0
|
1504
|
|
POST
|
Hello, I am trying to use Field Calculator to collect values from multiple fields in a feature class. I only want records with no value to be filled in with the Field Calculator result. It may be easier to pass the input through the Select Layer By Attribute tool first, selecting for: "STR_ADD" IS NOT NULL AND "STR_ADD" <> '' so the calculation will only be applied to the selected rows.
... View more
07-01-2011
02:30 PM
|
0
|
0
|
785
|
|
POST
|
The ability to create script tools ("embed them in a toolbox") has been around since 9.0. If you're on 9.3, you can start with this help topic : An overview of creating script tools Dale, thanks for the link. What we're talking about here is embedding a script into a toolbox so a separate .py file is not needed. This is a new (and welcome) functionality in 10.0. From the What's" rel="nofollow" target="_blank">http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/What_s_new_for_geoprocessing_in_ArcGIS_10/00qp0000000q000000/]What's New in ArcGIS 10: ...you can import your .py file into the tool (in fact, you must do this to password protect a script tool). This means you don't have to deliver a separate .py file for your script tool to work, the .py will be saved within the toolbox.
... View more
07-01-2011
02:03 PM
|
0
|
0
|
1672
|
|
POST
|
Here's an attempt to do up a nice tool for this, with documentation. This tool works in 9.3 or 10.x, and has validation associated with it. It has an output status variable (0,1,2) you can use for a precondition or a model variable. I know you may hate having to code, but the Python script interface is pretty nice. (Thanks, shitijmehta, for the idea.) Usage: ModelMessage <Message_text> {NONE | WARNING | ERROR} {0 | 1 | 2} Here's how it looks when you run it in a model in the geoprocessing message stream: Executing: MessageModel
Start Time: Fri Jul 01 15:41:02 2011
Executing (Message): ModelMessage "\nHello, world!\n" NONE 0 0
Start Time: Fri Jul 01 15:41:03 2011
Running script ModelMessage...
Hello, world!
Completed script ModelMessage...
Executed (Message) successfully.
End Time: Fri Jul 01 15:41:03 2011 (Elapsed Time: 0.00 seconds)
Executed (MessageModel) successfully.
End Time: Fri Jul 01 15:41:03 2011 (Elapsed Time: 1.00 seconds)
... View more
07-01-2011
01:51 PM
|
0
|
0
|
1672
|
|
POST
|
In Arc 10 you could create a python script and import it into the toolbox - this is a new functionality that will do what you want. But I do agree that there should be a standard tool for this and voted up your idea! Here's the online" rel="nofollow" target="_blank">http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005700000017000000.htm]online help on embedding scripts in toolboxes.
... View more
07-01-2011
09:56 AM
|
0
|
0
|
1672
|
|
POST
|
I posted this same question here and have no response yet... I'm pretty sure it can't be done. The best I've been able to come up with -- outside of writing a script tool - is this: Expression: "\n\n** YOUR PARAMETER IS WEAK **\n** TRY AGAIN **\n" (no code block) This shows up in the messaging as: Executing (Message): CalculateValue "\n\n** YOUR PARAMETER IS WEAK **\n** TRY AGAIN\n" # Variant
Start Time: Thu Jun 30 10:51:10 2011
Value =
** YOUR PARAMETER IS WEAK **
** TRY AGAIN **
Succeeded at Thu Jun 30 10:51:10 2011 (Elapsed Time: 0.00 seconds) You could set this up with a precondition to have it print the message under certain conditions (perhaps determined by another Calculate Value tool boolean result). All, I came across this blog about using the Calculate Value tool. The blog is for ArcGIS 10 but I was able to adapt an example to 9.3. I found this blog really useful as I never knew about this particular tool and being able to write if then else logic but still within model builder is extremely useful as it avoids the need for having to build scripts that are ultimately files that sit outside a toolbox. So I created a simple python function that tested for the existence of a field and output a boolean which is a precondition for what ever. It all worked great. Now my question is simple, how do you write a message to the output window when a model is running? If you look at the code below I've tried too methods but it nevers writes anything, is it possible? The code block contained the following code for the Calculate Value tool:
def test(f):
import arcgisscripting
gp = arcgisscripting.create(9.3)
desc = gp.Describe(f)
fi = desc.FieldInfo
f = fi.FindFieldByName("RIVER")
if f == -1:
return "False"
else:
gp.Addmessage("Hello world")
print "Hello Word"
return "True"
The output in the model dialog is: Executing (Calculate Value): CalculateValue test("%FC%") "def test(f):\n import arcgisscripting\n gp = arcgisscripting.create(9.3)\n desc = gp.Describe(f)\n fi = desc.FieldInfo\n f = fi.FindFieldByName("RIVER")\n if f == -1:\n return "False"\n else:\n gp.Addmessage("Hello world")\n print "Hello Word"\n return "True"" Boolean true
Start Time: Thu Jun 30 17:06:39 2011
Value = True
Executed (Calculate Value) successfully.
End Time: Thu Jun 30 17:06:39 2011 (Elapsed Time: 0.00 seconds)
Executing (Get Count): GetCount "Base data\NRFA_Gauge_Locations" 1661
Start Time: Thu Jun 30 17:06:39 2011
Row Count = 1661
Executed (Get Count) successfully.
End Time: Thu Jun 30 17:06:39 2011 (Elapsed Time: 0.00 seconds) As you can see I never see Hello World in the output. Duncan
... View more
06-30-2011
08:57 AM
|
0
|
0
|
1672
|
|
POST
|
Bruce, interesting point, however, I will have to recheck my benchmarking since the repetitive calls to the searchcursor seemed to be worse than my approach (ie ...SearchCursor(someFC)] ), I will recheck in arcpy to see if there is a speed difference...in the interim, other may steal my code as they see fit. If you have any benchmarking/timing information I would appreciate an update Good news, at 10.1 we are told to expect much faster performance from cursors.
... View more
06-28-2011
02:39 PM
|
0
|
0
|
1093
|
|
POST
|
This file is created with no coordinates system and the value of the raster are "consequently" wrong. I tried several time to rewrite the script but I still have the same problem. This can happen with map algebra output with some tools, especially mathematical operators like SetNull. My advice is to copy the coordinate system from your input to the output raster using the Define Projection tool.
... View more
06-27-2011
10:58 AM
|
0
|
0
|
522
|
|
POST
|
That being said, the office purchased our Arc licensing without ArcInfo. I would like to build a list of reasons to justify the purchase of Info with our next budget. This of course would have to start with functionality you need to accomplish your work tasks. A helpful reference as to what is avaliable in ArcView/Editor/Info is here: http://www.esri.com/software/arcgis/about/gis-for-me.html In short, with ArcEditor and ArcInfo you get more functionality needed to create your own geodatabases and to do more GIS analysis. You also should look carefully at extensions you may need as well. It should be mentioned that there are indexpensive (and sometimes free) 3rd party extensions to ArcGIS (XTools, ET GeoWizards, etc.) that for some applications may meet your needs. This particular forum is about command-line ArcInfo, which is a legacy software system that is licensed only with the ArcGIS ArcInfo licenses. You may want to try posting in the public safety application area forum. It's likely you'll find some good advice there: http://forums.arcgis.com/forums/43-Public-Safety
... View more
06-27-2011
10:39 AM
|
0
|
0
|
1109
|
|
POST
|
The following attached script works as a script tool. I get the error when I try to run it from IDLE or the command line... apparently there is something in the environment that is messing me up. I'm running 10.0 SP 2 on XP 64. import sys, os, arcpy
def getMetadataText(Dataset,Element="dataIdInfo/idPurp"):
"""Extracts metadata contents from ArcGIS metadata
arguments
Dataset - Path to an ArcGIS dataset
Element - XML path in ArcGIS metadata.
Default: "metadata/dataIDInfo/idPurp" ("Summary")
"""
from xml.etree.ElementTree import ElementTree
try:
# Get arcgis to fgdc translator path
ARCGISHOME = arcpy.GetInstallInfo("desktop")["InstallDir"]
XSLT = os.path.normpath(os.path.join(
ARCGISHOME,
"Metadata/Stylesheets/gpTools/exact copy of.xslt"))
xmlTemp = os.path.join(os.environ["TEMP"],"xx_xmltemp.xml")
# export the metadata to xml
arcpy.env.overwriteOutput = True
arcpy.XSLTransform_conversion(Dataset,XSLT,xmlTemp)
# parse out Description element from ArcGIS 10 metadata
tree = ElementTree() # make an ElementTree object
tree.parse(xmlTemp) # read the xml into the ElementTree
Data = tree.find(Element) # find whatever tag you want
del tree
arcpy.Delete_management(xmlTemp)
return Data.text # return the contents as text
except Exception, xmsg:
raise Exception, str(xmsg)
# You could put a loop here around this to print out Summary for a list of datasets
dataset = r"E:\work\work.gdb\BeetleSprayArea.shp"
text = getMetadataText(dataset)
arcpy.AddMessage(text)
... View more
06-22-2011
12:20 PM
|
1
|
0
|
2068
|
|
POST
|
I tried today to use the XSLTransform_conversion tool to just extract out everything (avoiding a transform) but I am getting an error message that appears to be a bug in tool validation (which I sent to ESRI support). I've attached this python script that is a function to pull out the ArcGIS metadata elements more directly (no need for the FGDC transform). The Arc 10 metadata schema is documented in the file: \ArcGIS\Desktop10.0\Metadata\Translator\Rules\ArcGIS metadata v1.dtd though I have found it easier to just look in an existing ".shp.xml" file. Another approach to this problem is to create an xslt stylesheet and run the XSL Transformation tool (conversion toolbox) to pull out the information you want into an XML file.
... View more
06-21-2011
03:25 PM
|
1
|
0
|
2068
|
|
POST
|
I am able to list the "Description" portion of the metadata for an individual feature class. Cool! Please post your working script either in full or as an attachment. Wrapping this in a loop should be pretty straighforward.
... View more
06-21-2011
11:38 AM
|
1
|
0
|
4828
|
|
POST
|
It works fine as is, I suppose because there were no characters to be escaped...? Just don't ever name any folders or files starting with n, r, or t, etc....: >>> "a\z" # "\z" is not a special string literal, so OK
'a\\z'
>>> "a\t" # this is "a" followed by <tab>
'a\t'
>>> See: http://docs.python.org/reference/lexical_analysis.html#string-literals
... View more
06-20-2011
02:58 PM
|
1
|
0
|
4828
|
|
POST
|
This is a simple enough task to do in model builder -- the kind of stuff it's really good at, no user input, or error checking, just run the tools and be done with it. Seems to me the best approach would be not to recreate the feature classes from scratch, but run the delete rows tool on each of your feature classes and then use the Append tool to copy new data into those feature classes. This would avoid having to regenerate indexes, relates, or domain settings. If you have a model builder model that works, all the python script has to do is create a geoprocessor, add your toolbox that contains your model, and run the tool.
... View more
06-20-2011
02:51 PM
|
0
|
0
|
502
|
| 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
|