Reading data from the CSV file and writing to the feature class
The following steps will help you to read and write data from CSV file to a write to feature class:
- The main work of a tool is done inside the
execute()
method. This is where the geoprocessing of the tool takes place. Theexecute()
method, as shown in the following code, can accept a number of arguments, including the toolsself
,parameters
, andmessages
:def execute(self, parameters, messages): """The source code of the tool.""" return
- To access the parameter values that are passed into the tool, you can use the
valueAsText()
method. Add the following code to access the parameter values that will be passed into your tool. Remember from a previous step that the first parameter will contain a reference to a CSV file that will be imported and the second parameter is the output feature class where the data will be written:def execute(self, parameters, messages): inputCSV = parameters...