<?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 Adding Line Barriers as NaLocations in ArcGIS Network Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adding-line-barriers-as-nalocations/m-p/104292#M1031</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I cant figure out how can i specify line barrier in&amp;nbsp;setPolylineBarriersByRef &amp;nbsp;of&amp;nbsp;NAServerRouteParams class,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i know it takes&amp;nbsp;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-java/api/arcobjects/com/esri/arcgis/networkanalyst/INAServerLocations.html" style="color: #21759b; background-color: #ffffff; font-size: 9pt;" title="interface in com.esri.arcgis.networkanalyst"&gt;INAServerLocations&lt;/A&gt;&amp;nbsp; but i cant figure out how to provide line in propertySet&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IPropertySet line&amp;nbsp;= new PropertySet();&lt;BR /&gt; &lt;BR /&gt;line.setProperty("paths", polyline); &amp;nbsp; // cant figure out this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IPropertySetArray pPropSets = new PropertySetArray();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pPropSets.add(&lt;SPAN&gt;line&amp;nbsp;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Setting the Server Property Sets for the Network Analysis&lt;BR /&gt; INAServerPropertySets propSets = new NAServerPropertySets();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;propSets &lt;/SPAN&gt;.setPropertySetsByRef(pPropSets);&lt;BR /&gt; &lt;BR /&gt; INAServerLocations2 serverLoc = (INAServerLocations2) &lt;SPAN&gt;propSets &lt;/SPAN&gt;;&lt;BR /&gt; return serverLoc;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 Sep 2016 18:41:47 GMT</pubDate>
    <dc:creator>Haider_Ali</dc:creator>
    <dc:date>2016-09-24T18:41:47Z</dc:date>
    <item>
      <title>Adding Line Barriers as NaLocations</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adding-line-barriers-as-nalocations/m-p/104292#M1031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I cant figure out how can i specify line barrier in&amp;nbsp;setPolylineBarriersByRef &amp;nbsp;of&amp;nbsp;NAServerRouteParams class,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i know it takes&amp;nbsp;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-java/api/arcobjects/com/esri/arcgis/networkanalyst/INAServerLocations.html" style="color: #21759b; background-color: #ffffff; font-size: 9pt;" title="interface in com.esri.arcgis.networkanalyst"&gt;INAServerLocations&lt;/A&gt;&amp;nbsp; but i cant figure out how to provide line in propertySet&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IPropertySet line&amp;nbsp;= new PropertySet();&lt;BR /&gt; &lt;BR /&gt;line.setProperty("paths", polyline); &amp;nbsp; // cant figure out this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IPropertySetArray pPropSets = new PropertySetArray();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pPropSets.add(&lt;SPAN&gt;line&amp;nbsp;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Setting the Server Property Sets for the Network Analysis&lt;BR /&gt; INAServerPropertySets propSets = new NAServerPropertySets();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;propSets &lt;/SPAN&gt;.setPropertySetsByRef(pPropSets);&lt;BR /&gt; &lt;BR /&gt; INAServerLocations2 serverLoc = (INAServerLocations2) &lt;SPAN&gt;propSets &lt;/SPAN&gt;;&lt;BR /&gt; return serverLoc;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Sep 2016 18:41:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/adding-line-barriers-as-nalocations/m-p/104292#M1031</guid>
      <dc:creator>Haider_Ali</dc:creator>
      <dc:date>2016-09-24T18:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Line Barriers as NaLocations</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adding-line-barriers-as-nalocations/m-p/104293#M1032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Haider,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The GISClient API you are referring to is deprecated since version 10.0. If you still have&amp;nbsp;to use it, the following snippet may&amp;nbsp;help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;protected INAServerPropertySets GetPolylineBarriers(int numberOfLocations2Load, double[] candidates)&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; /* Assumes that candidates is an array of doubles &lt;BR /&gt;&amp;nbsp; * which contains 3 vertices (6 double numbers) per polyline-&lt;BR /&gt;&amp;nbsp; * &lt;BR /&gt;&amp;nbsp; * 3 * (x, y)&lt;BR /&gt;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp; INAServerPropertySets res = new NAServerPropertySetsClass();&lt;BR /&gt;&amp;nbsp; res.PropertySets = new PropertySetArrayClass();&lt;/P&gt;&lt;P&gt;&amp;nbsp; for (int i = 0; i &amp;lt; numberOfLocations2Load; i++)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; res.PropertySets.Add(new PropertySetClass());&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; res.PropertySets.get_Element(i).SetProperty("Name", "Polyline " + (i + 1));&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; IPolyline pl = new PolylineClass();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; IPointCollection pcol = pl as IPointCollection;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; object missing = Type.Missing;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for (int j = 0; j &amp;lt; 3; j++)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;IPoint pnt = new PointClass();&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;int xIndex = i * 6 + j * 2;&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;pnt.X = candidates[xIndex];&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;pnt.Y = candidates[xIndex + 1];&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;pcol.AddPoint(pnt, ref missing, ref missing);&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;res.PropertySets.get_Element(i).SetProperty("Shape", pl);&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp; return res;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the other hand, if you are using a newer version of ArcGIS Server I strongly recommend using REST API instead:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Route_service_with_synchronous_execution/02r300000036000000/" title="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Route_service_with_synchronous_execution/02r300000036000000/"&gt;ArcGIS REST API&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2016 17:04:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/adding-line-barriers-as-nalocations/m-p/104293#M1032</guid>
      <dc:creator>DmitryKudinov</dc:creator>
      <dc:date>2016-09-27T17:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Line Barriers as NaLocations</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adding-line-barriers-as-nalocations/m-p/104294#M1033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks that worked, i.e. line&lt;SPAN style="background-color: #ffffff;"&gt;.setProperty("Shape", polyline); &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Actually our requirement is to get multiple alternative route &amp;nbsp;, so our solution was to use SOE to avoid multiple call to server i.e. in the SOE find the route and provide that route as barrier for next &amp;nbsp;solve route.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2016 18:16:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/adding-line-barriers-as-nalocations/m-p/104294#M1033</guid>
      <dc:creator>Haider_Ali</dc:creator>
      <dc:date>2016-09-27T18:16:59Z</dc:date>
    </item>
  </channel>
</rss>

