public class UGCTransportationAnalystProvider extends java.lang.Object implements Disposable, ProviderContextAware, TransportationAnalystProvider
SuperMap transportation network analysis service provider.
UGCTransportationAnalystProvider provides SuperMap services related to transportation network analysis, encapsulating all the GIS functions related to transportation network analysis.
If the stops are represented by coordinates and the stops are not nodes or they are not on the edge, the transportation analyst will take the start node or the end node of the corresponding edge within the specified tolerance (See @link TransportationAnalystSetting#tolerance}) as the start node or end node for analysis. And finally, the smaller calculation value will be adopted.
The sample code using SuperMap data constructing transportation analyst service provider is as follows:
public UGCTransportationAnalystProvider buildUGCTransportationAnalystProviderSample(){ ///Construct transportation analyst environment setting TransportationAnalystSetting setting = new TransportationAnalystSetting(); //SuperMap data used, set datasource and network dataset setting.workspaceConnectString = "../data/networkanalyst/network.sxwu"; //Specify the datasource setting.datasourceName = "network"; //The network dataset specified to perform transportation analyst setting.datasetName = "netfindpath"; //Set weight information //The weight field information named CostInformation WeightFieldInfo fieldInfo1 = new WeightFieldInfo(); fieldInfo1.name = "CostInformation"; fieldInfo1.forwardWeightField = "cost"; fieldInfo1.backWeightField = "cost"; //The weight field information named LengthInformateion WeightFieldInfo fieldInfo2 = new WeightFieldInfo(); fieldInfo2.name = "LengthInformateion"; fieldInfo2.forwardWeightField = "smLength"; fieldInfo2.backWeightField = "smLength"; //Construct a available weight information set WeightFieldInfo[] weightFieldInfos=new WeightFieldInfo[]{fieldInfo1,fieldInfo2}; //Set weight information setting.weightFieldInfos = weightFieldInfos; //Set the distance tolerance between the node and the edge. setting.tolerance = 0.01; //Set the field name which represents the arcs’ ID setting.edgeIDField="SmEdgeID"; //Set the field name which represents the arcs’ name setting.edgeNameField="SmEdgeID"; //Set the field name which represents the nodes’ ID setting.nodeIDField="SmNodeID"; //Set the field name which represents the nodes’ name setting.nodeNameField="NodeLabel"; //The field name which represents the start node ID of the edge setting.fromNodeIDField="smFNode"; //The field name which represents the end node ID of the edge setting.toNodeIDField="SmTNode"; //Set turn table TurnDatasetInfo turnDatasetInfo = new TurnDatasetInfo(); turnDatasetInfo.workspaceConnectString = "../data/networkanalyst/network.sxwu"; turnDatasetInfo.datasourceName = "network"; turnDatasetInfo.datasetName = "netfindpath_TRN"; turnDatasetInfo.fromEdgeIDField = "FEdgeID"; turnDatasetInfo.toEdgeIDField = "TEdgeID"; turnDatasetInfo.nodeIDField = "NodeID"; turnDatasetInfo.weightFields = new String[]{"TurnCost","TurnCost2"}; turnDatasetInfo.workspaceType = "SXWU"; setting.turnDatasetInfo=turnDatasetInfo; ///Construct SuperMap transportation analyst provider by using transportation analysis environment settings UGCTransportationAnalystProvider analystProvider = new UGCTransportationAnalystProvider(setting); return analystProvider; }
Constructor and Description |
---|
UGCTransportationAnalystProvider()
The constructor.
|
UGCTransportationAnalystProvider(TransportationAnalystSetting setting)
Constructs a
UGCTransportationAnalystProvider object through transportation analyst setting. |
UGCTransportationAnalystProvider(TransportationAnalystSetting setting, UGCDataProvider provider)
Constructs a
UGCTransportationAnalystProvider object according to the transportation analyst setting and the SuperMap data service provider object. |
Modifier and Type | Method and Description |
---|---|
BurstAnalyseResult |
burstAnalyseFromEdge(int[] sourceNodeIDs, int edgeID, FacilityAnalystParameter parameter) |
BurstAnalyseResult |
burstAnalyseFromNode(int[] sourceNodeIDs, int nodeID, FacilityAnalystParameter parameter) |
static TransportationCheckUtil.CheckNetworkResult |
check(TransportationAnalystSetting setting) |
double[][] |
computeWeightMatrix(int[] nodeIDs, TransportationAnalystParameter parameter)
Gets a cost matrix according to transportation analyst parameter.
|
double[][] |
computeWeightMatrix(Point2D[] points, TransportationAnalystParameter parameter)
Gets a cost matrix according to point coordinates and the transportation analyst parameter.
|
protected UGCDataProvider |
createDataProvider(TransportationAnalystSetting config) |
protected TransportationAnalyst |
createTransportationAnalyst()
Creates a new TransportationAnalyst object of SuperMap Objects Java.
|
protected com.supermap.analyst.networkanalyst.TransportationAnalystSetting |
createUGOSetting()
Gets the default TransportationAnalystSetting object of SuperMap Object Java.
|
protected com.supermap.analyst.networkanalyst.TransportationAnalystSetting |
createUGOSettingForCheck(com.supermap.analyst.networkanalyst.TransportationAnalystSetting ugoSetting) |
void |
dispose()
Releases resources that the SuperMap transportation analyst service provider occupies.
|
ClosestFacilityPaths<java.lang.Integer> |
findClosestFacility(int[] facilityIDs, int event, int expectFacilityCount, boolean fromEvent, double maxWeight, TransportationAnalystParameter parameter)
Closest facility analysis, in which events are represented by network node IDs.
|
ClosestFacilityPaths<Point2D> |
findClosestFacility(Point2D[] facilityPoints, Point2D event, int expectFacilityCount, boolean fromEvent, double maxWeight, TransportationAnalystParameter parameter)
Closest facility analysis, in which events are represented by point coordinates.
|
FacilityAnalyst2DResult |
findConnectedEdgesFromEdges(int[] edgeIDs, boolean returnFeatures, boolean connected)
Finds the connected edges for the edges specified with ID array.
|
FacilityAnalyst2DResult |
findConnectedEdgesFromNodes(int[] nodeIDs, boolean returnFeatures, boolean connected)
Finds the connected or unconnected edges for the nodes specified with ID array.
|
FacilityAnalyst2DResult |
findCriticalFacilitiesDownFromEdge(int[] sourceNodeIDs, int edgeID, FacilityAnalystParameter parameter) |
FacilityAnalyst2DResult |
findCriticalFacilitiesDownFromNode(int[] sourceNodeIDs, int nodeID, FacilityAnalystParameter parameter) |
FacilityAnalyst2DResult |
findCriticalFacilitiesUpFromEdge(int[] sourceNodeIDs, int edgeID, FacilityAnalystParameter parameter) |
FacilityAnalyst2DResult |
findCriticalFacilitiesUpFromNode(int[] sourceNodeIDs, int nodeID, FacilityAnalystParameter parameter) |
LocationAnalystResult |
findLocation(LocationAnalystParameter parameter)
The location-allocation analysis.
|
MTSPPaths<java.lang.Integer> |
findMTSPPath(int[] nodeIDs, int[] centerIDs, boolean hasLeastTotalCost, TransportationAnalystParameter parameter)
The multiple traveling salesmen analysis (logistics).
|
MTSPPaths<Point2D> |
findMTSPPath(Point2D[] points, Point2D[] centers, boolean hasLeastTotalCost, TransportationAnalystParameter parameter)
The multiple traveling salesmen analysis (logistics).
|
Paths |
findPath(int[] nodeIDs, boolean hasLeastEdgeCount, TransportationAnalystParameter parameter)
Optimal path analysis.
|
Paths |
findPath(Point2D[] points, boolean hasLeastEdgeCount, TransportationAnalystParameter parameter)
Optimal path analysis.
|
ServiceAreaResults<java.lang.Integer> |
findServiceArea(int[] centerIDs, double[] weights, boolean isFromCenter, boolean isCenterMutuallyExclusive, TransportationAnalystParameter parameter)
The service area analysis.
|
ServiceAreaResults<Point2D> |
findServiceArea(Point2D[] centerPoints, double[] weights, boolean isFromCenter, boolean isCenterMutuallyExclusive, TransportationAnalystParameter parameter)
The service area analysis.
|
TSPPaths |
findTSPPath(int[] nodeIDsToVisit, boolean endNodeAssigned, TransportationAnalystParameter parameter)
The traveling salesmen analysis.
|
TSPPaths |
findTSPPath(Point2D[] pointsToVisit, boolean endNodeAssigned, TransportationAnalystParameter parameter)
The traveling salesmen analysis.
|
java.lang.String |
getNetworkDataName()
Gets the network data name.
|
PrjCoordSys |
getPrjCoordSys()
Gets the projection information of specified network data.
|
java.lang.String[] |
getTurnWeightNames()
Gets the turn weight field name list of network data.
|
java.lang.String[] |
getWeightNames()
Gets the edge weight field name list of network data.
|
protected TransportationAnalyst |
init(com.supermap.services.providers.SettingChecked settingChecked)
Initializes UGCTransportationAnalystProvider.
|
protected com.supermap.analyst.networkanalyst.FacilityAnalyst |
initFacilityAnalyst(com.supermap.services.providers.SettingChecked settingChecked) |
void |
pauseForRefreshWorkspace()
Prevents the request to refresh the workspace.
|
void |
refreshWorkspace()
Refreshes the workspace.
|
void |
refreshWorkspaceFinished()
Continues the request after finishing refreshing the workspace.
|
boolean |
reloadModel()
Reloads the network model.
|
protected int[] |
removeRepeat(int[] nodeIDsToVisit) |
void |
setProviderContext(ProviderContext context)
Sets the transportation analyst service provider context.
|
FacilityAnalyst2DResult |
traceDownFromEdge(int edgeID, FacilityAnalystParameter parameter)
Traces down with the specified edge ID, ie., finding the downstream of the specified edge, and returning the edges and nodes the downstream includes and the total cost
|
FacilityAnalyst2DResult |
traceDownFromNode(int nodeID, FacilityAnalystParameter parameter)
Traces down with the specified node ID, ie., finding the downstream of the specified node, and returning the edges and nodes the downstream includes and the total cost
|
FacilityAnalyst2DResult |
traceUpFromEdge(int edgeID, FacilityAnalystParameter parameter)
Traces up with the specified edge ID, ie., finding the upstream of the specified edge, and returning the edges and nodes the upstream includes and the total cost
|
FacilityAnalyst2DResult |
traceUpFromNode(int nodeID, FacilityAnalystParameter parameter)
Traces up with the specified node ID, ie., finding the upstream of the specified node, and returning the edges and nodes the upstream includes and the total cost
|
double |
updateEdgeWeight(int edgeID, int fromNodeID, int toNodeID, java.lang.String weightField, double weight)
Updates the edge weight.
|
double |
updateTurnNodeWeight(int nodeID, int fromEdgeID, int toEdgeID, java.lang.String turnWeightField, double weight)
Updates the weight of turn node.
|
public UGCTransportationAnalystProvider()
The constructor.
public UGCTransportationAnalystProvider(TransportationAnalystSetting setting)
Constructs a UGCTransportationAnalystProvider
object through transportation analyst setting.
setting
- The TransportationAnalystSetting object.public UGCTransportationAnalystProvider(TransportationAnalystSetting setting, UGCDataProvider provider)
Constructs a UGCTransportationAnalystProvider
object according to the transportation analyst setting and the SuperMap data service provider object.
setting
- The TransportationAnalystSetting object.provider
- The UGCDataProvider object.public double[][] computeWeightMatrix(int[] nodeIDs, TransportationAnalystParameter parameter)
Gets a cost matrix according to transportation analyst parameter.
The matrix is a 2D double array used to store the resource cost between any two points. The target points and weight fields to calculate the cost matrix is specified with parameter.
The sample is as follows, for the constructing of SuperMap transportation analyst service provider, please refer to buildUGCTransportationAnalystProviderSample.
public double[][] computeWeightMatrixSample(){ //The process of constructing UGCTransportationAnalystProvider, see: buildUGCTransportationAnalystProviderSample. UGCTransportationAnalystProvider analystProvider=buildUGCTransportationAnalystProviderSample(); ///Construct transportation analyst parameter object, ie., the information needed to calculate the cost matrix TransportationAnalystParameter analystParameter = new TransportationAnalystParameter(); //Set the target point array used to calculate the cost matrix int[] nodeIDs = new int[]{1,5,10,20}; //Set the weightFieldName for calculating the cost matrix, it must be contained in the transportation analyst environment analystParameter.weightFieldName="CostInformation"; //Set turnWeightField, it must be a field set in the transportation analyst environment analystParameter.turnWeightField="TurnCost"; //Use transportation analyst parameter and perform cost matrix calculation double[][] matrix=analystProvider.computeWeightMatrix(nodeIDs, analystParameter); return matrix; }
computeWeightMatrix
in interface TransportationAnalystProvider
parameter
- The transportation analyst parameter, which is used to specify the target points collection, weight fields and other information to calculate the cost matrix. See TransportationAnalystParameter
class.nodeIDs
- The ID set of the points used to calculate the cost matrix.public double[][] computeWeightMatrix(Point2D[] points, TransportationAnalystParameter parameter)
Gets a cost matrix according to point coordinates and the transportation analyst parameter.
The matrix is a 2D double array used to store the resource cost between any two points. The target points and weight fields to calculate the cost matrix is specified with parameter.
computeWeightMatrix
in interface TransportationAnalystProvider
points
- The points to calculate the cost matrix.parameter
- The transportation analyst parameter, which is used to specify the target points collection, weight fields and other information to calculate the cost matrix. See TransportationAnalystParameter
class.public ClosestFacilityPaths<java.lang.Integer> findClosestFacility(int[] facilityIDs, int event, int expectFacilityCount, boolean fromEvent, double maxWeight, TransportationAnalystParameter parameter)
Closest facility analysis, in which events are represented by network node IDs.
The closest facility analysis is to find one or more facilities to which the cost from the event point is the least among the given event point and a set of facilities. The result is the optimal path from the event point to the facility (or from the facility to the event point).
For example: A traffic accident happens in the street, and we need to find out hospitals that are able to be reached within 10 minutes, with hospitals out of 10 minutes' ride out of consideration.In this instance, the accident location is an event, the hospitals around are the facilities.
In the closest facility analysis, there are two methods to specify the event.One is to specify according to the coordinates, and the other one is to specify according to network node ID, ie., specify the network node as the event. This method specifies the event by using node ID.
findClosestFacility
in interface TransportationAnalystProvider
facilityIDs
- The facility node ID array. Required.event
- The event node ID. Required.expectFacilityCount
- The amount of the expected facilities to search. Optional. The default value is 1.fromEvent
- Whether to start the search from the event. Optional. The default value is false.maxWeight
- The maximum limit value of weight. Required. It has the same unit as the weight field in parameter (the general parameter for transportation network analysis). If the search is based on the entire network, set this parameter to 0.networkDataName
- Required, used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.parameter
- The common parameter for setting transportation network analysis. It's optional, and uses the settings of TransportationAnalystSetting by default.public ClosestFacilityPaths<Point2D> findClosestFacility(Point2D[] facilityPoints, Point2D event, int expectFacilityCount, boolean fromEvent, double maxWeight, TransportationAnalystParameter parameter)
Closest facility analysis, in which events are represented by point coordinates.
The closest facility analysis is to find one or more facilities to which the cost from the event point is the least among the given event point and a set of facilities. The result is the optimal path from the event point to the facility (or from the facility to the event point).
For example: A traffic accident happens in the street, and we need to find out hospitals that are able to be reached within 10 minutes, with hospitals out of 10 minutes' ride out of consideration.In this instance, the accident location is an event, the hospitals around are the facilities.
In the closest facility analysis, there are two methods to specify the event.One is to specify according to the coordinates, and the other one is to specify according to network node ID, ie., specify the network node as the event. This method specifies the event by using coordinate of point.
findClosestFacility
in interface TransportationAnalystProvider
facilityPoints
- The coordinate points array representing facilities. Required.event
- The coordinate point representing event. Required.expectFacilityCount
- The amount of the expected facilities to search. Optional. The default value is 1.fromEvent
- Whether to start the search from the event. Optional. The default value is false.maxWeight
- The maximum limit value of weight. Required. It has the same unit as the weight field in parameter (the general parameter for transportation network analysis). If the search is based on the entire network, set this parameter to 0.networkDataName
- Required, used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.parameter
- The common parameter for setting transportation network analysis. It's optional, and uses the settings of TransportationAnalystSetting by default.public MTSPPaths<java.lang.Integer> findMTSPPath(int[] nodeIDs, int[] centerIDs, boolean hasLeastTotalCost, TransportationAnalystParameter parameter)
The multiple traveling salesmen analysis (logistics). The logistics center is represented by the ID array of network nodes.
The multiple traveling salesmen analysis is also called logistics. It means with the M centers and N destinations (M, N are both greater than 0) in network dataset, to find the economic and effective delivering path from the supply center to destination, and show the corresponding walk path.
Logistics refers to the problem that how to determine the order of the destinations to be delivered and the best route so as to minimize the total cost of the route.
The MTSP result will list each distribution center and its delivery destinations, the order of the delivery for the destinations and the delivery routes. So as to make the delivery cost for each center at a average level, or minimize the total cost of all the centers.
findMTSPPath
in interface TransportationAnalystProvider
nodeIDs
- The destination node ID array. Required.centerIDs
- The ID array of the supply centers. Required.hasLeastTotalCost
- Whether the delivery solution has the least total cost. Optional. The default is false, indicating to adopt the locally optimal solution. If set to true, the solution with the least total cost will be adopted.
In the solution with the least total cost, the cost of certain supply centers may be far more than some other supply centers. The locally optimal cost solution balances the cost of all supply centers to make them have similar cost, but the total cost may not be the least.
networkDataName
- Required, used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.parameter
- The common parameter for setting transportation network analysis. It's optional, and uses the settings of TransportationAnalystSetting by default.public MTSPPaths<Point2D> findMTSPPath(Point2D[] points, Point2D[] centers, boolean hasLeastTotalCost, TransportationAnalystParameter parameter)
The multiple traveling salesmen analysis (logistics). The logistics center is represented by the coordinates of network nodes.
The multiple traveling salesmen analysis is also called logistics. It means with the M centers and N destinations (M, N are both greater than 0) in network dataset, to find the economic and effective delivering path from the supply center to destination, and show the corresponding walk path.
Logistics refers to the problem that how to determine the order of the destinations to be delivered and the best route so as to minimize the total cost of the route.
The MTSP result will list each distribution center and its delivery destinations, the order of the delivery for the destinations and the delivery routes. So as to make the delivery cost for each center at a average level, or minimize the total cost of all the centers.
findMTSPPath
in interface TransportationAnalystProvider
points
- The points array of the destinations represented by coordinates. Required.centerIDs
- The points array of the supply centers represented by coordinates. Required.hasLeastTotalCost
- Whether the delivery solution has the least total cost. The default is false, indicating to adopt the locally optimal solution. If set to true, the solution with the least total cost will be adopted.
In the solution with the least total cost, the cost of certain supply centers may be far more than some other supply centers. The locally optimal cost solution balances the cost of all supply centers to make them have similar cost, but the total cost may not be the least.
networkDataName
- Required, used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.parameter
- The common parameter for setting transportation network analysis. It's optional, and uses the settings of TransportationAnalystSetting by default.public Paths findPath(int[] nodeIDs, boolean hasLeastEdgeCount, TransportationAnalystParameter parameter)
Optimal path analysis.
The optimal path analysis aims at finding out the path with the minimum impedance in the network dataset with the given N points (N is greater than 2). The "minimum impedance" can refer to the shortest time, the minimum cost, the best scenery, the best road condition, passing the least bridges, passing the least toll-stations, passing the most countries, etc.
This method returns a path with the minimum impedance passing all the N points in a certain order.
Similarities and differences between optimal path analysis and traveling salesmen analysis:
#findPath(Point2D[],boolean,String,TransportationAnalystParameter)
method.findPath
in interface TransportationAnalystProvider
nodeIDs
- The node ID array to pass through. This parameter is required.hasLeastEdgeCount
- Whether the path has the least edges. This parameter is optional. The default is false.
networkDataName
- Required, used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.parameter
- The common parameter for setting transportation network analysis. It's optional, and uses the settings of TransportationAnalystSetting by default.public Paths findPath(Point2D[] points, boolean hasLeastEdgeCount, TransportationAnalystParameter parameter)
Optimal path analysis.
The optimal path analysis aims at finding out the path with the minimum impedance in the network dataset with the given N points (N is greater than 2). The "minimum impedance" can refer to the shortest time, the minimum cost, the best scenery, the best road condition, passing the least bridges, passing the least toll-stations, passing the most countries, etc.
This method returns a path with the minimum impedance passing all the N points in a certain order.
Similarities and differences between optimal path analysis and traveling salesmen analysis:
#findTSPPath(String,String,TransportationAnalystParameter,boolean)
.findPath
in interface TransportationAnalystProvider
points
- The point array to pass through. This parameter is required.hasLeastEdgeCount
- Whether the path has the least edges. This parameter is optional. The default is false.
networkDataName
- Required, used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.parameter
- The common parameter for setting transportation network analysis. It's optional, and uses the settings of TransportationAnalystSetting by default.public ServiceAreaResults<java.lang.Integer> findServiceArea(int[] centerIDs, double[] weights, boolean isFromCenter, boolean isCenterMutuallyExclusive, TransportationAnalystParameter parameter)
The service area analysis.
The service area analysis is to find the area the supply center serves in the network.
Service area: The area contains all the accessible edges and nodes, with the specified point as the center. In short, it is the area that a supply location of a specific service serves.
Service area analysis: Calculates the service area for a specified point in the network. For instance, we can calculate the 30-minute service area for a point in the network. In this result service area, the time cost from the point to any point in the service area will be less than 30 minutes.
The following image shows what is the service area analysis result like and what problems the service area analysis solves. The blue circles in the figure below represent the supply center that supplies services. Areas in different colors are service areas of the supply center with different impedances.
findServiceArea
in interface TransportationAnalystProvider
centerIDs
- The center ID array. This parameter is required.weights
- The service radius collection. This parameter is required. The collection size is the same as the center count. This parameter identifies the value range that used in the service area analysis. If we set weights[0] to 30.0, it indicates that it shouldn't take more than 30 minutes to get to the 1st supply center from any points of the service area of the 1st point.isFromCenter
- whether to analyze from the supply center point. The parameter is optional. The default is false, which means the analysis doesn't start from the center point.
Whether to analyze from the center point shows the relation mode between the supply center and the demand points. If the analysis starts from the supply center, it means the supply center actively delivers services to demand points. If the analysis doesn't start from the supply center, the demand point actively gets the services from the supply center and the supply center passively provides the services
For instance, when analyzing the service area of a milk station, isFromCenter needs to be set to true because the milk station actively sends milk to residents. However, when analyzing the service area of a school, isFromCetner needs to be set to false because students actively come to the school to have classes every day.
isCenterMutuallyExclusive
- Whether the service areas are mutually exclusive. This parameter is optional. The default is false, which means service areas are not mutually exclusive. If set to true, overlapping service areas will be handled. Note: Supply center mutual exclusion is not supported currently.
Below shows the effects before and after exclusion handling.
A result without no-overlay processing | A result after overlay processing |
networkDataName
- Required, used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.parameter
- The common parameter for setting transportation network analysis. It's optional, and uses the settings of TransportationAnalystSetting by default.public ServiceAreaResults<Point2D> findServiceArea(Point2D[] centerPoints, double[] weights, boolean isFromCenter, boolean isCenterMutuallyExclusive, TransportationAnalystParameter parameter)
The service area analysis.
The service area analysis is to find the area the supply center serves in the network.
Service area: The area contains all the accessible edges and nodes, with the specified point as the center. In short, it is the area that a supply location of a specific service serves.
Service area analysis: Calculates the service area for a specified point in the network. For instance, we can calculate the 30-minute service area for a point in the network. In this result service area, the time cost from the point to any point in the service area will be less than 30 minutes.
The following image shows what is the service area analysis result like and what problems the service area analysis solves. The blue circles in the figure below represent the supply center that supplies services. Areas in different colors are service areas of the supply center with different impedances.
findServiceArea
in interface TransportationAnalystProvider
centerPoints
- The points array of the service centers represented by coordinates. Required.weights
- The service radius collection. This parameter is required. The collection size is the same as the center count. This parameter identifies the value range that used in the service area analysis. If we set weights[0] to 30.0, it indicates that it shouldn't take more than 30 minutes to get to the 1st supply center from any points of the service area of the 1st point.isFromCenter
- whether to analyze from the supply center point. The parameter is optional. The default is false, which means the analysis doesn't start from the center point.
Whether to analyze from the center point shows the relation mode between the supply center and the demand points. If the analysis starts from the supply center, it means the supply center actively delivers services to demand points. If the analysis doesn't start from the supply center, the demand point actively gets the services from the supply center and the supply center passively provides the services
For instance, when analyzing the service area of a milk station, isFromCenter needs to be set to true because the milk station actively sends milk to residents. However, when analyzing the service area of a school, isFromCetner needs to be set to false because students actively come to the school to have classes every day.
isCenterMutuallyExclusive
- Whether the service areas are mutually exclusive. This parameter is optional. The default is false, which means service areas are not mutually exclusive. If set to true, overlapping service areas will be handled. Note: Supply center mutual exclusion is not supported currently.
Below shows the effects before and after exclusion handling.
A result without no-overlay processing | A result after overlay processing |
networkDataName
- Required, used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.parameter
- The common parameter for setting transportation network analysis. It's optional, and uses the settings of TransportationAnalystSetting by default.public TSPPaths findTSPPath(int[] nodeIDsToVisit, boolean endNodeAssigned, TransportationAnalystParameter parameter)
The traveling salesmen analysis.
The traveling salesmen analysis is to find out the path that passes a specified set of points, with the least (or almost least) impedance. The order of passing those points are not fixed and is decided through the analysis.
In traveling salesmen analysis, if the end node is specified, the traveling salesmen must access the end node last. The access order of other nodes is determined by the traveling salesmen.
The passing points needed to be visited are specified by using nodeI|DsToVisit parameter, of which the first node is the starting point for the traveling salesman.
Similarities and differences between optimal path analysis and traveling salesmen analysis:
#findPath(Point2D[],boolean,String,TransportationAnalystParameter)
.findTSPPath
in interface TransportationAnalystProvider
nodeIDsToVisit
- The node ID array to pass through. This parameter is required.endNodeAssigned
- Whether to assign the end node, which is an optional parameter. The default is false. If it is true, it represents assigning the end node. The traveling salesmen must access the end node, i.e., the last passing point.networkDataName
- Required, used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.parameter
- The common parameter for setting transportation network analysis. It's optional, and uses the settings of TransportationAnalystSetting by default.protected int[] removeRepeat(int[] nodeIDsToVisit)
public TSPPaths findTSPPath(Point2D[] pointsToVisit, boolean endNodeAssigned, TransportationAnalystParameter parameter)
The traveling salesmen analysis.
The traveling salesmen analysis is to find out the path that passes a specified set of points, with the least (or almost least) impedance. The order of passing those points are not fixed and is decided through the analysis.
In traveling salesmen analysis, if the end node is specified, the traveling salesmen must access the end node last. The access order of other nodes is determined by the traveling salesmen.
The passing points needed to be visited are specified by using nodeI|DsToVisit parameter, of which the first node is the starting point for the traveling salesman.
Similarities and differences between optimal path analysis and traveling salesmen analysis:
#findPath(Point2D[],boolean,String,TransportationAnalystParameter)
.findTSPPath
in interface TransportationAnalystProvider
pointsToVisit
- The coordinate point array to pass through. This parameter is required.endNodeAssigned
- Whether to assign the end node, which is an optional parameter. The default is false. If it is true, it represents assigning the end node. The traveling salesmen must access the end node, i.e., the last passing point.networkDataName
- Required, used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.parameter
- The common parameter for setting transportation network analysis. It's optional, and uses the settings of TransportationAnalystSetting by default.public java.lang.String getNetworkDataName()
Gets the network data name.
getNetworkDataName
in interface TransportationAnalystProvider
public PrjCoordSys getPrjCoordSys()
Gets the projection information of specified network data.
getPrjCoordSys
in interface TransportationAnalystProvider
networkDataName
- Used to uniquely identify the network dataset. It is one of elements of the array returned by #getNetworkDataNames()
.protected TransportationAnalyst init(com.supermap.services.providers.SettingChecked settingChecked)
Initializes UGCTransportationAnalystProvider. Namely, getting the TransportationAnalyst object of SuperMap Objects Java according to the transportation analyst environment setting and used for transportation analyst.
settingChecked
- Tansportation analyst environment settingprotected com.supermap.analyst.networkanalyst.FacilityAnalyst initFacilityAnalyst(com.supermap.services.providers.SettingChecked settingChecked)
protected com.supermap.analyst.networkanalyst.TransportationAnalystSetting createUGOSettingForCheck(com.supermap.analyst.networkanalyst.TransportationAnalystSetting ugoSetting)
protected com.supermap.analyst.networkanalyst.TransportationAnalystSetting createUGOSetting()
Gets the default TransportationAnalystSetting object of SuperMap Object Java.
protected TransportationAnalyst createTransportationAnalyst()
Creates a new TransportationAnalyst object of SuperMap Objects Java.
public void dispose()
Releases resources that the SuperMap transportation analyst service provider occupies.
dispose
in interface Disposable
public void setProviderContext(ProviderContext context)
Sets the transportation analyst service provider context.
setProviderContext
in interface ProviderContextAware
context
- The transportation analyst service provider context.protected UGCDataProvider createDataProvider(TransportationAnalystSetting config)
public LocationAnalystResult findLocation(LocationAnalystParameter parameter)
The location-allocation analysis.
The location-allocation analysis is to determine one or more best or optimal positions to build facilities, which makes facilities use one of the most economic and efficient way to provide service or commodity. Location-Allocation is not only o find the best locations, it also needs to consider how many resource each location should provide based on the demands. So it's called Location-Allocation.
In location-allocation analysis, the SupplyCenter and analysis model are set with LocationAnalystParameter. Please see LocationAnalystParameter
class for more detailes.
In location-allocation analysis, all demand points are network nodes. Except for the network nodes corresponding to the supply center points, all network nodes demand points. To exclude certain network nodes, you can set the nodes as barriers.
Example: 7 post offices will be built in an area with 15 candidate locations, represented by blue rectangles in the figure 1 below, that has no post offices. Which locations will be selected to build post offices depending on the following two conditions: no more than 30 minutes by walk for residents and the amount of residents a post office can serve is limited. Based on the two conditions, location-allocation analysis will give optimal locations and points out the service area of each post office. As shown is the figure 2 below, the red points represent the 7 selected locations for setting up post offices.
Note: All network nodes of the following two network datasets are regarded as the residential areas and will participate in the location-allocation analysis. The resident number in the residential area is the amount of services the residential area needs.
Figure 1. A diagram of network dataset to analyze and 15 candidate center points
Figure 2. A diagram of the location-allocation analysis result
The sample is as follows, for the constructing of SuperMap transportation analyst service provider, please refer to buildUGCTransportationAnalystProviderSample.
public LocationAnalystResult findLocationSample(){ //The process of constructing UGCTransportationAnalystProvider, see: buildUGCTransportationAnalystProviderSample. UGCTransportationAnalystProvider analystProvider=buildUGCTransportationAnalystProviderSample(); ///Construct transportation analyst parameter object, ie., the information needed for location-allocation analysis LocationAnalystParameter locationAnalystParameter = new LocationAnalystParameter(); locationAnalystParameter.expectedSupplyCenterCount=3; locationAnalystParameter.isFromCenter=true; locationAnalystParameter.nodeDemandField ="NodeCost"; locationAnalystParameter.turnWeightField="TurnCost"; locationAnalystParameter.weightName="CostInformation"; SupplyCenter center1 = new SupplyCenter(2, 30.0, 20.0, SupplyCenterType.FIXEDCENTER); SupplyCenter center2 = new SupplyCenter(15, 50.0, 20.0, SupplyCenterType.OPTIONALCENTER); SupplyCenter center3 = new SupplyCenter(12, 30.0, 20.0, SupplyCenterType.OPTIONALCENTER); SupplyCenter center4 = new SupplyCenter(10, 30.0, 20.0, SupplyCenterType.OPTIONALCENTER); SupplyCenterCollection collection = new SupplyCenterCollection(); collection.add(center1); collection.add(center2); collection.add(center3); collection.add(center4); locationAnalystParameter.supplyCenters=collection; LocationAnalystResult result = analystProvider.findLocation(locationAnalystParameter); return result; }
findLocation
in interface TransportationAnalystProvider
parameter
- The parameter object for location-allocation analysis.public double updateEdgeWeight(int edgeID, int fromNodeID, int toNodeID, java.lang.String weightField, double weight)
Updates the edge weight.
updateEdgeWeight
in interface TransportationAnalystProvider
edgeID
- The target edge ID.fromNodeID
- The start node ID of the target edge.toNodeID
- The end node ID of the target edge.weightField
- The name of the weight information (WeightFieldInfo
corresponding to the target edge. Parameters fromNodeID and toNodeID determine which field to update, the from-to or the to-from field.weight
- The new weight.public double updateTurnNodeWeight(int nodeID, int fromEdgeID, int toEdgeID, java.lang.String turnWeightField, double weight)
Updates the weight of turn node.
updateTurnNodeWeight
in interface TransportationAnalystProvider
nodeID
- The target turn node ID.fromEdgeID
- The start edge ID of the target turn node.toEdgeID
- The end edge ID of the target turn node.turnWeightField
- The name of the turn weight filed.weight
- The new weight.public java.lang.String[] getTurnWeightNames()
Gets the turn weight field name list of network data.
getTurnWeightNames
in interface TransportationAnalystProvider
public java.lang.String[] getWeightNames()
Gets the edge weight field name list of network data.
getWeightNames
in interface TransportationAnalystProvider
public void pauseForRefreshWorkspace()
Prevents the request to refresh the workspace.
public void refreshWorkspaceFinished()
Continues the request after finishing refreshing the workspace.
public void refreshWorkspace()
Refreshes the workspace.
public boolean reloadModel()
Reloads the network model.
reloadModel
in interface TransportationAnalystProvider
public static TransportationCheckUtil.CheckNetworkResult check(TransportationAnalystSetting setting)
public FacilityAnalyst2DResult findCriticalFacilitiesUpFromEdge(int[] sourceNodeIDs, int edgeID, FacilityAnalystParameter parameter)
findCriticalFacilitiesUpFromEdge
in interface TransportationAnalystProvider
public FacilityAnalyst2DResult findCriticalFacilitiesDownFromEdge(int[] sourceNodeIDs, int edgeID, FacilityAnalystParameter parameter)
findCriticalFacilitiesDownFromEdge
in interface TransportationAnalystProvider
public FacilityAnalyst2DResult findCriticalFacilitiesUpFromNode(int[] sourceNodeIDs, int nodeID, FacilityAnalystParameter parameter)
findCriticalFacilitiesUpFromNode
in interface TransportationAnalystProvider
public FacilityAnalyst2DResult findCriticalFacilitiesDownFromNode(int[] sourceNodeIDs, int nodeID, FacilityAnalystParameter parameter)
findCriticalFacilitiesDownFromNode
in interface TransportationAnalystProvider
public BurstAnalyseResult burstAnalyseFromNode(int[] sourceNodeIDs, int nodeID, FacilityAnalystParameter parameter)
burstAnalyseFromNode
in interface TransportationAnalystProvider
public BurstAnalyseResult burstAnalyseFromEdge(int[] sourceNodeIDs, int edgeID, FacilityAnalystParameter parameter)
burstAnalyseFromEdge
in interface TransportationAnalystProvider
public FacilityAnalyst2DResult findConnectedEdgesFromEdges(int[] edgeIDs, boolean returnFeatures, boolean connected)
TransportationAnalystProvider
findConnectedEdgesFromEdges
in interface TransportationAnalystProvider
edgeIDs
- The ID array of the specified edges.returnFeatures
- Whether to return features. If set to true, it will return features; false, doesn't return.connected
- Connected or unconnected. If set to true, it will return the connected edges; false, return the unconnected edges.public FacilityAnalyst2DResult findConnectedEdgesFromNodes(int[] nodeIDs, boolean returnFeatures, boolean connected)
TransportationAnalystProvider
findConnectedEdgesFromNodes
in interface TransportationAnalystProvider
nodeIDs
- The iD array of the specified nodes.returnFeatures
- Whether to return features. If set to true, it will return features; false, doesn't return.connected
- Connected or unconnected. If set to true, it will return the connected edges; false, return the unconnected edges.public FacilityAnalyst2DResult traceDownFromNode(int nodeID, FacilityAnalystParameter parameter)
TransportationAnalystProvider
traceDownFromNode
in interface TransportationAnalystProvider
public FacilityAnalyst2DResult traceUpFromNode(int nodeID, FacilityAnalystParameter parameter)
TransportationAnalystProvider
traceUpFromNode
in interface TransportationAnalystProvider
nodeID
- The specified node IDpublic FacilityAnalyst2DResult traceDownFromEdge(int edgeID, FacilityAnalystParameter parameter)
TransportationAnalystProvider
traceDownFromEdge
in interface TransportationAnalystProvider
edgeID
- The specified edge IDpublic FacilityAnalyst2DResult traceUpFromEdge(int edgeID, FacilityAnalystParameter parameter)
TransportationAnalystProvider
traceUpFromEdge
in interface TransportationAnalystProvider
edgeID
- The specified edge ID