<?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: Adjacency matrix for network facitlities in ArcGIS Network Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79939#M756</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It will be more efficent if you wrote your own network traversal, simillar to service area but now you are in the realm of graph algorithms and yes, arcobject to access the network forward star. I would not recommend this path as it will take longer to write/debug this approach as opposed to the one day run time of the approach outlined previously.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In any case, the other approaches will still have to solve for each 30,000 origins to determine the adjacenies. There is no additional information that will say which are the adjacent locations without running a search from each origin location.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jay Sandhu&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Mar 2011 22:39:08 GMT</pubDate>
    <dc:creator>JaySandhu</dc:creator>
    <dc:date>2011-03-28T22:39:08Z</dc:date>
    <item>
      <title>Adjacency matrix for network facitlities</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79933#M750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to to generate an adjacency matrix for a set of facilities on a network. Then output should be a table where you have the facility ID in the first column, its immediate neighboring facilities in the second column, and the distance between them in the third. For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1, 2, 24.06&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1, 3, 96.33&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2, 1, 24.06&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3, 1, 148.79&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is a forum thread on a similar issue from 2008 that resolved the adjacency matrix for the nodes of the network (VB code below). I basically need to do the same thing, except for facilities on the network, not nodes. Is there some ArcObject, similar to 'network forward star', that would get to adjacencies between network facilities? I would ideally like to do this in Python, but VB ok if not feasible. All help appreciated, thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Andres&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Public Sub List_Adjacent_Junctions()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;On Error GoTo eh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim pMxDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set pMxDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim pNLayer As INetworkLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set pNLayer = pMxDoc.FocusMap.Layer(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim pND As INetworkDataset&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set pND = pNLayer.NetworkDataset&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim pNQ As INetworkQuery&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set pNQ = pND&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim pEnumNE As IEnumNetworkElement&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set pEnumNE = pNQ.Elements(esriNETJunction)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim pNEdge As INetworkEdge&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set pNEdge = pNQ.CreateNetworkElement(esriNETEdge)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim pNEFromJunc As INetworkJunction&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set pNEFromJunc = pNQ.CreateNetworkElement(esriNETJunction)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim pNEToJunc As INetworkJunction&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set pNEToJunc = pNQ.CreateNetworkElement(esriNETJunction)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim pNE As INetworkElement&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set pNE = pEnumNE.Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim pNEJunc As INetworkJunction&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set pNEJunc = pNE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; 'here start the code to store the output on a text file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim strOutputFile As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strOutputFile = "C:\my.txt"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Open strOutputFile For Output As #1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Dim i As Integer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Do Until pNE Is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 0 To pNEJunc.EdgeCount - 1&amp;nbsp; 'For each connected edge...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pNEJunc.QueryEdge i, True, pNEdge&amp;nbsp;&amp;nbsp; 'Get that connected edge&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pNEdge.QueryJunctions pNEFromJunc, pNEToJunc&amp;nbsp; 'Get To junction of current edge&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Print #1, pNEFromJunc.EID &amp;amp; ", "; pNEToJunc.EID &amp;amp; ","; pNEdge.AttributeValueByName("Length") 'List the adjacency and the edge's length&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pNE = pEnumNE.Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Exit Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Close #1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;eh:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; MsgBox "Error: " &amp;amp; Err.Description&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 00:18:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79933#M750</guid>
      <dc:creator>AndresSevtsuk</dc:creator>
      <dc:date>2011-03-28T00:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Adjacency matrix for network facitlities</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79934#M751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One more clarification - it is like creating an OD matrix between facilities, but limiting the matrix to only the first ring of neighboring facilities...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Andres&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 00:25:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79934#M751</guid>
      <dc:creator>AndresSevtsuk</dc:creator>
      <dc:date>2011-03-28T00:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adjacency matrix for network facitlities</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79935#M752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Why not use OD Cost Matrix? If you load your locations as origins and destinations and then solve for two closest. Ignore the first as that is itself and the second closest will be be closest among all others.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jay Sandhu&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 14:05:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79935#M752</guid>
      <dc:creator>JaySandhu</dc:creator>
      <dc:date>2011-03-28T14:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adjacency matrix for network facitlities</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79936#M753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jay,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks, but that won't do the trick. That would only get the one closest facility listed, what I need is all closest facilities in every direction on the network. If a facility is in a middle of a street, then there might be two closest facilities, one on either side. If a facility is near an intersections, then there might be 4, one on each branching route and so on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One very slow way of getting to this could be to&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a) solve for the nearest facility, register that facility in a table&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;b) use that facility as a point barrier, and solve again for the next closest facility, register that in a table&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;c) keep on going until no more solutions found.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Problem is that I have some 30,000+ facilities, this would take a long time... I'm looking for sth more efficient...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andres&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Why not use OD Cost Matrix? If you load your locations as origins and destinations and then solve for two closest. Ignore the first as that is itself and the second closest will be be closest among all others.&lt;BR /&gt;&lt;BR /&gt;Jay Sandhu&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 15:51:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79936#M753</guid>
      <dc:creator>AndresSevtsuk</dc:creator>
      <dc:date>2011-03-28T15:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Adjacency matrix for network facitlities</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79937#M754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Andres,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The process you described is probably the best you can do with less programming&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for the type of adjacency that you descibe.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Assuming on an average 3 adjacent locations, 30,000 times 3 is 90,000 solves. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And since these routes should be small, individual solves should happen quite quick.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So the whole process may finish in a day.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jay Sandhu&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 21:02:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79937#M754</guid>
      <dc:creator>JaySandhu</dc:creator>
      <dc:date>2011-03-28T21:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Adjacency matrix for network facitlities</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79938#M755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;you mention "with less programming"... would there be of a more efficient way involving more programming? using arc objects?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 21:34:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79938#M755</guid>
      <dc:creator>AndresSevtsuk</dc:creator>
      <dc:date>2011-03-28T21:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Adjacency matrix for network facitlities</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79939#M756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It will be more efficent if you wrote your own network traversal, simillar to service area but now you are in the realm of graph algorithms and yes, arcobject to access the network forward star. I would not recommend this path as it will take longer to write/debug this approach as opposed to the one day run time of the approach outlined previously.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In any case, the other approaches will still have to solve for each 30,000 origins to determine the adjacenies. There is no additional information that will say which are the adjacent locations without running a search from each origin location.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jay Sandhu&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 22:39:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/adjacency-matrix-for-network-facitlities/m-p/79939#M756</guid>
      <dc:creator>JaySandhu</dc:creator>
      <dc:date>2011-03-28T22:39:08Z</dc:date>
    </item>
  </channel>
</rss>

