I like to build a Toolbox for the ArcGIS Network Analyst that takes a network and given addresses of a shapefile to calculate the best route.
Right now I am using the network-data of the [ArcGIS Network Analyst extension tutorial][1].
I have a shapefile with 1000 addresses, but I want to limit one route at one calculation with a maximum of 6 addresses.
Do I have to extract the addresses from the shapefile first before using the "Solve"-Tool or is there a better way?
In the end, I would like create an ArcGIS-Toolbox to have the possibility to choose the addresses with a drop-down menu for various address-lists and networks.
Right now I have the output of the Model Builder, Stores
are my Addresses:
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Python.py
# Created on: 2017-02-16 10:11:54.00000
# (generated by ArcGIS/ModelBuilder)
# Usage: Python <Routes>
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
import arcpy
# Script arguments
Routes = arcpy.GetParameterAsText(0)
if Routes == '#' or not Routes:
Routes = "Route1\\Routes" # provide a default value if unspecified
# Local variables:
Streets_ND = "F:\\Streets_ND"
Route1 = "Route1"
Route1__3_ = Route1
Pizzaladen = "Pizzaladen"
Route1__4_ = Route1__3_
Stores = "F:\\Stores"
Routes__3_ = Stores
Route__3_ = Route1__4_
Solve_Succeeded = "true"
output5_shp = "F:\\output5.shp"
# Process: Make Route Layer
arcpy.MakeRouteLayer_na(Streets_ND, "Route1", "TravelTime", "FIND_BEST_ORDER", "PRESERVE_BOTH", "USE_TIMEWINDOWS", "", "ALLOW_UTURNS", "Oneway;RestrictedTurns", "USE_HIERARCHY", "", "TRUE_LINES_WITH_MEASURES", "")
# Process: Add Locations (2)
arcpy.AddLocations_na(Route1, "Stops", Pizzaladen, "", "5000 Meters", "", "Streets SHAPE;Streets_ND_Junctions NONE", "MATCH_TO_CLOSEST", "APPEND", "NO_SNAP", "5 Meters", "INCLUDE", "Streets #;Streets_ND_Junctions #")
# Process: Add Locations
arcpy.AddLocations_na(Route1__3_, "Stops", Stores, "Name Name #;Attr_Minutes ServiceTime 0", "5000 Meters", "", "Streets SHAPE;Streets_ND_Junctions NONE", "MATCH_TO_CLOSEST", "APPEND", "NO_SNAP", "5 Meters", "INCLUDE", "Streets #;Streets_ND_Junctions #")
# Process: Solve
arcpy.Solve_na(Route1__4_, "SKIP", "TERMINATE", "")
# Process: Select Data
arcpy.SelectData_management(Route__3_, "Routes")
# Process: Copy Features
arcpy.CopyFeatures_management(Routes, output5_shp, "", "0", "0", "0")
# Process: Select Data (2)
arcpy.SelectData_management(Stores, "Routes")
Is it possible to make a selection of 6 Stores
/addresses among these Tools?