|
POST
|
Curtis, Ah! This is good news about embedding scripts into the toolbox. I don't have v10 although there is a v10 machine in the office but I have yet to get up to date with whats new. So what happens if you embed a python script then realise you've got a bug in it (highly likely as I hate using Python!), is the process of embedding a script a one way task or can you un-embed it to edit it? Duncan 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 help on embedding scripts in toolboxes.
... View more
07-01-2011
11:32 AM
|
0
|
0
|
2563
|
|
POST
|
Curtis, Oh dear, thanks for your idea, a bit of a fudge but I guess a tool should really exist, I suggested this on the ideas website. Duncan
... View more
07-01-2011
07:54 AM
|
0
|
0
|
2563
|
|
POST
|
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 two 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:07 AM
|
0
|
8
|
7750
|
|
POST
|
Bernd, Looking at the help the Add method on IcommandBar is adding an object of type ICommandItem which has a property Group that creates the separator. I don't think you simply add a separator you say if the item is the start of a new group. Duncan
... View more
06-30-2011
07:04 AM
|
0
|
0
|
1150
|
|
POST
|
Bernd, You create the separators in the XML section, see highlighted code below which I have copied out on an existing project of mine. Duncan <Menus> <Menu id="GeoData_Institute_EMU_Side_Scan_Editing_Toolbar_Conversion" caption="Processing Tasks" isRootMenu="true"> <Items> <Button refID="GeoData_Institute_EMUTool_btnCreatePoints" /> <Button refID="GeoData_Institute_EMUTool_btnCreatePolylines" /> <Button refID="GeoData_Institute_EMUTool_btnCreatePolygons" /> <Button refID="GeoData_Institute_EMUTool_btnNearestModel" separator="true" /> <Button refID="GeoData_Institute_EMUTool_btnMerge"/> <Button refID="GeoData_Institute_EMUTool_btnSymbology" separator="true" /> <Button refID="GeoData_Institute_EMUTool_btnJoinTable" separator="true" /> <Button refID="GeoData_Institute_EMUTool_btnExport" separator="true" /> </Items> </Menu> </Menus> <Toolbars> <Toolbar id="GeoData_Institute_EMU_Side_Scan_Editing_Toolbar_EMU_Sidescan_Editing" caption="EMU Anomaly Editing Toolbar" showInitially="false"> <Items> <Menu refID="GeoData_Institute_EMU_Side_Scan_Editing_Toolbar_Conversion" /> <Button refID="esriArcMapUI.SelectFeaturesTool" separator="true" /> <Button refID="esriControls.ControlsMapIdentifyTool" /> <Button refID="esriArcMapUI.HyperlinkTool" /> <Button refID="GeoData_Institute_EMUTool_btnGroupPoints" separator="true" /> <Button refID="GeoData_Institute_EMUTool_btnGroupPolylines" /> <Button refID="GeoData_Institute_EMUTool_btnGroupPolygons" /> <Button refID="GeoData_Institute_EMUTool_btnDelete" separator="true" /> <Button refID="GeoData_Institute_EMUTool_btnHelp" separator="true" /> </Items> </Toolbar> </Toolbars> </ArcMap>
... View more
06-28-2011
06:00 AM
|
0
|
0
|
1150
|
|
POST
|
Cory, See amended code and my notes. Duncan # Import system modules
import sys, string, os, arcpy
# Create the Geoprocessor object
# NOTE: DO NOT USE CREATEOBJECT METHOD
ary = arcpy.Array()
pnt = arcpy.Point()
## create rect starting lower right going clockwise
# NOTE: THE x & y PROPERTY ARE IN CAPITALS
pnt.X = -117.0
pnt.Y = 35
ary.add(pnt)
pnt.X = -117.0
pnt.Y = 35.75
ary.add(pnt)
pnt.X = -116.25
pnt.Y = 35.75
ary.add(pnt)
pnt.X = -116.25
pnt.Y = 35
ary.add(pnt)
## redo first point (lower right)
pnt.X = -117.0
pnt.Y = 35
ary.add(pnt)
## -------------------------------------------------------------
AOI = "C:\\Temp\\test9.shp"
ScratchWS = "C:\\Temp"
# Process: Create AOI Feature Class...
arcpy.CreateFeatureclass_management(ScratchWS, "test9", "POLYGON", "", "DISABLED", "DISABLED", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];IsHighPrecision", "", "0", "0", "0")
cur = arcpy.InsertCursor(AOI)
feat = cur.newRow()
feat.shape = ary
cur.insertRow(feat)
... View more
06-23-2011
01:16 AM
|
0
|
0
|
590
|
|
POST
|
Dan, Thanks for checking this one. After much poking around in ArcCatalog I found how to make ArcMap aware of ASC files, as always it was a small checkbox in an out of the way part of options that I had to tick. This seems to affect all of ArcMap and the GeoProcessing tools so I can now at least see the file! 😉 So lets start with the obvious, %n% starts at zero, is your first asc file sample0.asc? Duncan
... View more
06-16-2011
12:35 PM
|
0
|
0
|
2528
|
|
POST
|
Dan, I do not have 9.3.1 I have 9.3. Can you confirm as it would be interesting to know that just running the Make XY Event Layer by itself (so not in a model) that you can actually navigate to a file with the file extension .asc? I can't do this, it does not show, but you can? ESRI must have been doing some tweaking behind the scenes if this is the case? Duncan
... View more
06-16-2011
07:30 AM
|
0
|
0
|
2528
|
|
POST
|
Marcus, This may be a red herring, but here is an old thread talking about the error but for an older version of ArcView. http://forums.esri.com/thread.asp?c=3&f=38&t=45124 Duncan
... View more
06-15-2011
08:04 AM
|
0
|
0
|
550
|
|
POST
|
Logan, Looking at your model you are using an iterate feature, this produces a single feature or row from you input FeatureClass and this is feeding into a Dissolve tool. Dissolving a single row does not make sense as typically you dissolve many geometries into each other based upon a field. I think the model logic is flawed? It would make sense if you were iterating through a folder of featureclasses, if this is the case then you want to be using the Iterate FeatureClass. Duncan
... View more
06-15-2011
07:43 AM
|
0
|
0
|
768
|
|
POST
|
Nancy, People may be able to help you if you zip up your model and upload it? But if you don't want to do that try setting the models environment workspace property? Duncan
... View more
06-15-2011
07:31 AM
|
0
|
0
|
592
|
|
POST
|
Jeremy, Probably the easiest way is to reclassify your source raster dataset to create one big raster dataset of one value then covert that into the polygon? Duncan
... View more
06-15-2011
07:27 AM
|
0
|
0
|
1025
|
|
POST
|
Dan, Why your model is failing (and I don't think it is to do with the %n%) is that the Make XY Event tool does not take asc files as input. For example sample1.asc won't work but sample1.txt will! I think it's a simple matter of changing the file extension. This is assuming your text files are comma separated and the first row is the header so something like: ID,X,Y,Z 1,10,10,-9999 2,20,23,-9999 3,11,33,12.5 Duncan
... View more
06-15-2011
07:06 AM
|
0
|
0
|
2528
|
|
POST
|
Keith, Without seeing the code it's a bit hard to answer. Is the envelope you are doing the clip with getting refreshed? Do you set any spatial analyst properties using the IRasterAnalysisEnvironment interface, if so are they getting refreshed? I know you are developing in VB .Net but in a VB6 project of mine if a COM error occurred which I had not trapped for it would always blitz the whole tool bar and one would need to close and restart ArcMap. I was wondering if you could test for the scenario and stop it ever causing the error? Duncan
... View more
06-14-2011
07:22 AM
|
0
|
0
|
1129
|
|
POST
|
So you have no consistent naming convention in the facilities field? I think Alexander's advice would help you. Create a new field that codes the type of facility this would simplify your query.
... View more
06-08-2011
03:01 AM
|
0
|
0
|
1972
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-03-2026 07:31 AM | |
| 3 | 06-29-2026 05:17 AM | |
| 1 | 02-15-2023 05:45 AM | |
| 1 | 06-16-2026 02:37 AM | |
| 1 | 06-15-2026 08:29 AM |
| Online Status |
Offline
|
| Date Last Visited |
Monday
|