Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm looking to plot day/night on a Google map, for an arbitrary point in time. I'm familiar with generating map tiles; I'm just looking for an algorithm to tell me whether a particular point on the globe is currently in daylight or darkness, or to otherwise plot the curve of the day/night interface onto the map.

I've done some searching, but it's possible I don't even know enough about the problem domain here to know what terms to search for!

Any ideas? Doesn't have to be perfect -- basically, I'm comparing Flickr geolocation data of sunrise and sunset photos (and their "date taken" timestamps) with reality, and this is to help me visualise it.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

This page gives equations good to 1 degree. It looks like this code calculates it too but I didn't actually check.

share|improve this answer
Fantastic, just what I was looking for. And yes, looks like the projillum() function in vplanet.c in that code matches up pretty well with that algorithm, so that should definitely get me heading down the right track, thanks. –  Matt Gibson Mar 21 '11 at 23:54
That link is broken. Please include relevant details instead of just a link. –  captncraig Oct 26 '12 at 3:33
second link works though –  iant Oct 26 '12 at 7:14

Also an example http://www.daylightmap.com/index.php

share|improve this answer
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. –  iant Aug 14 '12 at 13:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.