How to set travel mode to "Flight" in google map direction API .

SP Developer picture SP Developer · Feb 19, 2016 · Viewed 8.4k times · Source

I'm using google map direction API in our application. Map with directions working well with traveling modes like Driving,Walking,Transit and Bicycling. But it not showing flight directions when we enter two cities from different countries. So for showing flight directions what should i do? Please help.

Answer

geocodezip picture geocodezip · Feb 19, 2016

There is no FLIGHT TravelMode in the Google Maps Javascript API v3.

google.maps.TravelMode constants

The valid travel modes that can be specified in a DirectionsRequest as well as the travel modes returned in a DirectionsStep.

  • BICYCLING Specifies a bicycling directions request.
  • DRIVING Specifies a driving directions request.
  • TRANSIT Specifies a transit directions request.
  • WALKING Specifies a walking directions request.

One option would be to draw a normal or geodesic Polyline between the two airports.