<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Need help refining a script, need to be able to accept user input layers in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/need-help-refining-a-script-need-to-be-able-to/m-p/417051#M32788</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(Data I am using to test is from a class project we did for the City of Mukilteo)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code so far:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
# 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")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&amp;nbsp; I have ideas but would love suggestions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Aug 2013 16:54:50 GMT</pubDate>
    <dc:creator>StephenBugge</dc:creator>
    <dc:date>2013-08-21T16:54:50Z</dc:date>
    <item>
      <title>Need help refining a script, need to be able to accept user input layers</title>
      <link>https://community.esri.com/t5/python-questions/need-help-refining-a-script-need-to-be-able-to/m-p/417051#M32788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(Data I am using to test is from a class project we did for the City of Mukilteo)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code so far:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
# 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")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&amp;nbsp; I have ideas but would love suggestions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Aug 2013 16:54:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-refining-a-script-need-to-be-able-to/m-p/417051#M32788</guid>
      <dc:creator>StephenBugge</dc:creator>
      <dc:date>2013-08-21T16:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need help refining a script, need to be able to accept user input layers</title>
      <link>https://community.esri.com/t5/python-questions/need-help-refining-a-script-need-to-be-able-to/m-p/417052#M32789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;in the code you need to get the parameter as text:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;parameter1 = arcpy.GetParameterAsText(n) ## n is the position of the parameter in the list defined below starting at 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then you add the script to ArcToolbox...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Adding_a_script_tool/00150000001r000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/Adding_a_script_tool/00150000001r000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hope this helps&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Aug 2013 19:33:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-refining-a-script-need-to-be-able-to/m-p/417052#M32789</guid>
      <dc:creator>TimDonoyou</dc:creator>
      <dc:date>2013-08-21T19:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need help refining a script, need to be able to accept user input layers</title>
      <link>https://community.esri.com/t5/python-questions/need-help-refining-a-script-need-to-be-able-to/m-p/417053#M32790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Tim,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Syntax help is great, I was starting to go that way myself it is nice to have confirmation.&amp;nbsp; I'll update and try it out and update on how it goes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Aug 2013 23:56:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-refining-a-script-need-to-be-able-to/m-p/417053#M32790</guid>
      <dc:creator>StephenBugge</dc:creator>
      <dc:date>2013-08-21T23:56:03Z</dc:date>
    </item>
  </channel>
</rss>

