SlideServe
Menu
Préférences
© SlideServe · v2026

Extending ArcGIS via Programming: Enhancing Functionality and Automation

englandl avatar
23 diapositives · 275 Views · Jan 02, 2020

Learn how programming in ArcGIS boosts efficiency, automates tasks, and unlocks new functionalities not available through standard tools. Customize your GIS experience with scripts and interfaces for tailored solutions.

Extending ArcGIS via Programming: Enhancing Functionality and Automation - slide 1
01 / 23Extending ArcGIS via Programming: Enhancing Functionality and Automation
1 / 17

Télécharger la présentation

Extending ArcGIS via Programming: Enhancing Functionality and Automation
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Extending ArcGIS via programming • Why Programming • Automation of repetitive tasks • Implementation of functionality not available • Programming functionality • Scripts (AML, VB, Python, Avenue) • Interfaces for application programmers • Model Builder • ArcObjects • COM Integration

  2. Three Views of GIS Geodatabase view: Structured data sets that represent geographic information in terms of a generic GIS data model. Geovisualization view: A GIS is a set of intelligent maps and other views that shows features and feature relationships on the earth's surface. "Windows into the database" to support queries, analysis, and editing of the information. Geoprocessing view: Information transformation tools that derives new geographic data sets from existing data sets. adapted from www.esri.com

  3. Examples • TauDEM – ArcMap toolbar using Visual Basic/C++ (implementation of functionality not available in ArcGIS) • Visual Basic Programming of simple grid calculations

  4. TauDEM Software Functionality • Pit removal (standard flooding approach) • Flow directions and slope • D8 (standard) • D (Tarboton, 1997, WRR 33(2):309) • Flat routing (Garbrecht and Martz, 1997, JOH 193:204) • Drainage area (D8 and D) • Network and watershed delineation • Support area threshold/channel maintenance coefficient (Standard) • Combined area-slope threshold (Montgomery and Dietrich, 1992, Science, 255:826) • Local curvature based (using Peuker and Douglas, 1975, Comput. Graphics Image Proc. 4:375) • Threshold/drainage density selection by stream drop analysis (Tarboton et al., 1991, Hyd. Proc. 5(1):81) • Wetness index and distance to streams • Water Quality Functions

  5. TauDEM in ArcGIS Visual Basic ESRI ArcGIS 8.3, 9.0 Toolbar Standalone command line applications C++ COM DLL interface Available from TauDEM C++ library Fortran (legacy) components http://www.engineering.usu.edu/dtarb/ TauDEM Gridio Shapelib ESRI gridio API (Spatial analyst) Vector shape files ASCII text grid Binary direct access grid ESRI binary grid Data formats

  6. Implementation Details Spatial Analyst includes a C programming API (Application Programming Interface) that allows you to read and write ESRI grid data sets directly. Excerpt from gioapi.h / * GetWindowCell - Get a cell within the window for a layer, * Client must interpret the type of the output 32 Bit Ptr * to be the type of the layer being read from. * * PutWindowCell - Put a cell within the window for a layer. * Client must ensure that the type of the input 32 Bit Ptr * is the type of the layer being read from. * */ int GetWindowCell(int channel, int rescol, int resrow, CELLTYPE *cell); int PutWindowCell(int channel, int col, int row, CELLTYPE cell);

  7. C++ COM Methods used to implement functionality using Microsoft Visual C++ STDMETHODIMP CtkTauDEM::Areadinf(BSTR angfile, BSTR scafile, long x, long y, int doall, BSTR wfile, int usew, int contcheck, long *result) { USES_CONVERSION; //needed to convert from BSTR to Char* or String *result = area( OLE2A(angfile), OLE2A(scafile), x,y,doall, OLE2A(wfile), usew, contcheck); return S_OK; }

  8. Visual Basic for the GUI and ArcGIS linkage Private TarDEM As New tkTauDEM … Private Function runareadinf(Optional toadd As Boolean = False) As Boolean Dim i As Long runareadinf = False i = TarDEM.Areadinf(tdfiles.ang, tdfiles.sca, 0, 0, 1, "", 0, 1) If TDerror(i) Then Exit Function If toadd Then AddMap tdfiles.sca, 8 End If runareadinf = True End Function

  9. Using TauDEM - Exercise

  10. Calculating the distance to a drain point (e.g. watershed outlet or gage) • Introduce VB scripting • Introduce Recursion • Isolate the Watershed draining to a point • Could be done with the Flow Path function (maybe), but a programmed solution is instructive and can be generalized to other applications

  11. Distance from each grid cell to outlet along flow path Write program to do this

  12. Distances 42.4 42.4 42.4 30 30 30 42.4 42.4 42.4 30 30 30 42.4 42.4 42.4 30 30 30 42.4 30 30 30 30 30

  13. 30 30 30+42.4 72.4 102.4 30+30+42.4 132.4 30+30+42.4+30 Summing the distances down from each grid cell

  14. Summing the distances down from each grid cell 30 30+42.4 30+30+42.4 30+30+42.4+30 Number of additions

  15. 30 30 30+42.4 72.4 102.4 30+72.4 132.4 30+102.4 Recursive Approach

  16. Recursive Approach 30 30+42.4 30+72.4 30+102.4 Number of additions N

  17. This requires (assumes) that the distance for cell i,j is initialized or has been calculated to start the process

  18. 4 3 2 5 1 6 7 8 Direction encoding 1 2 3 1 7 6 5 2 7 6 5 3 6 7 7 Distances to outlet Programming the calculation of distance to the outlet 102.4 72.4 30 72.4 42.4 0

  19. Visual Basic Implementation 'RECURSIVE DISTANCE CALCULATION FUNCTION Sub DistCalc(i, j) Dim k As Integer, inb As Long, jnb As Long For k = 1 To 8  ' for each neighbor     inb = i + di(k)     jnb = j + dj(k)     If (inb >= 0 And inb < nrow And jnb >= 0 And jnb < ncol) Then   ' guard ' against out of domain         If pPixels(jnb, inb) > 0 Then   ' guard against no data             If (pPixels(jnb, inb) - 4 = k Or pPixels(jnb, inb) + 4 = k) Then             ' Here we have a grid cell that drains back to the grid cell we are at                 dPixels(jnb, inb) = dPixels(j, i) + dd(k)                 DistCalc inb, jnb ' Call the function for the neighbor pixel             End If         End If     End If Next k End Sub

  20. Steps for distance to outlet program • Read the outlet coordinates • Read the DEM flow direction grid. This is a set of integer values 1 to 8 indicating flow direction • Initialize a distance to outlet grid with a no data value • Convert outlet to row and column references • Start from the outlet point. Set the distance to 0. • Call the DistCalc function at the outlet.

  21. Distance Calculation VBA Exercise

  22. Visual Basic Programming in ArcMAP References ESRI, (1999), ArcObjects Developers Guide: ArcInfo 8, ESRI Press, Redlands, California. Zeiler, M., (2001), Exploring ArcObjects. Vol 1. Applications and Cartography. Vol 2. Geographic Data Management, ESRI, Redlands, CA.

  23. AREA 2 3 AREA 1 12 Are there any questions ?