Telogis.GeoBase.Routing.RoutingStrategy |
Describes a set of constraints to which the routing engine should adhere when calculating a route.
// Create a strategy that allows u-turns, road crossings and travel along toll roads. var myStrategy = new Telogis.GeoBase.Routing.RoutingStrategy({ allowUTurns: true, extraProcessingRatio: 1, roadCrossingBehavior: 'Telogis.GeoBase.Routing.RoadCrossingBehavior.ALLOWED', // ALLOWED is the default. Alternative options are 'DISCOURAGED' and 'FORBIDDEN' useTollRoads: true }); // Create a route var myRoute = new Telogis.GeoBase.Routing.Route(); // Apply the strategy to the route myRoute.setStrategy(myStrategy);
Name | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
RoutingStrategy(config) | Arguments
|
Name | Description |
---|---|
getAllowUTurns () | Gets Whether the routing engine is allowed to construct U-turn instructions in route directions when using this strategy. JavaScript var newStrategy = new Telogis.GeoBase.Routing.RoutingStrategy(); // Set u-turn bool newStrategy.setAllowUTurns(true); // Get u-turn bool alert ('Are u-turns allowed? ' + newStrategy.getAllowUTurns()); // true Boolean - True if U-turns are allowed; false otherwise. |
getExtraProcessingRatio () | Gets Multiplier for the area the routing engine uses to look for an optimal route. JavaScript var newStrategy = new Telogis.GeoBase.Routing.RoutingStrategy(); // Double the size of the area being queried during route generation newStrategy.setExtraProcessingRatio(2); // Get the size multiplier alert ('Query area multiplier is: ' + newStrategy.getExtraProcessingRatio()); Number - Multiplier of area to query while routing (1-100). |
getProfile (String country) | Gets the RoutingProfile for a country previously set using Routing.RoutingStrategy.setProfile. JavaScript var speed = Telogis.GeoBase.SpeedUnit.MilesPerHour; var strategy = new Telogis.GeoBase.Routing.RoutingStrategyFastest(); var profile = new Telogis.GeoBase.Routing.RoutingProfile(); // For every speed category (1-8) for (speedCat = 1; speedCat <9; ++speedCat) { // And every functional class (1-6) for (var funcClass = 1; funcClass < 7; ++funcClass) { // Set the profile speed to 10mph profile.setSpeed(speedCat, funcClass, 10, speed); } } // Apply the routing profile to the strategy in the UK strategy.setProfile("UK", profile); // Get the routing profile var countryUKProfile = strategy.getProfile("UK");
RoutingProfile - The profile for the given country. |
getRoadCrossingBehavior () | Gets The Routing.RoadCrossingBehavior code describing the manner in which the routing engine will treat road crossings -- that is, how it will consider going directly between targets on different sides of the road if the targets are on the same link. JavaScript var newStrategy = new Telogis.GeoBase.Routing.RoutingStrategy(); // Set road crossing behavior to FORBIDDEN. Alternative options are 'DISCOURAGED' and 'ALLOWED'. newStrategy.setRoadCrossingBehavior('Telogis.GeoBase.Routing.RoadCrossingBehavior.FORBIDDEN'); // Get road crossing behavior alert ('Road crossing behavior is: ' + newStrategy.getRoadCrossingBehavior()); String - The Routing.RoadCrossingBehavior code used by the Routing.RoutingStrategy. |
getUseTollRoads () | Gets Whether the routing engine is allowed to use toll roads during routing with this strategy. JavaScript var newStrategy = new Telogis.GeoBase.Routing.RoutingStrategy(); // Set toll roads bool - 'true' allows toll roads to be used with this strategy newStrategy.setUseTollRoads(true); // Get toll roads bool alert('Is travel along toll roads permitted? ' + newStrategy.getUseTollRoads()); // true Boolean - True if toll roads are allowed; false otherwise. |
setAllowUTurns (Boolean value) | Sets Whether the routing engine is allowed to construct U-turn instructions in route directions when using this strategy. JavaScript var newStrategy = new Telogis.GeoBase.Routing.RoutingStrategy(); // Set u-turn bool newStrategy.setAllowUTurns(true); // Get u-turn bool alert ('Are u-turns allowed? ' + newStrategy.getAllowUTurns()); // true
|
setExtraProcessingRatio (Number value) | Sets Multiplier for the area the routing engine uses to look for an optimal route. JavaScript var newStrategy = new Telogis.GeoBase.Routing.RoutingStrategy(); // Double the size of the area being queried during route generation newStrategy.setExtraProcessingRatio(2); // Get the size multiplier alert ('Query area multiplier is: ' + newStrategy.getExtraProcessingRatio());
|
setProfile (String country, RoutingProfile value) | Sets the RoutingProfile for a country. JavaScript var speed = Telogis.GeoBase.SpeedUnit.MilesPerHour; var strategy = new Telogis.GeoBase.Routing.RoutingStrategyFastest(); var profile = new Telogis.GeoBase.Routing.RoutingProfile(); // For every speed category (1-8) for (speedCat = 1; speedCat <9; ++speedCat) { // And every functional class (1-6) for (var funcClass = 1; funcClass < 7; ++funcClass) { // Set the profile speed to 40mph profile.setSpeed(speedCat, funcClass, 40, speed); } } // Set the UK profile strategy.setProfile("UK", profile); // Then get the UK profile var countryUKProfile = strategy.getProfile("UK"); // Set USA profile to UK profile strategy.setProfile("USA", countryUKProfile); // Check that the profiles are now the same if (strategy.getProfile("UK") == strategy.getProfile("USA")) { alert("USA and UK route profiles are now the same!"); }
|
setRoadCrossingBehavior (String value) | Sets The Routing.RoadCrossingBehavior code describing the manner in which the routing engine will treat road crossings -- that is, how it will consider going directly between targets on different sides of the road if the targets are on the same link. JavaScript var newStrategy = new Telogis.GeoBase.Routing.RoutingStrategy(); // Set road crossing behavior to FORBIDDEN. Alternative options are 'DISCOURAGED' and 'ALLOWED'. newStrategy.setRoadCrossingBehavior('Telogis.GeoBase.Routing.RoadCrossingBehavior.FORBIDDEN'); // Get road crossing behavior alert ('Road crossing behavior is: ' + newStrategy.getRoadCrossingBehavior());
|
setUseTollRoads (Boolean value) | Sets Whether the routing engine is allowed to use toll roads during routing with this strategy. JavaScript var newStrategy = new Telogis.GeoBase.Routing.RoutingStrategy(); // Set toll roads bool - 'true' allows toll roads to be used with this strategy newStrategy.setUseTollRoads(true); // Get toll roads bool alert('Is travel along toll roads permitted? ' + newStrategy.getUseTollRoads()); // true
|