<?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: How to use the Generate Service Areas in Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485972#M37911</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it might be worthwhile emulating the script example in the help topic&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/tools/network-analyst-toolbox/generate-service-areas.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/network-analyst-toolbox/generate-service-areas.htm"&gt;Generate Service Areas—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp; where they explicitly define the variables that they are using and assign them parameter values, then you can skip the rest of the unused parameters. &amp;nbsp;It makes it much easier to read and maintain because of you miss out a parameter, then the sequence gets out of order and a value that is supposed to be for one parameter becomes assigned to its predecessor raising an error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jan 2017 20:21:12 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2017-01-25T20:21:12Z</dc:date>
    <item>
      <title>How to use the Generate Service Areas in Python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485971#M37910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to use the Generate Service Areas tool in python. I used Model Builder to fill in my perimeters and exported it to a python script. I then cleaned the code up because the tool uses barriers that are in memory. I'm using the ESRI 10.2 Streets SDC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting the error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;ExecuteError: ERROR 000622: Failed to execute (Generate Service Areas). Parameters are not valid.&lt;BR /&gt;ERROR 000800: The value is not a member of USE_HIERARCHY | NO_HIERARCHY.&lt;/P&gt;&lt;P&gt;I put breaks in the code so I could try to figure out what part had an issue. The error is thrown on line 36 which is the input that comes after Travel_Mode. In the help there are no perimeters after Travel_Mode but in ArcMap the results input shows 'Overrides:'. I'm not trying to do anything fancy just the bare bones.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciate!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code:&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;# Import arcpy module
import arcpy
arcpy.CheckOutExtension("Network")

# Local variables:
PDS1 = "Z:\\Amber\\Geocodes\\AGO\\Cert Geodatabase.gdb\\Opioid_Treatment_Program_Methadone_Clinic"
Break_Values = "30"
Break_Units = "Minutes"
streets = "Z:\\ArcGIS\\10.2\\streetmap_na\\data\\streets4"
Attribute_Parameter_Values = "Z:\ArcGIS\10.2\streetmap_na\data\Attribute_Parameter_Values.dbf"
Drive_Times = "Z:\\Amber\\Geocodes\\AGO\\Cert Geodatabase.gdb\\Drive_Times2"
Solve_Succeeded = "true"
Output_Network_Analysis_Layer = ""
restrictions = "'Driving a Passenger Car';'Avoid Service Roads';'Avoid Pedestrian Zones';'Avoid Walkways';'Avoid Roads for Authorities';'Avoid Private Roads';'Avoid Unpaved Roads';'Through Traffic Prohibited';'Avoid Express Lanes';'Avoid Carpool Roads'"
attribute = "Z:\ArcGIS\10.2\streetmap_na\data\cfcc.sdc"

# Process: Generate Service Areas
arcpy.GenerateServiceAreas_na(PDS1, Break_Values, Break_Units, streets, Drive_Times, "TRAVEL_TO", "",\
"ALLOW_UTURNS", "Time", "Minutes", "Length", "Miles", "USE_HIERARCHY",\
restrictions,\
Attribute_Parameter_Values,\
"20 Kilometers", "EXCLUDE", "\"SDC Edge Source\" #", "NO_MERGE", "RINGS", "SIMPLE_POLYS", \
"", "10 Meters", "", "", "", "", "",\
"", "", "", "", \
"NO_SAVE_OUTPUT_LAYER", \
"GEO_LOCAL", \
"CUSTOM"\
"")‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:25:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485971#M37910</guid>
      <dc:creator>AmberTobin</dc:creator>
      <dc:date>2021-12-11T21:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Generate Service Areas in Python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485972#M37911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it might be worthwhile emulating the script example in the help topic&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/tools/network-analyst-toolbox/generate-service-areas.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/network-analyst-toolbox/generate-service-areas.htm"&gt;Generate Service Areas—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp; where they explicitly define the variables that they are using and assign them parameter values, then you can skip the rest of the unused parameters. &amp;nbsp;It makes it much easier to read and maintain because of you miss out a parameter, then the sequence gets out of order and a value that is supposed to be for one parameter becomes assigned to its predecessor raising an error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2017 20:21:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485972#M37911</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-01-25T20:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Generate Service Areas in Python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485973#M37912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response. Usually I go to the code at the bottom of the help but this time there is so much added stuff in the code that it is not helpful. I've tried to take out the unused parameters but my code encounters an error and won't run.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2017 20:44:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485973#M37912</guid>
      <dc:creator>AmberTobin</dc:creator>
      <dc:date>2017-01-25T20:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Generate Service Areas in Python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485974#M37913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error message to me indicates that your parameters are out of order. &amp;nbsp;It must be looking at the value of one of your other parameters which you have accidentally put in the place where the hierarchy setting should go. &amp;nbsp;Double-check your parameter order, or (maybe easier), use explicit keywords when setting each parameter. &amp;nbsp;For example,&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;arcpy.GenerateServiceAreas_na(Facilities=PDS1, Break_Values=Break_Values, Break_Units=Break_Units, Network_Dataset=streets,&amp;nbsp;...&lt;/CODE&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I'm using the parameter names as specified in the tool documentation. &amp;nbsp;You can leave out optional parameters for which you just want the default, and the parameter order doesn't matter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2017 15:57:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485974#M37913</guid>
      <dc:creator>MelindaMorang</dc:creator>
      <dc:date>2017-01-27T15:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Generate Service Areas in Python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485975#M37914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you Dan and Melinda for your comments. I have been in contact with ESRI Support. There are a lot of parameters that are used in memory. It is matter of weening them out. Turns out that the&amp;nbsp;&lt;SPAN style="color: #4d4d4d; background-color: #ffffff;"&gt;Attribute_Parameter_Values needs to be left out because it is a record set and the python tool doesn't like it. When I ran the tool in ArcMap I found the table it was referencing and then I copied it and referenced it in my python code thinking that it could affect the shape of the service area. When I took it out the service areas drew fine (I compared it to the ones that were drawn using the tool in ArcMap). My original code left out some of the optional parameters where there was supposed to be double quotes for the barriers. I had double quotes&amp;nbsp;in originally and still had an issue. Below is my new code that works.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# -*- coding: utf-8 -*-&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# ---------------------------------------------------------------------------&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Drivetimes2.py&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Created on: 2017-01-25 12:03:06.00000&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Description: &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# ---------------------------------------------------------------------------&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Import arcpy module&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CheckOutExtension&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Network"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Local variables:&lt;/SPAN&gt;
PDS1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Z:\\Amber\\Geocodes\\AGO\\Cert Geodatabase.gdb\\Opioid_Treatment_Program_Methadone_Clinic"&lt;/SPAN&gt;
streets &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Z:\\ArcGIS\\10.2\\streetmap_na\\data\\streets"&lt;/SPAN&gt;
Break_Values &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"30"&lt;/SPAN&gt;
Break_Units &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Minutes"&lt;/SPAN&gt;
Time_Attribute &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Time"&lt;/SPAN&gt;
Time_Attribute_Units &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Minutes"&lt;/SPAN&gt;
Distance_Attribute &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Length"&lt;/SPAN&gt;
Distance_Attribute_Units &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Miles"&lt;/SPAN&gt;
Attribute_Parameter_Values &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Z:\ArcGIS\10.2\streetmap_na\data\Attribute_Parameter_Values.dbf"&lt;/SPAN&gt;
Drive_Times &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Z:\\Amber\\Geocodes\\AGO\\Cert Geodatabase.gdb\\Drive_Times2"&lt;/SPAN&gt;
Solve_Succeeded &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"true"&lt;/SPAN&gt;
Output_Network_Analysis_Layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;
restrictions &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"'Driving a Passenger Car';'Avoid Service Roads';'Avoid Pedestrian Zones';'Avoid Walkways';'Avoid Roads for Authorities';'Avoid Private Roads';'Avoid Unpaved Roads';'Through Traffic Prohibited';'Avoid Express Lanes';'Avoid Carpool Roads'"&lt;/SPAN&gt;



&lt;SPAN class="comment token"&gt;# Process: Generate Service Areas&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GenerateServiceAreas_na&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;PDS1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Break_Values&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Break_Units&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; streets&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Drive_Times&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TRAVEL_TO"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ALLOW_UTURNS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Time_Attribute&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Time_Attribute_Units&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Distance_Attribute&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Distance_Attribute_Units&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"USE_HIERARCHY"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; restrictions&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"20 Kilometers"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"EXCLUDE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\"SDC Edge Source\"&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#", "NO_MERGE", "RINGS", "SIMPLE_POLYS", "", "10 Meters", "", "", "", "", "", "", "", "", "", "NO_SAVE_OUTPUT_LAYER", "GEO_LOCAL", "CUSTOM", "")&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:25:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-the-generate-service-areas-in-python/m-p/485975#M37914</guid>
      <dc:creator>AmberTobin</dc:creator>
      <dc:date>2021-12-11T21:25:14Z</dc:date>
    </item>
  </channel>
</rss>

