June 5, 2007 at 10:37 am
We Know Where You Live…

Under the Hood

… 82% of the time.

Weather Widget

One of the cooler features of the new site design is the weather “widget” in the top left hand corner of the page. Some people might have noticed that the weather report being displayed is for the major city that is closest to you. How did our website know what city you are in?

It’s All About The IP Address
Every computer on the Internet has an IP address. These set of numbers allow networks to send the data you requested to your computer and not the one down the street. The IANA is the organization that keeps track of IP addresses on the Internet. They assign a block of addresses to 5 different portions of the world: Africa, Asia/Pacific, North America, Latin America and the Caribbean, and Europe, Middle East, and China. The fact that this division is made is the first step in figuring out your physical location based on your IP address. At this point, we can narrow down which region of the world you are located. Obviously not accurate enough to use in our application.

In each one of these regions there is a organization that then redistributes IP blocks allocated to them by the IANA to various people or companies in that region. For our discussion, we will focus on ARIN (American Registry for Internet Numbers) which handles IP addresses in North America. ARIN would be similar to a telephone company that distributes telephone numbers when you move to a new house. Except in this case, they hand out IP addresses to ISPs and Corporations.

It’s Public Information
ARIN (as do all “registries” as they are called) require that “owners” of IP addresses have a physical address on record. This information is available to the public at various locations.

Lets take a real world example: My IP address for my computer at home is: 24.137.199.17. If I type that address in the ARIN website, I get the following result:

Aurora Cable Internet ACI2 (NET-24-137-192-0-1)
                                  24.137.192.0 - 24.137.223.255
Aurora Cable Internet HE-24-137-192-0-19 (NET-24-137-192-0-2)
                                  24.137.192.0 - 24.137.223.255

Great! I know that a company called “Aurora Cable Internet” is responsible for my IP address and any other IP address that is inside the ranges listed above.

The string after the company name (“ACI2″ and “HE-24-137-192-0-19″) will be able to provide us with more information about that company. Plugging in “ACI2″ into the same search box on the ARIN site reveals (among other information):

OrgName:    Aurora Cable Internet
OrgID:      ACI-38
Address:    350 Industrial Parkway South
City:       Aurora
StateProv:  ON
PostalCode: L4G-3L6
Country:    CA

Now we all know that I live in Aurora, ON! More importantly though, we have just associated a physical location with a IP address.

What’s this 82% business?
The database that we use is only 82% accurate within 40kms of true location.

So what happens if you are in the 18%? The weather defaults to Toronto (further proof that we’re the centre of the universe). From there you can click on the “change city” link to save a new location.

I live in Canmore, but the weather for Calgary shows up. Why?
We’ve only discussed one part of how this system works. We can now identify which city you are probably located in. However, we have weather data for hundreds of cities across Canada and we need to determine which city with a weather station is closest to you.

Currently the weather widget only knows about 21 cities in Canada (we will be expanding this shortly). To find the closest city with weather station to Canmore we use a calculation called “great circle distance“. Put simply, its the distance between two points on a sphere (the sphere in this case is the Earth).

Great Circle Formula
Holy Math Batman! The Great Circle Formula

Using the latitude and longitude of Canmore we calculate the great circle distance to the 21 supported cities and return the one that is closest and display that data in the widget. This calculation only happens once and the information is saved as a cookie in your browser.

Tip of the Iceberg
The weather widget is just a sample of some of the possibilities with the location based website customization. Some of the possibilities can include:

  • Biasing your searches on the website to rank items that are physically closer to you more important than others. For example if you search for “Conrad Black” and you are located in Vancouver, show news stories of Conrad Black in Vancouver at the top of the results list.
  • Customizing the news page. Similar to the above, display your local news before or above the national news.
  • Display the proper radio and television schedules for your area automatically.
  • Show you more “relevant” advertisements based on your location.

I’m sure you will see more of this type of customization as cbc.ca evolves over the next little while.

Email This Post
  CBC.ca web site, Under the Hood

15 Responses to “We Know Where You Live…”

    Kev says:

    I wanted Winnipeg for the default, but got voted down. Maybe Tod should run a poll.



    Allan says:

    wonderfully informative post



    iNudes says:

    Ok, what about using this for election night?

    The law prevents results from being dislcosed to other regions that have polls open. This has been a problem for internet sites, basically meaning that no one can see anything online until they close until in BC.

    Couldn’t this be used to figure out which area you’re in and then decide what if any information you’re allowed to see? That would let people get their local or provincial results as they come in rather than waiting.



    Jason Paris says:

    No other urban region in the country comes even close to matching the GTA’s 5.5 million people. It only makes sense to make it the default and that’s not Toronto boosterism on my part.



    Dwight Williams says:

    I notice that the custom style sheet for use with Stylish re: keeping ads off of the cbc.ca/news/ homepage is now busted. It still works for the rest of the news pages, thankfully.



    Blake says:

    iNudes: We’ve thought of that already, but the accuracy for the elections is not high enough. Elections Canada would require 100% accuracy.



    David says:

    Toronto “YYZ” is only a worse case scenario if the GEO IP can’t figure out where you live. Most of the time GEO IP should pick the nearest city to you – in that rare case that something goes wrong and the widget can’t find the cookie set by the GEO IP it will load YYZ. Why Toronto – well the stats show the highest percentage of visitors come from Toronto. But it will not save Toronto as the city – every time you visit a page it will try to figure out where you live until the cookie is set. So don’t take it personally – if you don’t leave in Toronto click the ‘Change City’ (or the orange wrench) and pick a city.



    Jason says:

    localizing the internet kinda defeats the purpose of creating a global sphere enabled by new technology.

    I want my internt to reach beyond the local profiling of my ISP, I dont want any tailoring / gatekeeping of my right to universal access to information.

    I want to use the net to see beyond my local blinkers,

    Profiling users by isp for seemingly inaucuos services such as weather reports is a slippery slope and unecessary.

    I am happy to right click on my region of a map to get the weather I want thank you very much.

    JtT



    Katherine Maas says:

    What a fascinating post. I must admit I had been wondering how CBC found out I was in the Calgary area — I only moved here a week ago!



    Kev says:

    iNudes: I’d love to use it for federal elections, but it’s probably not accurate enough to make it past legal. I don’t think there is a geotargeting system in existence that is, though if we spent a whole lot more we could probably find a company that claimed to have one, and that we could then blame when it failed.

    Anyway, personally I think the real problem there is one of legislation. The restrictions don’t really make sense in a world with phones, never mind the Internet. But that’s another rant.



    toujoursdan says:

    Great idea but you should internationalize it. There are a lot of ex pat Canadian who view the site. When I was in NYC last week it showed Toronto. I went through the list and couldn’t find anything in the U.S.



    vclosets says:

    Thats great, as long as you have the option of turning off the local filter if you want. It can be annoying sometimes when a website reads your IP address and feeds you local data when you are really more interested in a larger perspective.



    Kev says:

    Internationalization is on the radar, but we’ll probably improve the accuracy within Canada first.



    Bob Jonkman says:

    I get my Internet service from an ISP that’s nowhere close to where I live, because they offer the best service. My IP address is assigned from a block allocated to the ISP’s location, but doesn’t reflect where I am.

    While IP-based geolocation is OK for casual consumer use, it’s really just a guess with fair-to-good accuracy, but nowhere near perfect.

    –Bob.



    Daniel says:

    So why is it that there are two entries for Ottawa in “Change City”?



  • Buy Cheap viagra online shop in uk Now WorldWide Shipping. Top Online Pharmacy.
  • Buy Cheapest bayer levitra samples Now Best Online. Special Prices For bayer levitra samples!
  • Buy Cheapest generic cheap viagra Online Discount Pharmacy Online. Best Online.
  • Buy Cheapest cialis new zealand Now Low Prices. 24/Internet)(safe Pharmacy.
  • Buy Cheap herbal viagra Online Guaranteed Shipping. WorldWide Shipping.
  • Buy Cheap canada online pharmacy viagra Now WorldWide Shipping. Discount Online Pharmacy.
  • Buy Cheapest viagra ejaculation Online Best Online. No Prescription Needed.
  • Buy Cheap cialis cost sell australia Now Top Online Pharmacy. Cheap Online Pharmacy.
  • Buy Cheap cialis levitra sales viagra Online Best Prices. Drugs, Health And Beauty.
  • Buy Cheapest viagra half price pharmacy Now The Largest Internet Pharmacy. Low Prices.
  • Buy buying viagra in uk Online Without Prescription. Low Prices. Best Internet.
  • Buying Cheap buy viagra. Offshore Rx, Best Prices. Online Medical Shop.
  • Buy Cheapest cialis consultation Online Cheap Prescription Drugs. Best Prices.
  • Buy Cheapest viagra pills Now Best Internet. No Prescription Needed.
  • Buy Cheapest caverta levitra cialis veega lozenges propecia Now Special Prices For caverta levitra cialis veega lozenges propecia! Best Internet.
  • Buy Cheap men viagra Now No Prescription Needed. Cheap Pharmacy Online.
  • Buy Cheapest viagra prices Now Guaranteed Shipping. Top Online Pharmacy.
  • Buy Cheap cialis brands Now Online Medical Shop. Discount Online Pharmacy.
  • Buy Cheap viagra free shipping Online Discount Online Pharmacy. Best Prices.
  • Buy Cheapest use of cialis Now Free Viagra Pills! No Prescription Needed.
  • Buy Cheapest cheep viagra Online Online Medical Shop. Best Drugstore.
  • Buy Cheap cialis fda approval Online 24/Internet)(safe Pharmacy. Best Online.
  • Buy Cheap cheapest cialis index Online Cheap Pharmacy Online. Online Medical Shop.
  • Buy Cheapest cialis cheapest Now 24/Online Pharmacy. Free Viagra Pills!
  • Buy Cheap manufactures of viagra cialis levitra online Online Pharmacy Store. Online Medical Shop.
  • Buy Cheap cheapest cialis 20mg offer Now Special Prices For cheapest cialis 20mg offer! Best Internet.
  • Buy Cheapest cialis maximum dose Now Free Viagra Pills! No Prescription Needed.
  • Buy Cheap generic cheap cialis Now Guaranteed Shipping. Discount Pharmacy Online.
  • Buy Cheapest cialis or viagra Now Pharmacy Store. Online Medical Shop.
  • Buy Cheapest levitra vs viagra vs cialis Now Low Prices. Cheap Prescription Drugs.
  • Buy Cheapest herbal viagra Online Best Internet. Cheap Online Pharmacy.
  • Buy Cheap cialis professional cheap Online Best Drugstore. Guaranteed Shipping.
  • Buy Cheap viagra oral jelly Now Free Viagra Pills! No Prescription Needed.
  • Buy Cheapest cialis and levitra viagra Online Pharmacy Store. No Prescription Needed.
  • Buy Cheap levitra mexico Online Best Prices. Discount Pharmacy Online.
  • Buy Cheapest women viagra Now Cheap Pharmacy Online. Online Medical Shop.
  • Buy Cheapest order cialis uk Now Best Drugstore. Special Prices For order cialis uk!
  • Buy is viagra professional real Without Prescription Doctor. Best Drugstore. Low Prices.
  • Buy Cheapest best price for generic viagra Now Pharmacy Store. No Prescription Needed.
  • Buy Cheapest cialis doses Online Pharmacy Store. No Prescription Needed.
  • Buy Cheapest buy viagra in the uk Online Cheap Online Pharmacy. Best Drugstore.
  • Buy Cheap cialis results Now Best Online. No Prescription Needed For Drugs.
  • Buy Cheapest buy viagra canada Online WorldWide Shipping. Pharmacy Store.
  • Buy Cheap uk viagra sales Online Low Prices. Special Prices For uk viagra sales!
  • Buy Cheap cialis levitra sale viagra Now Top Online Pharmacy. Guaranteed Shipping.
  • Buy Cheapest viagra how long does it last Now Pharmacy Store. Discount Pharmacy Online.
  • Buy Cheap genaric cialis Online Best Drugstore. No Prescription Needed.
  • Buy Cheapest sildenafil citrate viagra generic cheap Online No Prescription Needed. Pharmacy Store.
  • Buy Cheapest levitra prescriptions Online Top Online Pharmacy. Free Viagra Pills!
  • Buy Cheapest generic online viagra Online Online Prices For generic online viagra! Best Online.
  • Buy viagra drug interactions Without Prescription Doctor. Internet Prices For viagra drug interactions!
  • Buy Cheap viagra patch Now Top Online Pharmacy. Discount Online Pharmacy.
  • Buy Cheap purchase cheap cialis online Now Pharmacy Store. Discount Pharmacy Online.
  • Buy Cheap viagra india Now Pharmacy Store. Internet Prices For viagra india!
  • Buy can women take viagra Online Without Prescription. Internet Prices For can women take viagra!
  • Buy Cheapest maximum dose of cialis Now Low Prices. Discount Pharmacy Online.
  • Buy Cheapest how many people use cialis Online Top Online Pharmacy. Pharmacy Store.
  • Buy Cheapest cialis capsules 10 Now Pharmacy At The Best Price! Best Prices.
  • Buy Cheapest no prescription viagra Online Cheap Online Pharmacy. Best Drugstore.
  • Buy Cheapest viagra no perscription usa Now No Prescription Needed. Pharmacy Store.
  • Buy Cheap cheap viagra without prescription Online Top Online Pharmacy. 24/Online Pharmacy.
  • Buy Cheapest viagra prescription drug Now Best Internet. Cheap Online Pharmacy.
  • Buy Cheapest effects of levitra professional Now Discount Online Pharmacy. Best Internet.
  • Buy Cheap viagra amsterdam Now Online Prices For viagra amsterdam! Guaranteed Shipping.
  • Buy Cheapest viagra info Online Cheap Online Pharmacy. Low Prices.
  • Buy Cheap viagra store in canada Now Cheap Online Pharmacy. Cheap Pharmacy Online.
  • Buy Cheapest viagra advertising Online Best Internet. WorldWide Shipping.
  • Buying Cheap levitra professional mail order. Mexican Rx, Good Prices. 24/Online Pharmacy.
  • Buy Cheapest c-pill cheap cialis Now Low Prices. 100% Satisfaction Guaranteed.
  • Buying Cheap gay men viagra vs cialis. Worldwide Rx, Good Prices. WorldWide Shipping.
  • Buy Cheapest viagra wholesale Online Best Online. Pharmacy At The Best Price!
  • genaric cialis Online Without Prescription Guaranteed Shipping. Low Prices.
  • Buy Cheapest viagra soft flavored sildenafil 100mg Now Cheap Online Pharmacy. Online Medical Shop.
  • Buy Cheap how long does cialis work Now No Prescription Needed. Top Online Pharmacy.
  • Buy Cheapest spain farmacia levitra Online Low Prices. Drugs, Health And Beauty.
  • Buy Cheapest generic viagra levitra regalis Online 24/Online Pharmacy. Pharmacy Store.
  • Buy Cheapest suite cialis viagra levitra Online Online Prices For suite cialis viagra levitra! Best Online.
  • Buy Cheapest soma imitrex viagra levitra Now Low Prices. Pharmacy At The Best Price!
  • Buy Cheap viagra and buy Now Discount Online Pharmacy Shopping. Low Prices.
  • Buy Cheapest pfizer drug viagra Online Order Cheap Meds Without Rx. Low Prices.
  • Buy Cheapest cialis online consultation Online Online Medical Shop. Best Drugstore.
  • Buy Cheap womens viagra Online Best Prices. 24/Internet)(safe Pharmacy.
  • Buy Cheapest low price viagra Now Best Online. Special Prices For low price viagra!
  • Buy Cheap find cialis Online Best Prices. Internet Prices For find cialis!
  • Buy Cheap discount generic viagra Online WorldWide Shipping. Top Online Pharmacy.
  • Buy Cheapest cialis cheapest lowest price Now Top Online Pharmacy Supplier. Best Online.
  • Buying Cheapest viagra premature ejaculation. Mexican Pharmacy, Good Prices. Best Prices.
  • Buy Cheapest levitra buy levitra Online Best Online. Guaranteed Shipping.
  • Buy Cheapest generic soft tab viagra Now Low Prices. The Largest Internet Pharmacy.
  • Buy Cheap buy Levitra Plus Now Best Internet. Top Online Pharmacy Supplier.
  • Buy Cheap cialis 10 mg Online Online Prices For cialis 10 mg! Best Drugstore.
  • Buy Cheap chewable cialis Now Best Online. Safe And Secure Payment System.
  • Buy Cheap sales viagra Online Drugs, Health And Beauty. Best Online.
  • Buy Cheapest cialis for order Now Pharmacy Store. Special Prices For cialis for order!
  • Buy Cheapest levitra in canada Online Best Drugstore. Free Viagra Pills!
  • Buy Cheap buy cheap viagra online uk Now Best Prices. Order Cheap Meds Without Rx.
  • Buy Cheap get viagra Online Cheap Prescription Drugs. Best Internet.
  • Buy Cheapest purchase cialis online Now Buy Medications Online. Free Viagra Pills!
  • Buy Cheap viagra cost Online Best Drugstore. No Prescription Needed.
  • Buy Cheap levitra cialis and viagra Online Order Cheap Meds Without Rx. Best Internet.