@hebcal/core
    Preparing search index...

    Class GeoLocation

    A class that contains location information such as latitude and longitude required for astronomical calculations. The elevation field may not be used by some calculation engines and would be ignored if set.

    © Eliyahu Hershfeld 2004 - 2016

    1.1

    Hierarchy (View Summary)

    Index
    • GeoLocation constructor with parameters for all required fields.

      Parameters

      • name: string | null

        The location name for display use such as "Lakewood, NJ"

      • latitude: number

        the latitude in a double format such as 40.095965 for Lakewood, NJ. Note: For latitudes south of the equator, a negative value should be used.

      • longitude: number

        double the longitude in a double format such as -74.222130 for Lakewood, NJ. Note: For longitudes west of the Prime Meridian (Greenwich), a negative value should be used.

      • elevation: number

        the elevation above sea level in Meters. Elevation is not used in most algorithms used for calculating sunrise and set.

      • timeZoneId: string

        the TimeZone for the location.

      Returns GeoLocation

    elevation: number
    latitude: number
    locationName: string | null
    longitude: number
    timeZoneId: string
    • Adjust the date for antimeridian crossover. This is needed to deal with edge cases such as Samoa that use a different calendar date than expected based on their geographic location.

      The actual Time Zone offset may deviate from the expected offset based on the longitude. Since the 'absolute time' calculations are always based on longitudinal offset from UTC for a given date, the date is presumed to only increase East of the Prime Meridian, and to only decrease West of it. For Time Zones that cross the antimeridian, the date will be artificially adjusted before calculation to conform with this presumption.

      For example, Apia, Samoa with a longitude of -171.75 uses a local offset of +14:00. When calculating sunrise for 2018-02-03, the calculator should operate using 2018-02-02 since the expected zone is -11. After determining the UTC time, the local DST offset of UTC+14:00 should be applied to bring the date back to 2018-02-03.

      Parameters

      • date: PlainDate

        the date, at the start of which (in this location's time zone) the offset is read

      Returns number

      the number of days to adjust the date This will typically be 0 unless the date crosses the antimeridian

    • Method to get the elevation in Meters.

      Returns number

      Returns the elevation in Meters.

    • Returns number

      Returns the latitude.

    • A method that will return the location's local mean time offset in milliseconds from local standard time. The globe is split into 360°, with 15° per hour of the day. For a local that is at a longitude that is evenly divisible by 15 (longitude % 15 == 0), at solar noon (with adjustment for the equation of time) the sun should be directly overhead, so a user who is 1° west of this will have noon at 4 minutes after standard time noon, and conversely, a user who is 1° east of the 15° longitude will have noon at 11:56 AM.

      Parameters

      • instant: Instant

        the instant at which to read the time zone offset (DST is taken into account)

      Returns number

      the offset in milliseconds not accounting for Daylight saving time. A positive value will be returned East of the 15° timezone line, and a negative value West of it.

    • Returns string | null

      Returns the location name.

    • Returns number

      Returns the longitude.

    • Returns string

      Returns the timeZone.

    • Method to set the elevation in Meters above sea level.

      Parameters

      • elevation: number

        The elevation to set in Meters. An Error will be thrown if the value is a negative.

      Returns void

    • Parameters

      • latitude: number

      Returns void

    • Parameters

      • name: string | null

        The setter method for the display name.

      Returns void

    • Parameters

      • longitude: number

      Returns void

    • Method to set the TimeZone.

      Parameters

      • timeZoneId: string

        The timeZone to set.

      Returns void