<?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 Re: Location-Allocation failed because 'cutoff must be present for every entry in &amp;quot;Demand Points&amp;quot;' in ArcGIS Network Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-network-analyst-questions/location-allocation-failed-because-cutoff-must-be/m-p/1126957#M7726</link>
    <description>&lt;P&gt;The arcpy.nax api uses different field names that when using a layer so “Cutoff_Minutes” is not automatically used. In your scenario you can rename the input field or use a field map. Using the field map will look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Map fields&lt;/P&gt;&lt;P&gt;fieldMap_demandPoints = loc_alloc.fieldMappings(arcpy.nax.LocationAllocationInputDataType.DemandPoints)&lt;/P&gt;&lt;P&gt;fieldMap_demandPoints["Cutoff"].mappedFieldName = "Cutoff_Minutes"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Set the default value to use if the field value is null (optional)&lt;/P&gt;&lt;P&gt;fieldMap_demandPoints["Cutoff"].defaultValue = 15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Load inputs&lt;/P&gt;&lt;P&gt;loc_alloc.load(arcpy.nax.LocationAllocationInputDataType.DemandPoints, input_demand_points, fieldMap_demandPoints)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can always get the field names list if you don’t know what to map or which names will be used automatically:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;print(loc_alloc.fieldNames(arcpy.nax.LocationAllocationInputDataType.DemandPoints))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Dec 2021 21:58:01 GMT</pubDate>
    <dc:creator>JaySandhu</dc:creator>
    <dc:date>2021-12-16T21:58:01Z</dc:date>
    <item>
      <title>Location-Allocation failed because 'cutoff must be present for every entry in "Demand Points"'</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/location-allocation-failed-because-cutoff-must-be/m-p/1126564#M7722</link>
      <description>&lt;P&gt;I am trying to use the arcpy.nax.LocationAllocation() method to solve location-allocation for dozens of different scenarios. I have a demand points layer that contains a Cutoff_Minutes field. This field is populated for each of the 23,419 records within my demand points layer. However, when trying to call loc_alloc.solve() I'm getting the following error:&lt;BR /&gt;&lt;BR /&gt;"A default cutoff is required, or a cutoff must be present for every entry in 'Demand Points'"&lt;BR /&gt;&lt;BR /&gt;I have quadruple-checked my demand points layer and the Cutoff_Minutes field does not contain any NULL or missing values. I think I'm missing a way to tell the loc_alloc object how to use this field instead of the default value, which I am intentionally leaving NULL.&lt;BR /&gt;&lt;BR /&gt;Any insight is appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# An example showing how to perform location-allocation analysis using inputs from feature classes.
import arcpy
arcpy.CheckOutExtension("network")

nds = "C:/data/NorthAmerica.gdb/Routing/Routing_ND"
nd_layer_name = "Routing_ND"
input_facilities = "C:/data/io.gdb/Facilities"
input_demand_points = "C:/data/io.gdb/DemandPoints"
output_lines = "C:/data/io.gdb/AllocationLines"

# Create a network dataset layer and get the desired travel mode for analysis
arcpy.nax.MakeNetworkDatasetLayer(nds, nd_layer_name)
nd_travel_modes = arcpy.nax.GetTravelModes(nd_layer_name)
travel_mode = nd_travel_modes["Driving Time"]

# Instantiate a LocationAllocation solver object
loc_alloc = arcpy.nax.LocationAllocation(nd_layer_name)
# Set properties
loc_alloc.travelMode = travel_mode
loc_alloc.travelDirection = arcpy.nax.TravelDirection.ToFacility
loc_alloc.problemType = arcpy.nax.LocationAllocationProblemType.MaximizeCoverage
loc_alloc.timeUnits = arcpy.nax.TimeUnits.Minutes
# loc_alloc.defaultImpedanceCutoff = 15
loc_alloc.lineShapeType = arcpy.nax.LineShapeType.StraightLine
# Load inputs
loc_alloc.load(arcpy.nax.LocationAllocationInputDataType.Facilities, input_facilities)
loc_alloc.load(arcpy.nax.LocationAllocationInputDataType.DemandPoints, input_demand_points)
# Solve the analysis
result = loc_alloc.solve()

# Export the results to a feature class
if result.solveSucceeded:
    result.export(arcpy.nax.LocationAllocationOutputDataType.Lines, output_lines)
else:
    print("Solve failed")
    print(result.solverMessages(&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 04:23:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/location-allocation-failed-because-cutoff-must-be/m-p/1126564#M7722</guid>
      <dc:creator>PhilipOrlando</dc:creator>
      <dc:date>2021-12-16T04:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Location-Allocation failed because 'cutoff must be present for every entry in "Demand Points"'</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/location-allocation-failed-because-cutoff-must-be/m-p/1126825#M7723</link>
      <description>&lt;P&gt;Do you get this message if you do not leave the default value null?&lt;/P&gt;&lt;P&gt;Even if there is a default value present, the field values on the demand points take precedence. So it should be ok to set a default value if that works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jay Sandhu&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 18:13:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/location-allocation-failed-because-cutoff-must-be/m-p/1126825#M7723</guid>
      <dc:creator>JaySandhu</dc:creator>
      <dc:date>2021-12-16T18:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Location-Allocation failed because 'cutoff must be present for every entry in "Demand Points"'</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/location-allocation-failed-because-cutoff-must-be/m-p/1126854#M7724</link>
      <description>&lt;P&gt;Thank you for the reply. This error does not occur if I assign a default value. However, after investigating the results, I am seeing that none of the individual cutoff values within the demand points are actually being used. The default value is taking precedence over the Cutoff_Minutes field within my Demand Points. I think there is still an issue with how this field is being passed to the loc_alloc object when running the solve. I'm exploring using a field mappings class to explicitly tell the solver to use my Demand Points cutoff values, but I haven't made any progress yet.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 18:52:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/location-allocation-failed-because-cutoff-must-be/m-p/1126854#M7724</guid>
      <dc:creator>PhilipOrlando</dc:creator>
      <dc:date>2021-12-16T18:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Location-Allocation failed because 'cutoff must be present for every entry in "Demand Points"'</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/location-allocation-failed-because-cutoff-must-be/m-p/1126957#M7726</link>
      <description>&lt;P&gt;The arcpy.nax api uses different field names that when using a layer so “Cutoff_Minutes” is not automatically used. In your scenario you can rename the input field or use a field map. Using the field map will look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Map fields&lt;/P&gt;&lt;P&gt;fieldMap_demandPoints = loc_alloc.fieldMappings(arcpy.nax.LocationAllocationInputDataType.DemandPoints)&lt;/P&gt;&lt;P&gt;fieldMap_demandPoints["Cutoff"].mappedFieldName = "Cutoff_Minutes"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Set the default value to use if the field value is null (optional)&lt;/P&gt;&lt;P&gt;fieldMap_demandPoints["Cutoff"].defaultValue = 15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Load inputs&lt;/P&gt;&lt;P&gt;loc_alloc.load(arcpy.nax.LocationAllocationInputDataType.DemandPoints, input_demand_points, fieldMap_demandPoints)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can always get the field names list if you don’t know what to map or which names will be used automatically:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;print(loc_alloc.fieldNames(arcpy.nax.LocationAllocationInputDataType.DemandPoints))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 21:58:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/location-allocation-failed-because-cutoff-must-be/m-p/1126957#M7726</guid>
      <dc:creator>JaySandhu</dc:creator>
      <dc:date>2021-12-16T21:58:01Z</dc:date>
    </item>
  </channel>
</rss>

