Geolocation ISP IP New API Service Tutorial

Geolocation ISP IP New API Service Tutorial

Geolocation ISP IP New API Service Tutorial

The World Wide Web is one big “sharing” community, at least in the Open Source world, but most “Services” are subject to those “global economic headwinds” … you’ll forgive me, have just come from the news … and it is worth checking that a “Service” that used to be “gratis” is still that way. Revisiting Geolocation ISP IP Follow Up Tutorial as shown below, today, resulted in that shock you get, as a programmer, when you don’t know how long something hasn’t been working according to plan. And when we say this, we’re discounting “bugs” in this assessment … totally “bug” free code is a very difficult thing to achieve from everybody’s point of view, looking at it … but, more, the prerequisite things that lean on the Open Source part of the World Wide Web, for “Service” help.

So we needed a new “gratis” IP information “friend”, and, yes, we found one, so thanks, http://geoip.nekudo.com/ for their free IP information API “Service”, and also for their associated GitHub repository … though we made no use of its downloads today.

So we’re piecing back together the functionality via the use of this new “Service” and feeding it into a table of information, off which you can visit other public websites of interest to research more. To recap, what today’s live run (and you can download HTML programming source code you could call geoip.htm, with changes described in this link, and with this live run link) does, is get Geolocation information off the IP address that the ISP providing access to the World Wide Web is using, and present that along with local Geolocation information, about where you, as the client, are positioned relative to that … sort of like wondering “where is the telecommunication tower for me getting access to the internet?”.

We hope you enjoy trying it out yourself for the first time, or revisiting the web application to compare it to how it worked in days long ago … but how long ago?


Previous relevant Geolocation ISP IP Follow Up Tutorial is shown below.

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.


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

This entry was posted in eLearning, Tutorials and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *