GoogleMapsRoutePlanner

Content Type: Widget
Categories: User Interface

Overview

Add a route planner based on Google Maps webservices on your webpage to quickly get the best route including multiple waypoints and travelmodes.

Even though the last release is from 2019 the widget still works in all Mendix 9 versions (15-04-2023).

Documentation

Demo urlhttps://googlemapsrouteplanner-sandbox.mxapps.io/login.html

Description

Add a route planner based on Google Maps services on your webpage to quickly get the best route including multiple waypoints and travelmodes.

Even though the last version is from 2019 the widget still works in all Mendix 9 versions. Please see the demo application (built in Mendix 9.24.1) as well.

Features and limitations

  • Multiple travel modes are supported. 
  • Add multiple waypoints. Not available for TRANSIT travel mode.
  • Supports both address or latitude / longitude pair as starting address. When both are filled, lat/long is used and address from will be updated.
  • At least arrival time or departure time should be filled. When both are filled, arrival date will only be used and departure date will be updated.- Possibility to add preferences to avoid highways / tolls / ferries.

Dependencies 

  • API key needed, see below

Configuration

Place the GoogleMapsRoutePlanner in a Dataview. The Dataview entity should be a Route entity which the widget will use for it's route calculation.

The Route entity should have the following attributes:

  • AddressFrom (String)
  • LatitudeFrom (Decimal)
  • LongitudeFrom (Decimal)
  • AddressTo (String)
  • ArrivalTime (DateTime)
  • DepartureTime (DateTime)
  • AvoidHighways (Boolean)
  • AvoidFerries (Boolean)
  • AvoidTolls (Boolean)
  • Duration (Integer)
  • Distance (Integer)
  • TravelMode (Enum)

The TravelMode enumeration should hold as Keys the following values: TRANSIT, WALKING, DRIVING, BICYCLING.

Map those attributes in the DataSource tab pane of the widget. 

Waypoints

If you want to make use of WayPoints then also add a String attribute in your route entity, called something likeWaypointsStringArray (String, 2000 characters). In this attribute a user can add multiple waypoints when travelling from AddressFrom to AddressTo. Separate each address by a pipeline '|'. See also printscreen added.

Google Maps API's 

The widget makes use of two Google Maps API's: 

  1. Directions API for looking up the route
  2. Distance Matrix API for looking up distance and duration.

For the API's to correctly work an API key is necessary. See: https://developers.google.com/maps/documentation/directions/ 

Demo app user credentials

Username: GoogleMaps

Password: RoutePlanner@#1

 

Releases

Version: 1.1.0
Framework Version: 9.24.1
Release Notes: - Upgraded to Mendix 8.2.2. - Removed Resize function content. - Cleaned up code slightly.