POST
|
Hi Matthew: I believe the problem you are having can be resolved by setting the analysis extent for the WATERSHED tool. To do this: Click on the "Environments..." button at the bottom of the WATERSHED GUI Expand the "Processing Extent" category From the "Extent" dropdown select your flow direction grid from the list populated from your table of contents Finally, select "OK" to return to the WATERSHED GUI. After setting the analysis extent you can populate the WATERSHED GUI as required and then run the tool. For whatever reason, the default analysis extent for the WATERSHED tool does not seem to be set the same way as it is for other tools, thereby requiring us to remember to set this each time we use the WATERSHED tool. To overcome this, I have put together a Python script tool that sets the extent to the flow direction grid, and I have built in a few other enhancements as well. Hope this helps!
... View more
04-06-2015
07:58 AM
|
0
|
0
|
1718
|
POST
|
Thanks to Dan, Ian, and James who have each experienced this issue and have proposed workable solutions. I find myself in a difficult position in having to select which is the "Correct Answer". -Darren
... View more
07-09-2014
01:12 PM
|
0
|
0
|
7369
|
POST
|
Hi: Through Pythonwin I have created a collection of scripts that I have incorporated into an ArcToolbox. I have shared this toolbox with several colleagues and clients. When developing scripts I use print statements to track the progression of test runs. After I have finished developing my scripts they are typically run through ArcToolbox; however, when there are occasions when I have to run a script repeatedly to process data for several large extents I will setup a batch file so processing can run through unattended. My question: Use of print statements will write messages to the screen when running a script through an IDE. Use of arcpy.AddMessage will write messages to the screen when running a script through an ArcToolbox script tool. What is the best way to setup a Python script to write messages to the screen whether the script is being run through an IDE or ArcToolbox? Is there code that can identify where the script is running from (i.e. through either an IDE or through a script tool in ArcToolbox) and write messages to the screen using print statements or arcpy.AddMessage, whichever is appropriate? Thanks in advance for any comments/feedback!
... View more
07-09-2014
11:57 AM
|
0
|
5
|
22778
|
POST
|
Hi: I am working at putting a script together using Pythonwin that will work with input data contained in either shapefiles or a PGDb. Script is setup to output to either a folder or a PGb. I have everything working with shapefiles... now just debugging to get working with outputting to a PGDb. Script is getting hung up on ExtractValuesToPoints (runs fine on first instance of ExtractValuesToPoints, fails on second). Running ArcGIS 10.1, SP1, advanced license over Win7. I have imported arcpy.sa and have spatial analyst checked out... script checks license level: ArcInfo. Error generated through Pythonwin: Traceback (most recent call last): File "<interactive input>", line 1, in <module> File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py", line 1311, in ExtractValuesToPoints add_attributes) File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Utils.py", line 47, in swapper result = wrapper(*args, **kwargs) File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py", line 1304, in wrapper add_attributes) File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 498, in <lambda> return lambda *args: val(*gp_fixargs(args, True)) ExecuteError: ERROR 999999: Error executing function. No current record. Failed to execute (ExtractValuesToPoints). Details of success/failure in script: Runs fine on the first instance of ExtractValuesToPoints - inputs: points from PGDb and ESRI raster in folder (floating point, 32-bit); output: PGDb Error happens on the second instance of ExtractValuesToPoints - input: points from PGDb and IMAGINE Image in PGDb floating point, 32-bit); output: PGDb ExtractValuesToPoints tool runs fine through ArcGIS Desktop using the using same input data and output container as described in step 2 From geoprocessing results window I copied run of ExtractValuesToPoints tool (described in bullet 3) as python snippet and ran through the script in Pythonwin - get same error Code for each instance below... Notes: pthTemp is a PGDb txtOutExt is dataset extension (".shp" for shapefile or blank if writing to fc in a PGDb) First instance that runs fine:
ExtractValuesToPoints(pthTemp + "\\paths_pours_nil" + txtOutExt, grdStrLnks, pthTemp + "\\paths_pours_nil2" + txtOutExt, "NONE", "VALUE_ONLY")
Second instance that fails:
ExtractValuesToPoints(pthTemp + "\\pours_all" + txtOutExt, grdFacc1_0, pthTemp + "\\pours_all2" + txtOutExt, "NONE", "VALUE_ONLY")
Python snippet copied from ArcGIS desktop geoprocessing results window:
arcpy.gp.ExtractValuesToPoints_sa("pours_all","E:/a000/temp.mdb/facc1_0","E:/a000/temp.mdb/pours_all999","NONE","VALUE_ONLY")
Modified python snippet (removed ".gp") that fails in pythonwin
arcpy.ExtractValuesToPoints_sa("pours_all","E:/a000/temp.mdb/facc1_0","E:/a000/temp.mdb/pours_all999","NONE","VALUE_ONLY")
I can't figure out why the ExtractValuesToPoints process will run in ArcGIS desktop, but not through Pythonwin when using the same data and outputting to the same container? Any help will be much appreciated!
... View more
05-29-2014
10:18 AM
|
0
|
0
|
819
|
POST
|
Hi Richard: The info in your reply post solved the problem. I should have known this - doh! Thanks so much! -Darren
... View more
03-12-2014
10:21 AM
|
0
|
0
|
985
|
POST
|
Holly: In a Python script I can't seem to get FlipLine_edit to work on a selected set of lines contained within a shapefile. Unfortunately, all of the lines are getting flipped instead of just those that are selected. Did you get FlipLine_edit to work through a Python script on a selected line or set of selected lines? If you were successful with this, could you post (with code) what you did? Thanks!
... View more
03-12-2014
09:50 AM
|
0
|
0
|
322
|
POST
|
In a Python script I can't seem to get FlipLine_edit to work on a selected set of lines contained within a shapefile. Unfortunately, all of the lines are getting flipped instead of just those that are selected. Steps I am using (note code snippet pasted below, full script attached): Create a layer using MakeFeatureLayer Count all lines using GetCount (report result with print statement) Select a subset of lines using SelectLayerByAttribute Count selected lines using GetCount (report result with print statement) Attempt to change direction of selected lines using FlipLine_edit arcpy.MakeFeatureLayer_management(shpLine, "lyrLines") strCountAll = str(arcpy.GetCount_management("lyrLines")) print "Count of all features is " + strCountAll arcpy.SelectLayerByAttribute_management("lyrLines", "NEW_SELECTION", '"Flip_yn" = \'yes\'') strCountSelected = str(arcpy.GetCount_management("lyrLines")) print "Count of selected features is " + strCountSelected arcpy.FlipLine_edit(shpLine) arcpy.SelectLayerByAttribute_management("lyrLines", "CLEAR_SELECTION") In ArcMap, when using the Flip Line tool contained within Editing Tools: No lines selected: all lines will be flipped One line selected: the selected line will be flipped FYI: I have 64-bit Windows 7 with ArcGIS 10.1 (ArcInfo license) and both Python 2.7.2 and Pythonwin (both 2.7.2) I also tried using FlipLine using arcpy.da.UpdateCursor, but individual lines were not being flipped this way either. Thanks in advance for any input!
... View more
03-12-2014
09:45 AM
|
0
|
2
|
2154
|
POST
|
Delineating watersheds by size can be done.... I have automated this task with a Python script (ArcGIS 9.3). As someone suggested, you need to use the flow accumulation grid to accomplish this task, along with the flow direction grid for the extent. The GUI for the script I created requires the user enter a size threshold with padding that defines the size of watersheds that will be delineated. For example, specifying 1 sq km watersheds, plus or minus 30% would yield watersheds spread across the data extent that range in size between 0.7 and 1.3 sq km. A set of points is generated along each link in the drainage network, as illustrated in the attached graphic. Remaining steps: 1) Accumulation values get attached to the points 2) Links within the drainage network are assigned a unique id 2) Set of points (0.7 to 1.3 sq km) are assigned the link id for which they are associated with 2) Points within lakes are deleted 3) Points with median accumulation value for each unique link id is selected and used as a pour point to delineate watersheds The government organization I work with operates on a policy of keeping atleast one version behind the latest release of ArcGIS. We are expecting to get ArcGIS 10 soon - this will require me to update my python script to work with this version.
... View more
05-22-2013
12:21 PM
|
0
|
0
|
966
|
POST
|
Jeff Jennes created a tool with functionality that, when working with polylines, will generate a field that reports the projected azimuth (perhaps also bearing(?)) of each line segment in a polyline dataset. This functionality is accessed through a utility called "Calculate Geometry" that is available through Jeff's "Tools For Graphics and Shapes" (available through ArcScripts here: http://arcscripts.esri.com/details.asp?dbid=15376 ). To apply this approach you would have to convert your polygons to polylines (use XTools: Feature Conversions => Convert Polygons To Polylines. Next, you would have to split the polylines at each of the vertices to create a separate polyline for each section of polygon boundary (use XTools: Feature Conversions => Split Polylines and use the "Split polylines at all vertices" option). -Darren
... View more
09-12-2011
11:52 AM
|
0
|
0
|
520
|
POST
|
I was able to resolve the problem I was having with a joined date-based crosstab query (created through MS Access) not functioning properly in ArcGIS (described in previous post, above). Modifying the short date format specified in my Windows Regional Settings was the key to resolving this problem. The short date format used by Access is that which is specified by the Short Date format in your Windows Regional Settings. Typically, the default short date format is setup to display dates as dd/mm/yyyy or dd-mm-yyyy. With these formats 29 August 2005 will be displayed as 29/08/2005 or 8-29-2006. With the first character in each of these short date formats being numeric ArcGIS has trouble with the data held in these fields (info on this available here: http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?id=2760&pid=2745&topicname=Working_with_Microsoft_Access_files_in_ArcGIS ). I changed my default short date format to mmm_dd_yyyy and now my MS Access date-based crosstab query joins to my feature class attribute table in ArcGIS without any problem. To change the system short date format... Go into "Control Panel" => "Regional and Language Options" (RLO) then click the "Customize" button on the "Regional Options" tab (this will reveal the "Customize Regional Options" form). Next, click on the "Date" tab. Edit the "Date separator:" field to "_" (underscore, no quotes) and then edit the "Short date format:" field to read "MMM_dd_yyyy" (no quotes). Finally hit the "Apply" button and then close the RLO windows. You should now be able to join and use you Access date-based crosstab queries in ArcGIS without any trouble.
... View more
09-12-2011
10:43 AM
|
0
|
0
|
376
|
POST
|
Tables and queries (both selection and crosstab) within a Personal Geodatabase/Access Database are visible through ArcMap via a "Database Connection" defined in ArcCatalog using the "ODBC" OLE provider. Info on this is described in the old archived ArcGIS forum here: http://forums.esri.com/Thread.asp?c=93&f=988&t=107692&mc=7#msgid305726, on the U of Waterloo website here: http://env.uwaterloo.ca/computing/services/gis/gis_help/arcgis/desktop/faq1.html, and through the newer ESRI support pages here: http://support.esri.com/en/knowledgebase/techarticles/detail/20828 However, I am having some problems with a date-based crosstab query I created in Access and have joined to the attribute table of a feature class in ArcMap: Data in the date-based crosstab are displaying correctly when previewed through ArcCatalog, but the field headings are displaying incorrectly (e.g. 06/07/2010 is displayed as _07_2010) In ArcMap, the field headings for the date-based crosstab query joined to a feature class attribute table are displayed correctly (e.g. 06/07/2010 is displayed as 06/07/2010), but the tabular data is wrong. The numeric value in the first record of each field is repeated for each record in that field. Each of the repeated values under each field from the crosstab is not a reasonable value - they are outside the range (much smaller) than values in the crosstab as viewed through Access. Oddly, the statistics (generated in ArcMap by right-clicking field and selecting statistics) for the data in each crosstab field are correct, despite the values from the crosstab being displayed incorrectly. I tried generating a raster based on one of the fields in the crosstab - the raster was incorrect - the repeated value displayed in the joined attribute table was used to derive the raster, not the true values in the crosstab as viewed through Access. I have attached a graphic containing a series of annotated screen caps that illustrate the errors described above. Has anyone else encountered the same problem and figured out a workaround? -Darren
... View more
09-09-2011
10:51 AM
|
0
|
0
|
376
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|