<?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: od cost matrix in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28855#M2227</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;With a route layer, you can load multiple features into it to be able to solve the route. If you define the RouteName field in the route layer (in your case you could use the Hospital ID), you can solve routes between Members and the Hospital they were seen at. The only downside to this is getting the data set up correctly. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You will need 2 features to do this, a Member feature and a Hospital feature. Here's the catch, in the hospital feature, there needs to be a record for every Member. So, if you have 20 Members total, 10 are seen at Hospital a, and 10 were seen at Hospital b, the Hospital feature will need 20 record total (10 Hospital a and 10 Hospital b). You can then load each feature into the stops of the Route Layer with the RouteName field defined on Hospital ID and it will calculate the distance between each Member and the Hospital they were seen at. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are quite a few threads in the Network Analysis forums about how to use the RouteName field. I hope this makes sense and helps out.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 May 2013 14:16:23 GMT</pubDate>
    <dc:creator>BradShore1</dc:creator>
    <dc:date>2013-05-30T14:16:23Z</dc:date>
    <item>
      <title>od cost matrix</title>
      <link>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28850#M2222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have created a python script that runs an OD cost matrix over five years, from 1999 to 2004. I have set up an OD cost matrix for each year, which I think is very cumbersome. Is there someone who can show me how I do this with a loop in python (arcpy) instead of setting up the OD cost matrix for each year. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In my orgins and Destinations I also have a field called HOSPITALS. In the OD cost matrix, this field should be connected to each other so there will only be an analysis of each orgins to Destination.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;How can i do this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 11:12:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28850#M2222</guid>
      <dc:creator>Tom_AndersEngebakken</dc:creator>
      <dc:date>2013-05-28T11:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: od cost matrix</title>
      <link>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28851#M2223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would recommend a procedure and the call the procedure in a loop:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Procedure&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def odmatrix(para1, ...):
&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management (inOrgins, para1)
&amp;nbsp;&amp;nbsp; ....
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and later calling this procedure (maybe then with a loop) with the needed parameters that change.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
...
odmatrix("Pas_Lyr1999", ...)
odmatrix("Pas_Lyr2000", ...)
...
 &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that works put your parameters in a list a run a for-loop:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
listlyr ("Pas_Lyr1999", "Pas_Lyr2000",...)

for i in listlyr:
&amp;nbsp;&amp;nbsp; odmatrix (i,...)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Haven't checked the syntax really, hope that answers your questions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:09:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28851#M2223</guid>
      <dc:creator>ChristophHütt</dc:creator>
      <dc:date>2021-12-10T21:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: od cost matrix</title>
      <link>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28852#M2224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll see if I understand it. I'm completely new to python. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But how can I connect the HOSPITALS fields from orgins and Destinations together? I will see which hospital patients are admitted to, but now it is estimated that each patient is admitted to all hospitals.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 12:18:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28852#M2224</guid>
      <dc:creator>Tom_AndersEngebakken</dc:creator>
      <dc:date>2013-05-28T12:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: od cost matrix</title>
      <link>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28853#M2225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Look into using a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Route_analysis/004700000045000000/"&gt;Route layer&lt;/A&gt;&lt;SPAN&gt; instead of an OD Cost Matrix. You can you the ROUTENAME field in the Route layer to link the stops (orgins and destinations) based on Hospitals field.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 May 2013 16:15:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28853#M2225</guid>
      <dc:creator>BradShore1</dc:creator>
      <dc:date>2013-05-29T16:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: od cost matrix</title>
      <link>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28854#M2226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Brad&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did not quite understand what you meant how to do it with the route layer. Can you please explain it a little better to me?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tom Anders&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 May 2013 06:02:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28854#M2226</guid>
      <dc:creator>Tom_AndersEngebakken</dc:creator>
      <dc:date>2013-05-30T06:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: od cost matrix</title>
      <link>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28855#M2227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;With a route layer, you can load multiple features into it to be able to solve the route. If you define the RouteName field in the route layer (in your case you could use the Hospital ID), you can solve routes between Members and the Hospital they were seen at. The only downside to this is getting the data set up correctly. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You will need 2 features to do this, a Member feature and a Hospital feature. Here's the catch, in the hospital feature, there needs to be a record for every Member. So, if you have 20 Members total, 10 are seen at Hospital a, and 10 were seen at Hospital b, the Hospital feature will need 20 record total (10 Hospital a and 10 Hospital b). You can then load each feature into the stops of the Route Layer with the RouteName field defined on Hospital ID and it will calculate the distance between each Member and the Hospital they were seen at. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are quite a few threads in the Network Analysis forums about how to use the RouteName field. I hope this makes sense and helps out.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 May 2013 14:16:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/od-cost-matrix/m-p/28855#M2227</guid>
      <dc:creator>BradShore1</dc:creator>
      <dc:date>2013-05-30T14:16:23Z</dc:date>
    </item>
  </channel>
</rss>

