I'm creating a script tool to read the USGS earthquake GeoRSS feeds.
It works fine as a script with hardcoded values. The script also works fine as a tool for creating a new feature class for a given feed (hourly, daily, weekly possible choices).
The problem I run into is when I want to control the overwrite behavior. I want to give the user a choice: overwrite the selected feature class or append the selected feed to that feature class.
My tool has 3 parameters:
- Output File
- Feed Type: Hour, Day, Week
- Overwrite: Boolean
In the tool validation script, I disable the overwrite until the output file parameter selects a feature class that already exists. The problem is my script won't run because of the default behavior of the tool validation.
My question is how best to overcome this problem. I want it to default to letting the user just select a possibly existing feature class and append records to that feature class. If the user checks the now enabled overwrite parameter, then it should delete that feature class and build a new one at its location.
Even if allowing the overwrite possibility seems like bad programming practice, I'm still facing the problem of having an automated updating to the feature class, which is what I'm trying to make default: e.g., if they select the week feed to an hour feed they just ran, then it should give the entire week, including the hourly records it already possesses, without duplicating them--my script already handles this process; the validation is the problem.
I'm thinking that using arcpy.env.Overwrite in the validation might help?