CalculateDirections method

Unofficial Content
This documentation is valid for:

Allows getting the Direction between two points.

Parameters 

sourceLocation GeoPoint  
destinationLocation GeoPoint  
transportType TransportType  
requestAlternateRoutes Boolean  


Notes:

  • TransportType is an enumerated value: Walking, Driving, Bicycling, Transit.
  • This method returns a Directions Structure Data type Object.
  • Since  GeneXus 17 upgrade 4 an overload parameter is enabled
    DirectionsRequestParameters    
    sourceLocation GeoPoint  
    destinationLocation GeoPoint  
    waypoints Collection  
         waypoint GeoPoint  
    optimizeWaypoints boolean  
    transportType TransportType  
    requestAlternateRoutes Boolean  
    additionalParameters Collection  
         Parameter ConfigurationProperty  


Syntax

Direction = Maps.CalculateDirections(GeoPoint, GeoPoint, TransportType, Boolean)


Example 

&directionsMaps = Maps.CalculateDirections(GEopoint.fromwkt("POINT (-56.1983300 -34.9064600)"), GEopoint.fromwkt("POINT (-56.2066700 -34.9101100)"), TransportType.Driving,false)

It returns a Direction Route. The serialization Json of this Route should be something like this:

{"Routes":[{"name":"Plaza Independencia",
           "distance":1439,
          "expectedTravelTime":266,
          "transportType":"DRIVING",
          "geoline":"LINESTRING (-56.19833 -34.90642, -56.19874 -34.90645, -56.19874 -34.90645, -56.19877 -34.90621, -56.19878 -34.90617, -56.1988 -34.90612, -56.19881 -34.9061,... ,-56.20671 -34.91003)"
          }]
}

SInce GeneXus 17 upgrade 4 overload parameter , allows using waypoints 

&iniGeoPoint.FromString("POINT(-56.134953860299575 -34.901402497181124)") 
&FinGeoPoint.FromString("POINT(-56.146807789135565 -34.88463356035207)")   
&wayPoint1.FromString("POINT(-56.163740158081055 -34.92478600243492)")

&directionsrequestparameter.sourceLocation = &iniGeoPoint
&directionsrequestparameter.destinationLocation = &FinGeoPoint
&directionsrequestparameter.waypoints.Add(&wayPoint1)

&directions = Maps.CalculateDirections(&directionsrequestparameter)

Availability

This method is available since GeneXus 16 upgrade 6