Can anyone help me refine a Python Script? I'm developing a tool to generate a simulated list of Applications to a city for Cannabis Facilities authorized under Initiative 502 so that city planning staff have a chance to test application procedures before live applications start coming in.So far I have a working model using fixed files and drive locations, however I'm having some difficulty getting it to work when using user defined parameters.(Data I am using to test is from a class project we did for the City of Mukilteo)The code so far:
# Title: I-502 Cannabis Facility application simulator
# Purpose: To generate a batch of Hypothetical I-502 Applications to allow agencies to test procedures
# Author: Steve Bugge
# Required Licenses: 3D Analyst or Spatial Analyst, ARCGIS for Desktop 10.1 Advanced recommended
# Import arcpy module
import arcpy
import os
import random
from arcpy import env
from arcpy.sa import *
arcpy.CheckExtension("Spatial")
# Local variables:
Workspace = arcpy.GetParameterAsText(0)
CityLimits = arcpy.GetParamterAsText(1)
Points = arcpy.GetParameterAsText(2)
Parcels = "MukilteoAreaParcelsCurrentAPR2013"
StatCombinedExclusionZones = "StatCombinedExclusionZones"
EligibleZones = "EligibleZones"
RandomPoints = "F:\\GISPython\\I-502ApplicationSimulatorProject\\502Workspace.gdb\\RandomPoints"
MukilteoAreaParcelsCurrentAPR2013__2_ = "MukilteoAreaParcelsCurrentAPR2013"
ApplyingParcels = "F:\\GISPython\\I-502ApplicationSimulatorProject\\502Workspace.gdb\\ApplyingParcels"
ApplicationParcels = "F:\\GISPython\\I-502ApplicationSimulatorProject\\502Workspace.gdb\\ApplicationParcels"
EligibleApplications = "F:\\GISPython\\I-502ApplicationSimulatorProject\\502Workspace.gdb\\EligibleApplications"
# Process: Create Random Points
arcpy.CreateRandomPoints_management(Workspace, "RandomPoints", CityLimits, "", Points, "0 Feet", "POINT", "0")
# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Parcels, "CONTAINS", RandomPoints, "", "NEW_SELECTION")
# Process: Copy Features
arcpy.CopyFeatures_management(MukilteoAreaParcelsCurrentAPR2013__2_, ApplyingParcels, "", "0", "0", "0")
# Process: Erase
arcpy.Erase_analysis(MukilteoAreaParcelsCurrentAPR2013__2_, StatCombinedExclusionZones, ApplicationParcels, "")
# Process: Intersect
arcpy.Intersect_analysis("EligibleZones #;F:\\GISPython\\I-502ApplicationSimulatorProject\\502Workspace.gdb\\ApplicationParcels #", EligibleApplications, "ALL", "", "INPUT")
Once I get the the script to accept parameters supplied by the user I would also like to add and populate some fields with simulated data (application date, facility type, applicant name) to the final table. I have ideas but would love suggestions.