Arcengine开发Network analysis services
2015-07-06 16:04 积水成渊-工大 阅读(344) 评论(0) 编辑 收藏 举报About network analysis services
The following network analysis capabilities are available through the NAServer extension to map services:
- Route—Find the best routes through a network based on a collection of stops. The analysis can take into account attributes of the network, such as restrictions that affect the streets that can be traversed. The results of the analysis include the accumulated travel time and distance and driving directions:
- Closest facility—Find the closest facilities, such as the closest hospital or automated teller machine (ATM) to a set of locations, factoring in cutoffs based on travel time, restrictions, and so on:
- Service area—Delineate service areas that fall within certain travel times of a facility, such as a place of business or emergency response facility. The resulting service areas can be analyzed to assess accessibility, competition, and other factors:
- OD Cost Matrix —With ArcGIS Network Analyst, you can create an origin-destination (OD) cost matrix from multiple origins to multiple destinations. An OD cost matrix is a table that contains the network impedance from each origin to each destination. Additionally, it ranks the destinations that each origin connects to in ascending order based on the minimum network impedance required to travel from that origin to each destination:
- Vehicle routing problem—A dispatcher managing a fleet of vehicles is often required to make decisions about vehicle routing. One such decision involves how to best assign a group of customers to a fleet of vehicles and to sequence and schedule their visits. The objectives in solving such vehicle routing problems (VRP) are to provide a high level of customer service by honoring any time windows while keeping the overall operating and investment costs for each route as low as possible. The constraints are to complete the routes with available resources and within the time limits imposed by driver work shifts, driving speeds, and customer commitments:
- Location-allocation—Location-allocation helps you choose which facilities from a set of facilities to operate based on their potential interaction with demand points. It can help you answer questions like the following:
- Given a set of existing fire stations, which site for a new fire station would provide the best response times for the community?
- If a retail company has to downsize, which stores should it close to maintain the most overall demand?
- Where should a factory be built to minimize the distance to distribution centers?
In these examples, facilities would represent the fire stations, retail stores, and factories; demand points would represent buildings, customers, and distribution centers:
These network analysis functions are based on a network analysis layer in a map. An application that includes network analysis functionality uses a MapServer that contains a network analysis layer. There is a different type of network analysis layer associated with each type of analysis.
To create an application or Web service that consumes network analysis functionality on the server, do the following steps:
You must have ArcGIS Desktop and the Network Analyst extension installed.
- Create a network dataset in ArcCatalog for your transportation data with the appropriate attributes.
- Create a map in ArcMap that contains the network dataset and network analysis layer appropriate for the type of analysis you want to include in your application (shortest route, closest facility, or service area).
- Use an ArcGIS Server administration interface, such as Manager to publish the map document as a service with the network analysis capability enabled. When you have published the service, you can consume it programmatically in a client application.
Using fine-grained NetworkAnalyst objects
It is possible to create an application that bypasses NAServer and accesses the fine-grained NetworkAnalyst objects on the server directly. When doing so, you must manage the state of the NetworkAnalyst objects so other sessions are not affected by changes to the objects. NAContext can be serialized to store the Network Analyst state information from one request to another. For example, once you have a route displayed on the map, you can continue to display that route even after the map has been panned or zoomed. For each request to your application, a process occurs to retrieve, store, copy or apply, serialize, and restore the NAContext object that has this information.
The INALayer2 interface on the NALayer object can be used in server applications to help manage the state of NALayer between sessions if it is necessary to use the fine-grained Network Analyst objects. (You do not need to use this if you are using NAServer.) Typically, during each use of a map server object (that is, each request from the Web browser), the following steps are necessary for each Network Analyst layer with which you are working:
- Copy the server's NALayer NAContext using INALayer2.CopyContext. This is your local copy of the context that your session uses.
- Apply your local NAContext using INALayer2.AttachContext before performing any network analysis. This is used to attach the server's NALayer to the specified NAContext.
- Set properties and call methods on the fine-grained NetworkAnalyst objects. You can also call methods that draw, perform spatial searches, or anything else that requires your NAContext be attached to the server's NALayer.
- When you are finished with the Web request, restore NALayer's original NAContext by calling INALayer2.AttachContext, passing in the original NAContext.