Specify advanced properties for the routing services from a properties file.
Additional service properties
When configuring routing services from a network dataset, you can specify a properties file that contains additional settings for the routing services, such as the minimum and maximum number of service instances, or the default values for one or more parameters supported by the REST API of the services. For example, if the applications that use the routing and directions service only use the travel time and travel distance values from the output routes and do not need driving directions or route geometries, you can configure the routing and directions service using the properties file to only return the desired outputs by default. This will optimize the performance of the routing and directions service as it is not generating additional outputs that are not used by the client applications.
The properties file stores the settings in the JavaScript Object Notation (JSON) format. This help topic assumes a basic familiarity with the JSON format.
You can configure advanced properties for a routing service by specifying a properties file. The default properties file called publishroutingservices.json.
An example properties file and explanation of its structure are provided below.
This section describes the structure of the properties file using the default file as an example. To change the properties, you can make a copy of the default file and edit the copy using a text editor. When calling the configure routing process, specify the modified file as input.
Structure of the properties file
The properties file contains a top level object called routingServices, which has mapServices and gpServices objects. Each of these objects can contain one or more objects representing a specific routing service. The top level JSON objects in the properties file. The mapServices object defines properties for networkAnalysis map service and the gpServices object defines properties for the asyncNetworkAnalysis, syncNetworkAnalysis, and routingUtilities geoprocessing services.{
"routingServices": {
"mapServices": {
"networkAnalysis": {
}
},
"gpServices": {
"asyncNetworkAnalysis": {
},
"syncNetworkAnalysis": {
},
"routingUtilities": {
}
}
}
}
A map service object, such as networkAnalysis, contains a serviceProperties object that defines the service level properties for the map service, and the layerProperties object that defines the properties for one or more layers used by the map service.
A geoprocessing service object such as asyncNetworkAnalysis, contains a serviceProperties object that defines the service level properties for the geoprocessing service, and the toolProperties object that defines the properties for one or more geoprocessing tools used by the geoprocessing service.
The service JSON object containing serviceProperties and layerProperties or toolProperties.
{
"routingServices": {
"mapServices": {
"networkAnalysis": {
"serviceProperties": {
},
"layerProperties": {
}
}
},
"gpServices": {
"asyncNetworkAnalysis": {
"serviceProperties": {
},
"toolProperties": {
}
},
"syncNetworkAnalysis": {
"serviceProperties": {
},
"toolProperties": {
}
},
"routingUtilities": {
"serviceProperties": {
},
"toolProperties": {
}
}
}
}
}
A serviceProperties object within a service object defines one or more service level properties such as the maximum number of service instances per machine (MaxInstances), or the maximum time (in seconds) the client can use a service (UsageTimeout).
A layerProperties object for a map service defines properties for the route, closestFacility, serviceArea, and odCostMatrix layers. The properties for a layer are defined as part of the defaultValues object.
A toolProperties object for a geoprocessing service defines properties for the geoprocessing tools such as FindRoutes, FindClosestFacilities, GenerateServiceAreas, GenerateOriginDestinationCostMatrix, SolveLocationAllocation, SolveVehicleRoutingProblem, and EditVehicleRoutingProblem. The properties for a tool are defined as part of the defaultValues object. The constantParameters object allows you to list one or more parameters for the tool that should not be available in the REST API of the geoprocessing service.
layerProperties object for the layers in a map service and the toolProperties object for the tools in the geoprocessing service.
{
"routingServices": {
"mapServices": {
"networkAnalysis": {
"serviceProperties": {
},
"layerProperties": {
"route": {
"defaultValues": {
}
},
"closestFacility": {
"defaultValues": {
}
},
"serviceArea": {
"defaultValues": {
}
},
"odCostMatrix": {
"defaultValues": {
}
}
}
}
},
"gpServices": {
"asyncNetworkAnalysis": {
"serviceProperties": {
},
"toolProperties": {
"FindRoutes": {
"defaultValues": {
},
"constantParameters": []
},
"FindClosestFacilities": {
"defaultValues": {
},
"constantParameters": []
},
"GenerateServiceAreas": {
"defaultValues": {
},
"constantParameters": []
},
"GenerateOriginDestinationCostMatrix": {
"defaultValues": {
},
"constantParameters": []
},
"SolveLocationAllocation": {
"defaultValues": {
},
"constantParameters": []
},
"SolveVehicleRoutingProblem": {
"defaultValues": {
},
"constantParameters": []
}
}
},
"syncNetworkAnalysis": {
"serviceProperties": {
},
"toolProperties": {
"EditVehicleRoutingProblem": {
"defaultValues": {
},
"constantParameters": []
}
}
},
"routingUtilities": {
"serviceProperties": {
}
}
}
}
}
Edit and upload a properties file
When configuring a routing service, you can upload a properties file with properties that you specify, such as min or max instances per node.
Tip:
When editing the file, it is recommended that you use a text editor such as Visual Studio Code that understands JSON syntax to edit the properties file to avoid syntax errors while editing the properties file. A properties file with any JSON syntax error will result in configure routing services process to fail.