0% found this document useful (0 votes)
46 views

Tutorial - Itree Eco Python Tools

Uploaded by

gerald
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Tutorial - Itree Eco Python Tools

Uploaded by

gerald
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Tutorial:

Python Tools Developed for


i-Tree Eco Full Inventory

Acknowledgement
This project was supported by the Urban & Community Forestry Program of the U.S.
Forest Service, Department of Agriculture State & Private Forestry, Region 8 (Atlanta)
under cooperative agreement [14-CS-11330144-078] between Georgia Tech and the
USDA Forest Service (Urban Forestry South, Athens, Georgia)

Project Title
Data Model for GIS Database Management and i-Tree Eco

Project Period
8/15/2014 - 12/18/2015

Project Team
Rama Sivakumar (PI), Senior Research Engineer, Center for GIS, Georgia Tech
Ryan Bowman, Graduate Student
Manasvini Sethuraman, Graduate Student
Overview
Along with the geodatabase model, there are a set of Python scripts that transfer data between
the ArcGIS geodatabase and i-Tree Eco software. This enables the users to quickly derive the tree
inventory’s ecosystem services through the i-Tree Eco model, then spatially display the results
in ArcMap. The first script will create an Access database that is in compliance with i-Tree Eco’s
domains, the second script will copy the data from i-TreeEco feature class to the newly created
Microsoft Access database, while the third script will join the results from the i-Tree Eco model to
the existing feature class to enable visual representation of the ecosystem services.

1. Setting up the dbtools toolbox


**if you have already downloaded and unzipped the iTreeEco_DB zip file skip step 1.
1--> Download the iTreeEco_DB.zip file.
1--> Create a folder in some location on the local machine, say C:\iTreeEco_DB. Do not
include spaces in the name, as spaces cause errors in ArcGIS.
1--> Uncompress iTreeEco_DB.zip by right clicking on the file and choosing the Extract All option.
1--> Choose the folder to be extracted as the one created in the previous step. Click Extract.
1--> Open the iTreeEco_DB folder and locate the folder called pypyodbc.
1--> Inside this folder, find setup.py. Double click on setup.py.

2--> Open ArcMap, and choose a blank map.


2--> In the ArcCatalog menu, add a folder connection to the
folder in which the iTreeEco_DB folder is present.
2--> The itree-dbtools toolbox shows up in the catalog when the
its parent folder is expanded (Fig. 1.1).
2--> Expand the itree-dbtools toolbox. There should be three
scripts:
1-Create MS Access Database
2-Populate MS Access Database
3-Get data from iTree for displaying in ArcMap
3--> Right click on the first script and choose
Properties. A pop-up window appears. Figure 1.1 Connecting to i-TreeEco
DB tools
3--> Click on the Source tab.
3--> Change the location of the script file to
path\dbtools\1_create_access_db.py (Fig. 2.2).
3--> Repeat the previous step for the remaining two
scripts:
• The source for the second script is
path\dbtools\2_load_access_database.py
• The source for the third script is
path\dbtools\3_getdata.py*
(note: if you are running ArcGIS 10.1, the Figure 1.2 Assigning the script for the tools
source for the third script is 3_getdata10_1)

Now that the tool setup is complete, let’s use the tools!

Page: 2
2. Running the Populate MS Access Database script
4--> Double click on “1- Create MS Access Database” script. The tool window appears.
4--> Click the Open Folder button next to the Folder Name field.
4--> Navigate to the folder where you want to create the MS Access database. Click Open.
4--> Type Tutorial_FullInventory under Database Name. Click OK (Fig. 2.1).
4--> If the script runs successfully, the results window should say Succeeded. Close the
window.

5--> Double click on “2- Populate MS Access Database


script”. The tool window appears.
5--> Click the Open Folder button next to the
MS Access Database field.
5--> Navigate to the folder where you created the Tutori-
al_FullInventory MS Access database in the previous
tool. Click Open.
Figure 2.1 Create MS Access Database tool window
5--> Click the Open Folder button next to the Geodataset
field.
5--> Navigate to the folder where the downloaded
iTreeEco.gdb is located.
5--> Choose the the feature class that contains your full
tree inventory, i.e. C:\iTreeEco_DB\Tutorial_iTreeE-
5--> co.gdb\FullInventory_Tutorial, and click Add.
5--> Make sure the “Populate MS Access Database” win-
dow looks like Figure 2.2, then click Ok.
5--> If the script runs successfully, the results window Figure 2.2 Populate MS Access DB tool window
should say Succeeded (Fig 2.3). Close the window.

6--> In the ArcCatalog menu, right click the


Tutorial folder and click Refresh.
6--> Notice the error_log_Tutorial_FullInventory.csv
that is added to the Tutorial folder.
6--> Drag the error_log_Tutorial_FullInventory file to
the Table of Contents.
6--> Right-click and choose Open to examine the
Attribute Table.
6--> Examine the fields in this error log, then
close the table and remove it from the Table of
Contents.
Figure 2.3 Successful Results from Populate Access DB tool

The script performs validation, the results of which are stored in a .csv file in the same folder as the MS
Access Database. The error log gives a short description and a brief explanation of the error. The records
which produce errors will not be added to the MS Access database. How- ever, the user can always correct
the errors, and execute this step again in order to include the previously erroneous records.

Page: 3
3. Working in i-Tree Eco

7--> Download and install the i-Tree Eco software.


7--> Go to Start Menu > All Programs > i-Tree > Eco.
7--> In i-Tree Eco, navigate to File > New Project.
7--> Navigate to the folder where this project is stored. Most preferably, store this project in the
same folder where your Tutorial_iTreeEco.gdb is, i.e. in the Tutorial folder.
7--> Name your project Tutorial, and click Save.
7--> For Input database, choose Create.
7--> In the Save As window that pops up, name the input database Tutorial_input.
7--> For Report database, choose Create.
7--> In the Save As window that pops up, name the input database Tutorial_result.

The previous steps created stock databases where the input and results for the i-Tree Eco analysis
will be stored. Now we will configure what type of inventory will be fed into these databases. This
is and important step as the type of inventory is unique to the iTree Eco geodatabse developed.
8--> Now click Configure input.
8--> Location Name type Georgia Tech.
8--> State field navigate the drop-down to
Georgia.
8--> County navigate to DeKalb.
8--> Place navigate to Atlanta.
8--> For the Weather Station ID field click
“Select”.
8--> Choose the weather station pin in the
middle of the map. The weather station Figure 3.1 Selecting Weather Station in new i-Tree Eco Project
ID should be 722190-13874, then press
OK (Fig. 3.1).
9--> In the Series name field type
Tutorial_1.
9--> Next to sampling, select the
“Inventory- 100% census” oval
9--> In the Year type 2015.
9--> Next to Data units: field, select the
“English (inches, feet, acres)” oval
9--> Under Project Options, uncheck the
boxes “Pest Detection” and “Energy
Included”.
9--> Do not edit any information in the
Plot Info or Data Collections
sections.
9--> Make sure the Creating/Configuring
inventories window looks like
Figure 3.2, click Add to Database.
9--> Once we have configured the input,
click Exit.
9--> In the create new project window
click OK. Figure 3.2 Creating new i-Tree Eco Project

Page: 4
Importing the data into i-Tree Eco
Now that the data is in MS Access database and the i-Tree Eco project has been created, it is pos-
sible to import the data to i-Tree Eco and submit it to the remote server for processing.

10--> In i-Tree Eco, navigate to File > Import Data Inventory,


an Importing pop-up window will appear.
10--> Click Browse in the top of the screen.
10--> Navigate to the FullInventoryTrees.mdb you created when using the 1- Create MS Access
Database tool in ArcMap, i.e. C:/iTree_EcoDB/Tutorial/Tutorial_FullInventory.mdb
Press Open (Fig. 3.3).
10--> Click Import at the top of the screen. This may take a while, please be patient.
10--> The Result tab should be highlighted. This displays the results from the import process
(Fig 3.4).
10--> Close the Importing window.
Now that the tree inventory has been
successfully imported into i-Tree Eco, we
can submit the data to the remote server,
which will process the data, deriving eco-
system services for the tree inventory. Figure 3.3 Importing tree inventory to i-Tree Eco

11--> Go to Tools > Submit Data for processing.


11--> Give the appropriate Contact Information.
11--> Press Ok to verify your contact information.
11--> Press Yes to confirm that at least 50% of the
study area is within the boundary of the city.
11--> Press Ok to the pop-up window that informs
you that the data will be processed.
Figure 3.4 Results from loading tree inventory

The data has been submitted for processing. The pro-


cessing normally does not take longer than 1 hour. Once
the processing is finished, an email will be sent that
links to your results. Figure 3.5 Loading processed data into i-Tree Eco

12--> When the results are ready, an email will be sent with a zip file name.
12--> In i-Tree Eco, go to Tools > Load Results.
12--> Open the email that was sent to you informing that the i-Tree Eco data has been
processed and is ready for download.
12--> Highlight the .zip file name (will be within the quotes).
12--> Copy and paste the file name into the pop-up window in i-Tree Eco.
12--> Press OK. Once the results are loaded, a pop-up window will appear. Press OK.
12--> Close i-Tree Eco. All of the data is now in the Tutorial_results database, which we
can access using scripts in ArcMap.

Page: 5
4. Running the Get data from iTree for displaying in ArcMap script
Now the processed inventory data is in the Tutorial_results.gdb, we can use the final tool to bring
these results back into ArcGIS to join the results with the original tree inventory shapefile.
13--> Open ArcGIS if it was closed. Bring the Full-
Inventory_Tutorial shapefile from the Tutori-
al_iTreeEco.gdb into the Table of Contents.
13--> In the itree-dbtools.tbx, double click the
script “3-Get data from iTree for displaying
in ArcMap”.
13--> Click the Open Folder button next for the
Results database field.
13--> Navigate to the folder where Tutorial_re-
sults.mdb is located. This is the database you
created when making the i-Tree Eco Project. Figure 4.1 Get data from iTree tool window

13--> Click the Open Folder button next to the Feature


filename field.
13--> Navigate to the folder where the Tutorial_iTreeEco.
gdb is located. Choose
FullInventory_Tutorial the feature class.
13--> Make sure the “Get data from iTree for displaying
in ArcMap” window looks like Figure 4.2, then click
Ok. This script takes a little while to run.
13--> If the script runs successfully, the results window
should say Succeeded (Fig 2.5). Close the window. Figure 4.2 Successful Results from Get data from iTree

If the script runs successfully, three geodatasets are produced:


FullInventory_Tutorial_IndividualtreeEffects;
FullInventory_Tutorial_IndividualTreePollutionEffects;
and FullInventory_Tutorial_IndividualtreeOtherEffects.
The feature classes contain data from the i-Tree Eco results, and are produced in the
Tutorial_FullInventory geodatabase (Fig. 4.3).

Displaying Results in ArcMap

14--> Add one of the newly created feature classes to


the Table of Contents.
14--> To view the calculated values, right click on the
added layer in the Table of Contents and open
the Attribute Table.
note: The results calculated by iTree appear as
additional columns in the geodataset.
Figure 4.2 Successful Results from Get data from iTree
To see example of the results in ArcMap, open
the visualization pdfs in the Instructions folder.

Page: 6

You might also like