Class GoogleDistance

java.lang.Object
org.kissweb.googleMapsAPI.GoogleDistance

public class GoogleDistance extends Object
This class gets the distance in miles between two addresses through a Google service. It also gets the estimated travel time in minutes. A Google API is needed for this to work. (It comes from Google.) Author: Blake McBride Date: 3/4/22
  • Constructor Details

    • GoogleDistance

      public GoogleDistance(String add1, String add2)
      Performs the actual query through Google. You must set the API_KEY before creating this object.

      Each address may be a normal address such as: "735 Spring Street, Atlanta, GA 33456"
      Or, they may be latitude longitude such as: "38.234567 -85.003456"
      Parameters:
      add1 -
      add2 -
  • Method Details

    • miles

      public int miles()
      Returns the distance in miles between two addresses.

      Returns -1 on error.
    • meters

      public int meters()
      Return the estimated travel distance in meters.

      Returns -1 on error.
    • minutes

      public int minutes()
      Return the estimated travel time in minutes.
      -1 is returned on error.