Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an easy way to determine which hemisphere a user is in?

I'm working on a project which includes seasonal content, and we're thinking of determining the user's location to work out what season it is for them. The obvious way of doing this is to Geo-locate their IP, then grab the latitude. > 0 is Northern hemisphere, and < 0 is Southern.

I'm happy to go that way - though it seems a bit of a waste to pinpoint an IP to an exact location, just to determine which half of the planet they're on - but I thought I'd throw it out there in case anyone has any tricks which might shortcut the process.

Request headers, stuff that can be extracted with JS on the client, it's all easy enough to get - I just don't think any of it helps.

like image 577
Ben Hull Avatar asked Oct 20 '11 02:10

Ben Hull


People also ask

How can you tell which hemisphere you are in?

Determining whether you are in the Northern or Southern Hemisphere is easy—simply ask yourself if the equator is north or south of your position. This tells you your longitudinal hemisphere because the Northern Hemisphere and Southern Hemisphere are divided by the equator.

How do you tell if you're in the Southern Hemisphere by the sun?

Identify the Hemisphere If the sun is South of the camera, we are in the Northern hemisphere. Likewise, if the camera faces North, and we see the sun, we are in the Southern hemisphere.

How can you determine if the area is in the Northern or Southern Hemisphere on a Climograph?

Before assessing any climograph, it is important to figure out which hemisphere the city is located in. You can determine this by looking at which months are the warmest (or coldest) and then note the hemisphere.

How do you tell if a country is in the Northern Hemisphere?

Locate the equator on the map. Every country above that line is considered to be part of the Northern Hemisphere. This encompasses the entire continent of North America (which includes Central America) and all of Europe, most of Asia, approximately two thirds of Africa, and about ten percent of South America.


2 Answers

I'd first check the client's clock- if daylight savings exists in the client's calendar, you can tell if he is north or south of the equator.

if there is no dst information, you can use geolocation,

or ask the user if he is south of the equator...

window.whatHemisphere= (function(){
    var y= new Date().getFullYear();
    if(y.getTimezoneOffset()==undefined) return null;
    var jan= -(new Date(y, 0, 1, 0, 0, 0, 0).getTimezoneOffset()),
    jul= -(new Date(y, 6, 1, 0, 0, 0, 0).getTimezoneOffset()),
    diff= jan-jul;
    if(diff> 0) return 'N';
    if(diff< 0) return 'S'
    return null;
})()
like image 148
kennebec Avatar answered Oct 04 '22 02:10

kennebec


You could use the navigator.geolocation method to avoid any sort of IP service.

like image 23
Robot Woods Avatar answered Oct 04 '22 02:10

Robot Woods