CanoPy is the Python module for the Georgia Canopy Analysis 2009 project sponsored by the Georgia Forestry Commission (GFC). For further information about this project, please refer to the CanoPy page.
This document explains detail steps for assessing canopy using the CanoPy module and a provided sample data set. To learn more about this module, please read the user manual. For technical details, please read the technical manual.
We are currently planning on developing a fully open source solution without using ArcGIS and Feature Analyst.
The sample data will contain 3 folders titled ‘naip’, ‘data’, and ‘Outputs’. The ‘data’ folder contains the Georgia physiographic regions shapefile, the NAIP Quarter Quad (QQ) polygon shapefile in addition to the TIFF file which will be used for snapping. The ‘naip’ folder will contain 4 input QQ NAIP tiles that form a 2 x 2 area. The ‘Outputs’ folder contains the outputs that are created by Textron’s Feature Analysis software for each NAIP QQ in the sample dataset. This is included as this tutorial does NOT go over the process of using Textrons Feature Analyst but rather the process of using the CanoPy Python module.
git clone https://github.com/HuidaeCho/canopy.git
OR visit the CanoPy GitHub repository and download the zip file.
canopy_config-example.py
in the same folder and rename it to canopy_config.py
.canopy_config.py
with a text editor or python ide of your choice (ie. notepad, vim, pycharm) to recognize your layers and folder structures. In this case you will set the various paramters of canopy_config.py
as such. phyregs_layer = 'Physiographic_Districts_GA
'phyregs_area_sqkm_field = 'AREA_SQKM
'naipqq_layer = 'naip_ga_2009_1m_m4b
'naipqq_phyregs_field = 'PHYREGS
'naip_path = '…/CanoPy_sample_data/naip
'spatref_wkid = 102039
project_path = '…/CanoPy_sample_data
analysis_path_format = '%s/%%d Analysis' % project_path
analysis_year = 2009
analysis_path = analysis_path_format % analysis_year
snaprast_path = '%s/data/rm_3408504_nw_16_1_20090824.tif' % project_path
phyregs_layer
and the naip_qq
layer from the canopy_config.py file, however for them to properly be utilized by CanoPy the data must be in ArcMap for the required spatial functions to be used. import sys sys.path.append('C:/path/to/the/canopy/module') import canopy
phyreg_ids
. This is the unique identifier for each physiographic region that enables the user to decide which region to process. In this case you will be using the id [3]
which is the phyreg_id
of the Blue Ridge Mountains region. However, to first be able to use the id’s you have to add the id’s to the naipqq_layer
. To do this simply run the following code in the Python window.canopy.assign_phyregs_to_naipqq()
naipqq_layer
will now contain the naipqq_phyregs_field
which will be titled ‘PHYREGS’ in this case. Each NAIP QQ will now have the region id’s of each region it is in. canopy.assign_phyregs_to_naipqq
is to calculate the area in square kilometers of each physiographic region. The phyregs_layer
will now contain the phyregs_area_sqkm_field
which will be titled ‘AREA_SQKM’. The ‘AREA_SQKM’ field will be used with the generate_gtpoints
function. phyreg_ids = [3]
phyreg_ids = [3, 7, 15]
spatref_wkid
in canopy_config
which will be WKID-102039: USA Contiguous Albers Equal Area Conic USGS version.. Use the following code to use the reprojection functioncanopy.reproject_naip_tiles(phyreg_ids)
…/CanoPy_sample_data/2009 Analysis/Blue_Ridge_Mountains/Inputs
which will have been created by the function.…/CanoPy_sample_data/Outputs/
folder to the …/CanoPy_sample_data/2009 Analysis/Blue_Ridge_Mountains
folder. This is where the classified outputs of Textrons Feature Analyst would have been saved to be used with the rest of the CanoPy functions.canopy.convert_afe_to_canopy_tiff(phyreg_ids)
This wrapper function, titled convert_afe_to_canopy_tiff
contains three indvidual functions. These functions are
convert_afe_to_final_tiles
clip_final_tiles
mosaic_clipped_final_tiles