Hexagon Geospatial


WebGIS enables powerful geospatial web applications and services that securely share your organization’s rich geospatial data, and provides tools to deeply examine spatial data and create value added products, on demand.
Showing results for 
Search instead for 
Do you mean 

Route Service Edge Restrictions and the SnapStopsToRestrictedEdges Property of the RouteSpec Object.

by Anonymous on ‎02-02-2017 08:14 AM - edited on ‎04-21-2017 06:55 AM by Technical Evangelist (368 Views)


Restrictions are dynamic constraints that can be applied against the network to constrain a path or allocation area to a subset of the edges. Restrictions are used where physical or institutional constraints limit the flow of goods, services, or communication over the network to specific sets of edges. Height, width, and weight restrictions on vehicles are common examples of restrictions operating on a highway system. A heavy truck being routed through the network, for example, must be restricted to the set of edges that can carry the vehicle weight.


Each Restriction is composed of a Name property, an ROperator property, and a Value property. The Name property is the name of a field in the network’s edge source database table. This is the field where the Restriction gets its data. The ROperator property is one of the constants defined below, and the Value property is a number defining the right-hand side of the equation.


The ROperator property allows the uiser to assign one of the Public OPERATORTYPE constants for the Restriction:

  • LESSTHAN = 0

Here is an example code snippet defining an edge restriction based on the speed limit field value of the Edges table.  The restriction is limiting the edges to be used in the DetermineRoute method to only those Edges that have a speed limit value of 55 or greater. To enable the Restrictions for the path calculation, set the RouteSpec EdgeRestrictions property to the array defined with Restrictions.


Dim EdgeRestrictions(1) As Restriction
EdgeRestrictions(0) = New Restriction
EdgeRestrictions(0).Name = "Speed Limit"
EdgeRestrictions(0).ROperator = (OPERATORTYPE.GREATERTHAN)
EdgeRestrictions(0).Value = "55"

If the RouteSpec object is called rtSpecification and for example, there is a Restriction as defined above, then set the EdgeRestrictions property of the RouteSpec to the Restriction array object:




rtSpecification.EdgeRestrictions = EdgeRestrictions


RouteSpec Object SnapStopsToRestrictedEdges Property

If Restrictions exist on edges in a Network (see sample restriction above), the property SnapStopsToRestrictedEdges (Boolean Data Type, True/False) allows the user to set whether those edges of the network are included in any DetermineRoute/Path calculation.  If the RouteSpec SnapStopsToRestrictedEdges property is set to False, then any stops input in the Determine Route parameters – whether viaPoints in the RouteSpec object or the Start or End point of the path, will not be snapped to any restricted edges in the network. The default value for the property is True -- Yes --  to snap stops to restricted edges.


Sample Code Snippet of a RouteSpec object with the SnapStopsToRestrictedEdges Property Set:


Dim rtSpecification As New RouteSpec

With rtSpecification
.DatasetName = "Sample_Network"
.RoutePreference = "Fastest"
.Language = Language
.ReturnGeometry = True
.SnapStopsToRestrictedEdges = False
.ReturnStopSummary = True
.InstructionSpecification = New InstructionSpec
.InstructionSpecification.ReturnBBox = True
.InstructionSpecification.ReturnGeometry = True
End With