|
POST
|
Bart, Sounds like you have found a bug? Alternatively (although not tested by me) is you could create the event layer using the arcpy.MakeXYEventLayer_management tool from the table as you know what the table is called and never have the need to "enter" the MXD? Just an idea... Duncan
... View more
07-22-2011
02:48 AM
|
0
|
0
|
765
|
|
POST
|
Here is a sample of how to set up the IGeoProcessor, in this example they are calling a custom tool but it could equally be a standard esri tool. You just need to be careful in the order you add the tools parameters to the array object, this must be the same as how you would fill in the tool. Duncan
... View more
07-06-2011
08:34 AM
|
0
|
0
|
969
|
|
POST
|
Craig, The lines of code 187 & 188 you are suggesting is python code which is not VB. I have 9.3 and the CreateObject function on line 187 works fine for me so this makes me wonder if ESRI have done something behind the scenes in 9.3.1. Can someone clarify this? ESRI want us to use the new way of creating a GeoProcessor object, the IGeoProcessor. You can still call the standard tools using this new interface you just do it differently. I find it actually easier to use, as the intellisense works. Do a search on the old forum for IGeoProcessor and you'll see lots of examples of how to construct it and invoke tools with it. Duncan
... View more
07-06-2011
07:13 AM
|
0
|
0
|
969
|
|
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
|
2397
|
|
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
|
2397
|
|
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
|
7584
|
|
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
|
1103
|
|
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
|
1103
|
|
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
|
558
|
|
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
|
2371
|
|
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
|
2371
|
|
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
|
523
|
|
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
|
738
|
|
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
|
558
|
|
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
|
983
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-15-2023 05:45 AM | |
| 1 | 2 weeks ago | |
| 1 | 2 weeks ago | |
| 1 | 04-15-2026 07:35 AM | |
| 1 | 04-14-2026 06:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|