java.lang.Object
com.maxmind.geoip.Location

public class Locationextends Object
Represents geographical location data including coordinates and address information.
  • Field Summary

    Modifier and Type
    Field
    Description
    int
    Telephone area code of the queried address.
    City name of the queried address.
    Two-letter ISO country code of the queried address.
    Country name of the queried address.
    int
    Designated market area code of the queried address.
    private static final double
    Earth's diameter, in km, for the distance formula.
    float
    Latitude of the queried address, in degrees.
    float
    Longitude of the queried address, in degrees.
    int
    Metro area code of the queried address.
    private static final double
    Pi, to the precision the formula needs.
    Postal code of the queried address.
    private static final double
    Multiplies degrees to get radians.
    State, province or region name of the queried address.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty record; LookupService fills the public fields directly from the database bytes, so the defaults are only a starting point.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    double
    Great-circle distance from this location to another.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • countryCode

      public String countryCode
      Two-letter ISO country code of the queried address.
    • countryName

      public String countryName
      Country name of the queried address.
    • region

      public String region
      State, province or region name of the queried address.
    • city

      public String city
      City name of the queried address.
    • postalCode

      public String postalCode
      Postal code of the queried address.
    • latitude

      public float latitude
      Latitude of the queried address, in degrees.
    • longitude

      public float longitude
      Longitude of the queried address, in degrees.
    • dma_code

      public int dma_code
      Designated market area code of the queried address.
    • area_code

      public int area_code
      Telephone area code of the queried address.
    • metro_code

      public int metro_code
      Metro area code of the queried address.
    • EARTH_DIAMETER

      private static final double EARTH_DIAMETER
      Earth's diameter, in km, for the distance formula.
      See Also:
    • PI

      private static final double PI
      Pi, to the precision the formula needs.
      See Also:
    • RAD_CONVERT

      private static final double RAD_CONVERT
      Multiplies degrees to get radians.
      See Also:
  • Constructor Details

    • Location

      public Location()
      Constructs an empty record; LookupService fills the public fields directly from the database bytes, so the defaults are only a starting point.
  • Method Details

    • distance

      public double distance(Location loc)
      Great-circle distance from this location to another.
      Parameters:
      loc - the other endpoint, supplying the latitude and longitude the
      Returns:
      approximate great-circle distance in km