37
Tea Crop Monitoring System and Automated ArcGIS Toolbox South Asian Urban Forum, 22 nd September 2015 Authors: Chathurthi S. De Silva & Chameera De Silva Presented By: Chathurthi S. De Silva

A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Embed Size (px)

Citation preview

Page 1: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Tea Crop Monitoring System and Automated ArcGIS Toolbox

South Asian Urban Forum, 22nd September 2015

Authors: Chathurthi S. De Silva & Chameera De SilvaPresented By: Chathurthi S. De Silva

Page 2: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Introduction

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 3: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

• For planners to thoroughly understand space, it is essential that they study the various terrain features, importantly, the vegetation cover

• This includes commercial crops, such as tea, which is commercially and taxonomically important

• However, the tea production has been stagnant and the quality declining for some time now

• This decline is mainly due to the inferior quality of technologies used by the underlying authorities

• Therefore, the aim is to propose an alternative that could be used in place of the existing labor-intensive methodologies to boost the efficiency of the tea industry

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 4: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

The Need

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 5: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

• The tea industry has faced many challenges in the past which are attributable to the inferior amount of technologies available

• Some of these challenges are:

– Inability to predict the yield generated by tea estates

– The monsoonal climate of Sri Lanka which is accompanied by alternate wet and dry seasons results in having too much and too little water for the bushes

– The large extent of tea estates makes manually monitoring the stage of growth of the tea bushes very hectic and time consuming

The solution was to develop a technologically sound system to overcome these challenges and improve the

efficiency of the industry

A computer system able to remotely monitor and analyse the tea bushes

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 6: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

System Development Process

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 7: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

• Before developing any software application, it is essential to first select a suitable Software Development Life Cycle (SDLC)

• The SDLC aims to produce high quality software that:– meets or exceeds customer expectation,– reaches completion within estimated times and cost estimates (Source - SDLC

Overview)

• There are numerous SDLCs, however, for the purpose of developing the proposed system, the Waterfall Method was followed

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 8: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

• Was the first process model to be introduced

• Very simple to understand and use

• Each phase must be completed fully before the next phase can begin

• Usually used for projects small in nature

(Source - What is Waterfall model - advantages, disadvantages and when to use it?)

General overview of the Waterfall Model

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 9: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Gathering the Requirements

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Gathering the Requirements

System Design

Testing

System Deployment

Maintenance

Page 10: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Overview of the Existing Practise: Rich Picture Analysis

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 11: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

• The primary stakeholders of the system would be ‘anyone who operates the system’

• A questionnaire was prepared and distributed among these stakeholders

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 12: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

• The results were analysed:

– to capture the users’ need

– To understand the current way of work

– To understand the facilities available

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 13: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Some Features of the SystemTestingSystem DesignGathering

RequirementsSystem Development

ProcessThe NeedIntroduction System Deployment Conclusion

Feature Yes No

Able to handle vectors and rasters

Accuracy of outputs are high

Takes in to account the user’s level of computer literacy

Able to display outputs in itself

Requires an Internet connectivity

Page 14: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Scope of the System• The system is a computer application that helps users to remotely monitor:

– the health of the tea bushes– the various growth stages of the bushes– the soil condition of the tea estates – and calculate the yield that could be generated based on the extent of the healthy tea

bushes

• Tea bushes are normally monitored twice a week. Therefore,– Landsat 7 satellite images to be used,– which have a spatial resolution of 2.4 meters,– and a temporal resolution of 16 days

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 15: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Product Perspective

• Will work when the user uploads the Landsat 7 satellite images

• It will then perform various manipulations on the inputted images

• Will display the output based on the function the user selects

• The outputs can then be saved if needed by the user• They will not be saved to a database, thus, will be

erased once the session is terminated

Tea Crop Monitoring System

An ArcGIS toolboxA Python-based stand-along software

• Consists of 5 tools for each of the processes • Here, the necessary bands of the satellite image must

be individually • After uploading the suitable bands as prompted, the

tool will then execute the underlying algorithm and display the output

• This output will be saved by default in a Microsoft Access database within the local computer enabling it to be accessed whenever needed

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 16: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

User Characteristics

• The amateurs– will use the stand-alone software– will then upload the satellite images, select the analysis they wish to carry out and click the relevant

button • The juveniles

– Would use the ArcGIS toolbox which consists of several tools. – The difference here is the particular bands that are involved in the processing need to be manually

uploaded.– As these bands differ from sensor to sensor, it will require a reasonable working knowledge of IT and

Remote Sensing

Users

Juvenile(those who can handle the basic functions of a

computer and work out a simple software based on the instructions given)

Amateurs(those who need personal assistance when

dealing with computer systems and software)

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 17: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

System Design

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Gathering the Requirements

System Design

Testing

System Deployment

Maintenance

Page 18: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

An entity-relationship diagram (ERD) is a graphical representation of an information system that shows the relationship between:

people,objects,places,

concepts or events within that system

Page 19: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

• Based on the stakeholder responses, the following ‘use case’ diagram was prepared outlining the basics of the system to be developed

• This shows the scenarios that convey how the system should interact with the end user or another system to achieve the expected goal

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 20: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

System Architecture

• The following are two modular diagrams depicting the relationships between the various modules that help achieve the complete functionality of both the system and the toolbox, consecutively

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 21: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Tea

Crop

Mon

itorin

g Sy

stem

Tea Crop Monitoring Toolbox

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 22: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Requirements Matrix Tea Crop Monitoring System 

Programming language Python Integrated Development Environment PyCharm Community Edition 4.5.1Running environment Linux Tea Crop Monitoring Toolbox 

Programming language Python Integrated Development Environment ArcGIS 10.0 Model BuilderRunning environment  WindowsDatabase type Microsoft AccessClient ArcGIS 10.0 and above

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 23: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Functional Requirements• Ability to upload satellite images, most commonly, images captured by the Landsat 7 satellite, with their relevant metadata

to the software

• Ability to perform pixel manipulations on the uploaded satellite images based on the algorithms the user provides

• Displaying the manipulated images to the user as a mosaic as well as individual bands

• Ability for the user to select what bands to display and what bands to turn off

• Generating contours and displaying on the UI when the user inputs the distance between two contour lines

• Ability to export contours into multiple formats such as .shp, .dxf etc.

• Ability to overlap multiple georeferenced rasters for comparison purposes

• Ability to export the outputs (if needed) in the .tiff format which is compatible in all image processing software

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 24: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Non-Functional Requirements• High accuracy of the outputs generated

• Proper functioning of the system under various conditions (e.g.: differences in the satellite sensors)

• Providing sufficient documentation on the usage of the software (refer user manual)

• Ability for multiple users to work concurrently

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 25: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Data DescriptionData  Format  Description

 Tea Crop Monitoring System  

Input satellite images

.imgThese are the individual bands of the satellite images which will be uploaded to the system

Output images .hdr These are the output rasters which will be generated based on the user’s command

 Tea Crop Monitoring Toolbox  

Input satellite images

.imgThese are the individual bands of the satellite images which will be uploaded to the system

 Input vector files

.shp

These are the vector files that will be inputted to the script for the purpose of executing the underlying script

 Output images .hdr/.tiff These are the output rasters which will be generated based on the user’s command

 Output vector files .shp The vector output files which will be generated by executing the tool

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 26: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Component Design

def analyze(image_files): F = image_files

if len(F)<2:print "No Sufficient images to analyze"return

b = [0]*len(F)

driver = gdal.GetDriverByName('ENVI')

tmp = gdal.Open(F[0], GA_ReadOnly)geoT = tmp.GetGeoTransform()proJ = tmp.GetProjection()del tmp

b3 = LoadFile(F[len(F)-1])print "b3 \n",b3

The Python-based Tea Crop Monitoring System

b4 = LoadFile(F[len(F)-2])print "b4 \n",b4

print "b4-b3"print (b4 - b3)

print "\nb4+b3"print (b4 + b3)

vi = (b3 - b4)/ (b4 + b3)

out = OpenArray(vi)out.SetGeoTransform(geoT)out.SetProjection(proJ)

filename = tkFileDialog.asksaveasfilename()driver.CreateCopy(filename, out)

del out, vi

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 27: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

# Import arcpy moduleimport arcpy

# Check out any necessary licensesarcpy.CheckOutExtension("spatial")

# Script argumentsRed_Band = arcpy.GetParameterAsText(0)

NIR_Band = arcpy.GetParameterAsText(1)

Output = arcpy.GetParameterAsText(2)if Output == '#' or not Output: Output = "C:\\Users\\Chathurthi De Silva\\Desktop\\Software\\Sathzyoorthey\\TeaMo Database.mdb\\Growth_Stages" # provide a default value if unspecified

# Local variables:# Process: Raster CalculatortempEnvironment0 = gp.extentarcpy.env.extent = ""tempEnvironment1 = gp.cellSizearcpy.env.cellSize = ""arcpy.gp.RasterCalculator_sa("((\"%NIR Band%\"-\"%Red Band%\")*(1.5))/(\"%NIR Band%\"+\"%Red Band%\"+0.5)", Output)arcpy.env.extent = tempEnvironment0arcpy.env.cellSize = tempEnvironment1

The Tea Crop Monitoring Toolbox – ‘Analyse Growth Stages’ Tool

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 28: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Testing

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Gathering the Requirements

System Design

Testing

System Deployment

Maintenance

Page 29: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

• The system was tested by allowing the potential users to use the system and answer a set of questions

• Their responses were assessed in terms of the extent to which the system was found satisfactory

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 30: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

System Deployment

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Gathering the Requirements

System Design

Testing

System Deployment

Maintenance

Page 31: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Implementation

• Usable upon transferring the underlying scripts to the computer

• Usable upon transferring the Tea Crop Monitoring personal geodatabase which contains the toolbox to the computer

The Python-based Tea Crop Monitoring System

The Tea Crop Monitoring Toolbox

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 32: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

The Python-based Tea Crop Monitoring System

Start-up window

The options windowThe browse windowThe user is redirected to the options windowSelecting the output to open in QGISThe output raster can be analysed further

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 33: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

The Python-based Tea Crop Monitoring System

The ArcGIS interface with the Tea Crop Monitoring Toolbox

Tools available in the toolbox

Interface of the ‘Analyse Growth Stages’ toolInterface of the ‘Monitor Crop Health’ toolInterface of the ‘Monitor the Terrain’ toolInterface of the ‘Study Soil Condition’ toolThe ArcGIS interface with the Tea Crop Monitoring Toolbox

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 34: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Conclusion

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 35: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Constraints

• Does not display the bands that have been already selected by the user for manipulation

• Once the manipulation is done and the output created, again, there is no feature to display this output to the user

• Constrained by the capacity (2GB) of the personal geodatabase in which the tools and scripts are stored

The ArcGIS toolbox

The Python-based stand-along software

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 36: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Significance of the Development• For planners to understand space and make decisions, it is essential that they study the

various terrain features, importantly, the vegetation cover

• Parameters associated with them such as the growth stages, health, soil condition, weather differences and farming practices of the vegetation will also need to be looked at, especially with regard to commercial crops

• What is proposed is a tool that can be used along with most versions of ArcGIS

• By using this, the user will be able to remotely capture the above mentioned parameter of the plantation

• The important feature here is that the entire tool is automated, which means that regardless of the user’s knowledge in ArcGIS, he or she will still be able to make use of it

TestingSystem DesignGathering Requirements

System Development ProcessThe NeedIntroduction System

Deployment Conclusion

Page 37: A Python and ArcGIS-Based Tool for Remotely Monitoring Tea Crops

Thank You!