Arcmap Pro Cost

0 views
Skip to first unread message

Jordan Tucker

unread,
Aug 5, 2024, 9:04:54 AM8/5/24
to assulystrust
MyDEM characteristics are: GRID format, 16 bit signed integer, band 1, WGS 84 UTM zone 37N (Syria and Lebanon). I am working on a large zone, as I am trying to caclculate the least cost past between two cities around 200 km away from each other.

Now we have learned about Network Datasets and Network Analysis Layer (NA Layer) in Part 1, how to find routes from one point to another, and among multiple points in Part 2, how to generate service area in Part 3, and how to find closest facility in Part 4, let's move onto the fifth topic - how to create an Origin Destination Cost Matrix. Please refer to the road map below if you want to revisit the previous topics or jump to the next topic -


An origin-destination (OD) cost matrix from multiple origins to multiple destinations, is a table that contains the cost, such as the travel time or travel distance, from each origin to each destination. Additionally, it ranks the destinations that each origin connects to in ascending order based on the minimum cost required to travel from that origin to each destination. When generating an OD cost matrix, you can optionally specify the maximum number of destinations to find for each origin and the maximum time or distance to travel when searching for destinations (1).


The API of Generate Origin Destination Cost Matrix is useful when you need to find and measure the least-cost paths along the network from multiple origins to multiple destinations, and you can specify the number of destinations to find and a maximum distance to search. Note that, even though the OD cost matrix solver doesn't output lines that follow the network, the values stored in the Lines attribute table reflect the network distance, not the straight-line distance (2).


Fig 2. Even though the OD cost matrix solver doesn't output lines that follow the network, the values stored in the Lines attribute table reflect the network distance, not the straight-line distance. This is because by default the displaying option for the output lines in the OD Cost Matrix analysis layer is the generalized straight lines from one point to another. In doing such, the server side can save computation resources and network bandwidth in transferring. However, their cost attributes always report the least-cost network path (3).


OD cost matrix generates results more quickly but cannot return the true shapes of routes or their driving directions. It is designed to quickly solve large M x N problems and, as a result, does not internally contain the information required to generate route shapes and driving directions.


Alternatively, the closest facility solver returns routes and directions but performs the analysis more slowly than the OD cost matrix solver. If you need driving directions or true shapes of routes, use the closest facility solver; otherwise, use the OD cost matrix solver to reduce the computation time (2).


These two methods are defined in different modules of the arcgis package, and will make distinct REST calls in the back end. A key separation from network.analysis to features.use_proximity is that the former provides full capabilities of solvers and runs faster, and the latter is workflow-driven and provides service-to-service I/O approach.


Jim is an operator working for Medical Emergency Response Office, and needs to dispatch ambulance from nearby hospitals to the spot of incident. Now given the three incidents reported in Redlands and Loma Linda, is Jim able to provide an origin-destination cost matrix?


Generate Origin Destination Cost Matrix can be associated with a local network dataset or a network service hosted in ArcGIS Online or ArcGIS Enterprise. Here, we will be using an existing feature layer that contains hospitals derived from various sources (refer SOURCE field) for the Homeland Infrastructure Foundation-Level Data (HIFLD) database ( ), which can be accessed from esri_livingatlas.


If you do not have access to the hospital layer provided by Esri_livingatlas as referenced in the cell below, an alternative approach is for you to download the hospital listing of San Bernadino County from this source and publish the csv to the organization before proceeding forward.


What's worth mentioning is that, in using generate_origin_destination_cost_matrix, 0.0005 credits per input origin and destination pair will be charged. For example, if there are 100 origins and 200 destinations, the cost will be 10 credits. If you specify a cutoff or limit the number of destinations, for instance, to find only 5 closest destinations within 10 minutes of every origin, the cost will still be 10 credits, as the credits depend on the number of input origin destination pairs.


Cutoff- Specify the travel time or travel distance value at which to stop searching for destinations from the origin. Any destination beyond the cutoff value will not be considered. The value needs to be in the units specified by the Time Units parameter if the impedance attribute in your travel mode is time based or in the units specified by the Distance Units parameter if the impedance attribute in your travel mode is distance based. If a value is not specified, the tool will not enforce any travel time or travel distance limit when searching for destinations.


Specify origin_destination_line_shape to see the output in map. The resulting lines of an OD cost matrix can be represented with either straight-line geometry or no geometry at all. Even though the lines are straight for performance reasons, they always store the travel time and travel distance along the street network, not straight-line distance.


We need to change the format to get a matrix with rows as origins and columns as destinations, with impedance value as travel time or travel distance. We will use the pivot_table feature of Pandas to accomplish that.


We have been using the generate_origin_destination_cost_matrix tool in the network.analysis module up to this point. From now on, let's use a different method - connect_origins_to_destinations - defined in the features.use_proximity module, to achieve a workflow driven, Feature Service to Feature Service user experience.


Now say Jim has changed his job and become a logistics analyst for a shipping company, and he needs to look into the OD cost matrix from where his company is at (Detroit, MI) to seven other cities in the Lake Area. What would Jim do to perform his day-to-day scheduling?


Worth mentioning here is that, when measurement_type set to "StraightLine", not only the representation in the output analysis layer is a straight line, but also the calculation of distance is based off the Euclidean distance of the straight line. Unlike generate_origin_destination_cost_matrix in network.analysis, the resulting connection line is represented as generalized straight lines but the real cost paths being calculated and stored are along the network routes.


As shown here, the six routes from origin (Detroit) to destinations (Chicago, Columbus, etc.) are shown in the matrix above, with start_time, end_time, total_minutes and total_miles. We can also pivot the table, and summarize these six routes with their sole "total_minutes" attribute.


As in map4a rendered above with the origin and the destinations, we will now go on to add the routes to the map view. Note that the origin and destinations are symbolized as FeatureSet, while the resulting routes are added to the map view as Feature Layer.


In the last section of this guide, we have adopted a different method - arcgis.features.use_proximity.connect_origins_to_destinations - in creating OD cost matrix. In doing so, we also explored the two scenarios with output_name specified (which forms a Feature Service to Feature Service user experience), and a more traditional compute/parse/draw approach when output_name is not present.


This part of network Analysis Guide demonstrated how you can constuct an OD cost matrix using the ArcGIS API for Python. We started by defining origins and destinations layers, then used the generate_origin_destination_cost_matrix() method under the arcgis.network.analysis module, and/or the use_proximity.connect_origins_to_destinations() method under arcgis.features to compute the OD cost matrix.


The OD cost matrix becomes an important analytical output for downstream routing and other network analysis problems. Imagine you run a pizza restaurant and receive orders for delivery in a central location. Based on the distance to these demand points, you need to decide which supply point (pizza place) should service which demand point (customer address). You can solve problems such as these by computing the OD cost matrix.


Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse suscipit sapien ac sapien malesuada fringilla. Fusce venenatis, mauris id sagittis dapibus, mauris velit sollicitudin ante, a pulvinar leo orci vel erat. Nam mattis erat augue, at luctus ex dignissim et. Donec suscipit, dui at efficitur tristique, nulla nisi ornare lorem, vel dictum lectus eros nec felis.


The origin-destination (OD) cost matrix finds and measures the least-cost paths along a network from multiple origins to multiple destinations. The OD cost matrix analysis outputs a Lines network analysis class, which stores information about the resulting paths from the origins to the destinations. In some instances, the Name field in the Lines class attribute table displays the attributes as 'Location 1 - Location 2', 'Location 1 - Location 3', and this pattern continues depending on the total number of the origins and destinations.



The following figure shows the Lines class attribute table. The origins and destinations are named as 'Location #' consecutively in the Name field representing the resulting paths created by the OD cost matrix.


From the attribute table, it is difficult to determine which exact origin or destination is associated with a particular 'Location #' especially when there are too many network analysis objects in the Origins and Destinations classes.



All Network Analyst analyses use a Name field to uniquely identify each network element in a sub-layer (such as Origins in an OD Cost Matrix). When loading network locations into any point network analysis sub-layer, if a Name field is not specified, the analysis assigns a default name to the point locations (Location 1, Location 2, Location 3, etc).



To make the locations more readable and understandable, unique identifiers (unique names) can be assigned from a custom field when loading the points into the sub-layer.

3a8082e126
Reply all
Reply to author
Forward
0 new messages