Quantcast
Channel: Robert James Metcalfe Blog » Wi-Fi
Viewing all articles
Browse latest Browse all 15

Geolocation ISP IP Follow Up Tutorial

$
0
0
Geolocation ISP IP Follow Up Tutorial

Geolocation ISP IP Follow Up Tutorial

We discovered yesterday this great resource for data feeds (thanks to great link for the great lead) at JSON IP and GeoIP REST API (IP Geolocation) by Telize. In the course of discovering its usefulness we saw that it returned geolocation data for what the ISP determined is the geographical location of your visitor IP address for your session with that ISP. So we did this at Newtown here, and went out and about and did the same execution logged into some Telstra free Wi-Fi public connection arrangement.

So if this is the case, what do you think would improve the functionality of the software? You’ve probably guessed, and the scenario is awfully similar to the scenario of Yahoo YQL Nextbus JSON Primer Tutorial … we compare “our” geographical position with the ISP’s one.

Once you have two geographical positions and you wake up … well, once (a few moons ago) … as a Land Surveyor … you’d be obliged … well, you’d just have to … for all intents and purposes … in the fullness of time … calculate an Earth Great Circle Distance … or if you think we live in a wonderful worrrrrrld … we calculate an Earrrrrrth Great Circle Distance … believe it or not they calculate to be the same?! Here’s some JavaScript code …


function great_circle_distance(talis, gnolis, latis, longis) {
var ourdist=0.0;
var rgnol=eval((gnolis) * Math.PI / 180.0);
var rtal=eval((talis) * Math.PI / 180.0);
var rlong=eval((longis) * Math.PI / 180.0);
var rlat=eval((latis) * Math.PI / 180.0);
var deltalong = Math.abs(eval(((gnolis)-(longis)) * Math.PI / 180.0));
var acof = eval(Math.sin(rtal) * Math.sin(rlat)) + (Math.cos(rtal) * Math.cos(rlat) * Math.cos(deltalong)); // via http://en.wikipedia.org/wiki/Great-circle_distance ... thanks
ourdist = eval(Math.round((Math.acos(acof) * 6371000.0) + 0.00001) * 100) / 100;
return ourdist;
}

So we calculate this in JavaScript and show you this along with three Google Chart Map Chart scenarios …

  1. ISP IP address position
  2. Your position
  3. ISP IP address position and Your position (to see how far apart they are on a map)

… if Magellan had had Google Maps I’m sure he’d have done something similar.

Hopefully you will find something interesting with today’s live run, and you can download HTML programming source code you could call geoip.html, with changes to yesterday described in this link.


Previous relevant Geolocation ISP IP Primer Tutorial is shown below.

Geolocation ISP IP Primer Tutorial

Geolocation ISP IP Primer Tutorial

It’s good every now and then to see what is new in the world of data feeds on the internet, so that is how, via this great link, we got onto the wonderful Acronym lookup resource at NaCTeM (The National Centre for Text Mining) which resulted in Acronyms Lookup Follow Up Tutorial yesterday and the day before. Today we turn our attention to another great resource JSON IP and GeoIP REST API (IP Geolocation) by Telize, whose functionality we have really enjoyed, and been intrigued by.

Geolocation is about the “where” in life. Arguably the best looked after concept out of …

  • where?
  • how?
  • when?
  • who?
  • why?
  • what?

… for web applications is “where” … and as a former Land Surveyor it’s a great and interesting I.T. worrrrrrld out there man person.

But to use that “last” questioning word … “what is the geolocation showing?” … today it is not “your” position, but with the Telize functionality, it is what your ISP has determined is the publicly released position of the “visitor IP address” of your session.

And so it came to pass that we created the HTML/JavaScript (jQuery) geoip.html … nice looking “word” huh?! … if you want the “what” of geoip.html … here it is here. Golly, woke up on the “awkward cuss” side of the bed … didn’t we? … eh, wot?! … charley … maaaate?

So took geoip.html on a field trip to one of those public Telstra Wi-Fi connections you get around some public phones sometimes (isn’t it great?) … speaking of which, the public phone near Clem’s in Newtown, at Mardi Gras time got a creative makeover … take a squizz here … and geoip.html came up with this … see how the latitude and longitude are rounded “hugely” … which puts it right in the middle of the land mass of Australia … guess this is for an inaccurately positionally defined visitor IP address, which I guess is defined by the ISP, in this case Telstra. And so I learn … with the tutorial picture too, I don’t live at Kensington, where the execution here at Newtown got Kensington as the location of the IP address here, so this is a web application for “ball park” usage, but intriguing in the information available none the less, and we link things off all these interesting data items for our live run … try it yourself? … was intrigued by “continent code” and found a useful link that lists countries and their capital cities for a “continent code” … pretty useful .. eh? wot? gov’nor? … see you at the Jasmine Allen in two shakes … or see you for a Monte on the Bronte.

Below are linking-to (thank you) websites with derived information of great use …

Here’s the crux of the HTML’s JavaScript (jQuery) that sets up the environment for the “onload” event logic which mainly involves JSON parsing and analysis …


$(document).ready(function() {
$.getJSON("http://www.telize.com/geoip?callback=?",
function(json) {
// start of JSON parsing logic
// ...
// end of JSON parsing logic
});
});

So maybe you will find something interesting with today’s live run, and hope to see you tomorrow with more functionality ideas.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


Viewing all articles
Browse latest Browse all 15

Latest Images

Trending Articles





Latest Images