Google Maps Integration and Route Planning

This Spotlight continues to share how to use the Map control to create a mapping and routing application. If your operations include transporting goods to or from multiple locations, the Google Maps Integration and Route Planning feature could be a time-saver for you. For example, if you have workflows that require users to manually enter addresses for routine routes, you can use this Map control to create an application that:

  • Calculates the most efficient route from a set of addresses or GPS coordinates.
  • Maps the route while the user is connected to the Internet.
  • Generates driving directions for each stop.

 

 

Route Planning

Delivery Directions

Key Benefits

  • Reduces the manual effort required to plan routes.
  • Integrates Google maps where needed in your applications.

Route Plan Implementation Example

The following is a sample script used to generate a routine delivery route plan for a fictitious auto service and parts delivery company.

 

All geo-location/mapping APIs are implemented on the Map prompt.

To plan a delivery route, you call the PlanRoute method on the Map interface of the Map prompt. The API will take the addresses passed into the Points variable, calculate the best route, and then return the addresses in the proper sequence in the string array that was passed into the PlanRoute method. The PlanRoute method also needs the address where the delivery starts and finishes.

The last Boolean variable on the PlanRoute API tells the mapping engine to generate a map. If True is passed into the method called, the engine will display an interactive map in the image view of the prompt. The user can then zoom in or out, or reposition the map by using the appropriate icon.

Delivery Directions Implementation Example

The Delivery Directions Implementation Example works very similarly to the Route Plan Implementation Example. To get the delivery directions, you pass the origin and destination addresses into the Map prompt map object via the GetDirections method.

 

 

In the Delivery Directions Implementation Example, the origin address “Services, 200 Plaza Dr. Folsom, CA 95630, USA “ is passed in the first parameter, txtOrig.Text, and the destination is passed in the second parameter, txtDest.Text. The third parameter, sDirs, is the line-by-line driving instructions. The last Boolean parameter just like the route plan is used to determine if a map should be displayed.

Google Mapping Key

The Google Maps Integration requires the user to sign up for a Google Maps APIs account and obtain a Google Maps API Key. Once the key has been obtained, in your RFgen Mobile Development Studio, add it to: Configuration > Environmental Properties – Google Integration.

To learn more about obtaining an activation license key, go to Google Maps APIs Pricing and Plans and click on “Paid”.