Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. multival = arcpy.GetParameterAsText(1) # 'Store_1;Store_2;Store_3'
  2. vals = multival.split(";")
  3.  
  4. where_stub = """"NAME" IN ({})"""
  5. stores = ','.join(["'{}'".format(x) for x in vals])
  6. where = where_stub.format(stores)
  7.  
  8. # Import arcpy module
  9. import arcpy
  10. from arcpy import env
  11.  
  12. #workspace = GetParameterAsText (0) ???
  13. arcpy.CheckOutExtension("Network")
  14.  
  15. # Local variables:
  16. in_network_dataset = "Transportation/Streets_ND"
  17. outNALayerName = "BestRoute"
  18.  
  19.  
  20. # Process: Make Route Layer
  21. arcpy.MakeRouteLayer_na(in_network_dataset, outNALayerName, "TravelTime",
  22. "FIND_BEST_ORDER", "PRESERVE_BOTH", "", "", "ALLOW_UTURNS",
  23. "Oneway;RestrictedTurns", "", "", "", "")
  24.  
  25. # Process: Select
  26. Stores = "Stores.shp"
  27. Stores_Select = "Stores_Select_Output"
  28. Expression = arcpy.GetParameterAsText(0)
  29. vals = Expression.split(";")
  30.  
  31. where_stub = """"NAME" IN ({})"""
  32. stores = ','.join(["'{}'".format(x) for x in vals])
  33. Expression = where_stub.format(stores)
  34.  
  35.  
  36. arcpy.Select_analysis(Stores, Stores_Select, Expression)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement