Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Library for computing the sunrise/sunset from GPS coordinates and a date, in Java.
Java Ruby Perl
branch: master

This branch is 4 commits ahead, 19 commits behind mikereedell:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.settings
res
src
testdata
.classpath
.gitignore
.project
AllJUnitTests.launch
AndroidManifest.xml
LICENSE
README.markdown
build.xml
pom.xml
project.properties

README.markdown

Sunrise/SunsetLib - Java

Description

Java library to compute the local sunrise and sunset at a given latitude/longitue and date combination.

Dependencies

None

Installation

Download the jar or clone the repo and run $ mvn clean install to build from source.

Usage

Create a SunriseSunsetCalculator with a location and time zone identifier:

Location location = new Location("39.9522222", "-75.1641667");
SunriseSunsetCalculator calculator = new SunriseSunsetCalculator(location, "America/New_York");

Then call the method for the type of sunrise/sunset you want to calculate:

String officialSunrise = calculator.getOfficialSunriseForDate(Calendar.getInstance());
Calendar officialSunset = calculator.getOfficialSunsetCalendarForDate(Calendar.getInstance());

Bug Reports

When filing a bug report, please include the following information:

  • Date sunrise/set calculation was being run for.
  • Latitude/longitute sunrise/set calculation was being run for.
  • Timezone (either "America/New_York" or GMT-0500)

Author

Mike Reedell

Donate with Pledgie

License

Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0

Something went wrong with that request. Please try again.