Tag Info

Hot answers tagged

13

In ArcGIS Desktop 9.3.1 and prior, right-click on the tool in ArcToolbox and select Edit Documentation. At version 10 it is a little bit different, this thread on Esri Support describes the issue: http://forums.arcgis.com/threads/405-Beta-10-ArcToolbox-Documentation Specifically, at 10.0, you need to access the toolbox item from the ArcCatalog window within ...


12

The two are very, very close in functionality but not completely equivalent. Common to both Includes a set of tools with a unique alias for identification Can call from arcpy Get a Geoprocessing tool dialog (essentially a full UI) for free for each tool Can keep all Python code in one file (embedding tool source in TBX, holding all the implementation in ...


11

As you have discovered, Windows paths contain a single backslash, but in Python a single backslash is an escape character. You have a few options: 1) You can use a raw string (r"stringgoeshere"), or os.path.normpath(), as detailed in this blog post. 2) In order for Python to understand that a string contains a path you need to use double backslashes. So ...


10

You can go to Data Management -> Raster -> Raster Processing -> Clip, and Spatial Analyst is not needed. There just check the checkbox "Use input features for clipping geometry". From help: If the checkbox "Use input features for clipping geometry" is checked, then the output raster is clipped based on the perimeter of the polygon shape. If the checkbox is ...


8

Assuming your tool is always outputting the output file in the same directory, this function will return the next highest-numbered file name: import os def getNextFilePath(output_folder): highest_num = 0 for f in os.listdir(output_folder): if os.path.isfile(os.path.join(output_folder, f)): file_name = os.path.splitext(f)[0] ...


8

This help topic discusses some of the raster format limitations for Spatial Analyst: Data formats supported by Spatial Analyst While it is focused mainly on vector overlay operations, this blog post has many suggestions, including improvements made at 10.1 and 10.1 SP1. In particular, if you are working with very large datasets, then using 64-bit ...


7

Here you go: http://help.arcgis.com/en/arcgisdesktop/10.0/help/002t/pdf/Geoprocessing_data_types.pdf From: Data types for geoprocessing tool parameters To answer your specific question, I belive you would want to use a Workspace parameter which will let you specify an SDE connection file, then use filters to limit the workspace type (see screenshots in ...


7

I figured out how to do this by using the Make Query Table tool, Copy As Python Snippet, the Python window and the Copy Features tool. After running the Make Query Table tool to pull through just the fields I wanted to appear in the output I was able to Copy As Python Snippet this code from the Geoprocessing | Results window into the Python window of ...


7

To get the result you are looking for you need the inputs in your model to be empty when you save it and they both need to be set as parameters. Do this by right clicking on them in model building and choosing 'Model Parameter'. You can set up everything else, but leave the input and/or target parameters blank. Then when you open the tool the user will ...


7

The Feature Class to Feature Class tool is a Conversion tool. The idea is to convert a feature class in one format (e.g. shapefile) to another (e.g. geodatabase). It also allows the user to control the Field Map - i.e. which fields will be copied over. The Copy Features tool simply creates an exact copy of the input features. Note - this tool can also be ...


6

Right-click on the toolbox in ArcToolbox and select Save As specifying 9.3 as the outgoing version. I ran into this problem previously, it is wise to copy your 9.2, 9.3 etc toolboxes to a new location prior to loading into version 10. EDIT I should add, that user toolboxes won't be available by default in version 10 even though they may have been so in ...


6

A sample code for a script tool which will have a single check box. If a check box will be checked by a user, the tool will verify existance of a specified data file. import arcpy input_fc = r'C:\GIS\Temp\data_shp.shp' #getting the input parameter - will become a tool parameter in ArcGIS of Boolean type ischecked = arcpy.GetParameterAsText(0) ...


6

To see how to get a checkbox onto the dialog of a Python script tool try using some test code like this: inputString = arcpy.GetParameterAsText(0) inputBoolean = arcpy.GetParameterAsText(1) arcpy.AddMessage("String set to " + inputString) arcpy.AddMessage("Boolean set to " + str(inputBoolean)) Then when you add this script as a tool you will need two ...


6

Based upon your comments in other responses, it sounds like you really just want to alert the user about things that have occurred during the operation of your script, rather than necessarily keep the script dialog box open. A couple of alternative approaches could be: Write the pertinent information back to the ArcGIS GP console by adding messages, ...


6

Try sys.argv[0], on Windows it will return the full path to the currently running script.


6

In my personal experience, no. Looking at the product matrix, there is also nothing to indicate they would groom their performance as such. http://www.esri.com/library/brochures/pdfs/arcgis10-functionality-matrix.pdf I would suggest running some test cases with the same data, stored locally, on the same computer, with different licenses in order to ...


6

The only thing I see in your code that could cause this problem is that you are setting the MXD value to "CURRENT", which is fine... IF you have an MXD open (executing the script tool from within ArcMap). I was able to cause your code to fail with the same response if I tried executing the code form the stand-alone ArcCatalog application. Is that what you ...


6

That's just the statistics. By default it is set to the minimum and maximum possible values. If you use the 'Calculate Statistics' tool from the toolbox it should set those to more meaningful numbers. If you don't want to calculate statistics in your layer properties you can change the minimum and maximum values of the display manually if you have a ...


6

I believe the AreaOnAreaOverlayer is the transformer that performs the equivalent of an ArcGIS Union. Performs an area-on-area overlay so that all input areas are intersected against each other and resultant area features are created and output. The resultant areas have all the attributes of all the original features in which they are contained.


6

This from ESRI: Your existing toolboxes, models, and scripts can be reused in ArcGIS Pro. However, if you use arcpy.mapping, you may need to make adjustments to work with project files (.aprx) and maps, instead of map documents (.mxd). In addition, ArcGIS Pro uses Python 3, so it is possible that you may need to make some changes to your scripts. There ...


5

You don't need to worry about buffers or Polygons. I think the tool you are looking for is called "Dissolve" in the Data Management/Generalization Toolbox. You have to decide whether to use the parameter DISSOLVE_LINE or UNSPLIT_LINES - the latter will only create a single line for contiguous features - i.e. lines that share an endpoint. Dissolve and its ...


5

Currently I have the workflow of ArcCatalog: opening toolbox > selecting model > editing > file > export > to python, switch to SCM tool > refresh changes > commit changes (enter log comment). It's cumbersome so I don't do it so much, and thereby lose many of the benefits of versioning.


5

That's not built into the application, but I assume running the batch file that sets up the virtualenv in a cmd.exe session and then running arcmap.exe from the same DOS box should get you your virtualenv. ArcMap and friends will modify the path slightly to include the install's arcgisscripting and arcpy. Edit: you will need to explicitly call the ...


5

You don't say what license or version you are using, but assuming you have ArcInfo, it is possible to use the "Near" geoprocessing tool to find the nearest object in the same layer. From the tool help page: The same dataset can be used as both Input Features and Near Features. When an input feature's nearest feature is itself (NEAR_DIST is 0), this ...


5

ArcGIS stores a great deal of a user's preferences in the Windows Registry, which is partially documented in "ArcGIS Desktop Advanced Settings Registry Keys.doc", found in the Utilities folder of your ArcGIS installation. You can browse these settings with the Registry Editor (run regedit), and look into the keys from HKEY_CURRENT_USER\Software\ESRI. This ...


5

If you add a geoprocessing tool to a toolbar it will run immediately upon clicking it, provided it has no parameters:


4

Every mainstream version control software, be it central central version control like SVN or distributed solutions like Git, Mercurial, Bazaar etc. allow storage of binary files. They are all quite effective both performance-wise and also in terms of occupied space. Inspecting differences between revisions/versions of a file is of course different story. ...


4

When your command is run inside ArcMap (should work in ArcCatalog and other applications as well): var arcToolBoxExtension = _app.FindExtensionByName("ESRI ArcToolbox") as IArcToolboxExtension; if (arcToolBoxExtension != null) { var arcToolBox = arcToolBoxExtension.ArcToolbox; var gpTool = ...


4

Alternatively, you could proceed as followed: Use the aggregate tool on your input data to create a coarser raster with the same extent. Convert the resulting raster to points. Use these points to sample the original grid. The key here is the aggregation factor which controls the degree of generalization of your input data, e.g. the spacing of the ...


4

A clean, no fuss alternative would be to display your log file in a simple Tkinter window at the end of your script. While the registry option is workable, there may be forces beyond your control, admin privileges, etc. if showLog: import Tkinter #read the log data log = open(r'logfile.txt').read() #create a tkinter window with a text box ...



Only top voted, non community-wiki answers of a minimum length are eligible