{"id":25851,"date":"2016-10-22T03:01:08","date_gmt":"2016-10-21T17:01:08","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=25851"},"modified":"2016-10-22T12:16:21","modified_gmt":"2016-10-22T02:16:21","slug":"geolocation-isp-ip-new-api-service-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/geolocation-isp-ip-new-api-service-tutorial\/","title":{"rendered":"Geolocation ISP IP New API Service Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.htm\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Geolocation ISP IP New API Service Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip_again.jpg\" title=\"Geolocation ISP IP New API Service Tutorial\" \/><\/a><p class=\"wp-caption-text\">Geolocation ISP IP New API Service Tutorial<\/p><\/div>\n<p>The World Wide Web is one big &#8220;sharing&#8221; community, at least in the Open Source world, but most &#8220;Services&#8221; are subject to those &#8220;global economic headwinds&#8221; &#8230; you&#8217;ll forgive me, have just come from the news &#8230; and it is worth checking that a &#8220;Service&#8221; that used to be &#8220;gratis&#8221; is still that way.  Revisiting <a title='Geolocation ISP IP Follow Up Tutorial' href='#giifut'>Geolocation ISP IP Follow Up Tutorial<\/a> as shown below, today, resulted in that shock you get, as a programmer, when you don&#8217;t know how long something hasn&#8217;t been working according to plan.  And when we say this, we&#8217;re discounting &#8220;bugs&#8221; in this assessment &#8230; totally &#8220;bug&#8221; free code is a very difficult thing to achieve from everybody&#8217;s point of view, looking at it &#8230; but, more, the prerequisite things that lean on the Open Source part of the World Wide Web, for &#8220;Service&#8221; help.<\/p>\n<p>So we needed a new &#8220;gratis&#8221; IP information &#8220;friend&#8221;, and, yes, we found one, so thanks, <a target=_blank title='http:\/\/geoip.nekudo.com\/' href='http:\/\/geoip.nekudo.com\/'>http:\/\/geoip.nekudo.com\/<\/a> for their free IP information API &#8220;Service&#8221;, and also for their associated GitHub <a target=_blank title='GitHub repository' href='https:\/\/github.com\/nekudo\/shiny_geoip'>repository<\/a> &#8230; though we made no use of its downloads today.<\/p>\n<p>So we&#8217;re piecing back together the functionality via the use of this new &#8220;Service&#8221; 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&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.htm\" title='Click picture'>live run<\/a> (and you can download HTML programming source code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.html--GETME\" title=\"geoip.html\">geoip.htm<\/a>, with changes described in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.html--GETME\" title=\"geoip.html\">this link<\/a>, and with this <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.htm\" title=\"geoip.html\">live run<\/a> 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 &#8230; sort of like wondering &#8220;where is the telecommunication tower for me getting access to the internet?&#8221;.<\/p>\n<p>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 <font size=1> &#8230; but how long ago?<\/font><\/p>\n<hr>\n<p id='giifut'>Previous relevant <a target=_blank title='Geolocation ISP IP Follow Up Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/geolocation-isp-ip-follow-up-tutorial\/'>Geolocation ISP IP Follow Up Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.htm\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Geolocation ISP IP Follow Up Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.gif\" title=\"Geolocation ISP IP Follow Up Tutorial\" \/><\/a><p class=\"wp-caption-text\">Geolocation ISP IP Follow Up Tutorial<\/p><\/div>\n<p>We discovered yesterday this great resource for data feeds (thanks to <a target=_blank title='Great link for latest public feeds of interest' href='http:\/\/gearside.com\/public-json-feeds\/'>great link<\/a> for the great lead) at <a target=_blank title='JSON IP and GeoIP REST API (IP Geolocation)' href='http:\/\/www.telize.com'>JSON IP and GeoIP REST API (IP Geolocation)<\/a> by Telize.  In the course of discovering its usefulness we saw that it returned <a target=_blank title='Geolocation information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Geolocation'>geolocation<\/a> 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.<\/p>\n<p>So if this is the case, what do you think would improve the functionality of the software?  You&#8217;ve probably guessed, and the scenario is awfully similar to the scenario of <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=13656' title='Yahoo YQL Nextbus JSON Primer Tutorial'>Yahoo YQL Nextbus JSON Primer Tutorial<\/a> &#8230; we compare &#8220;our&#8221; geographical position with the ISP&#8217;s one.<\/p>\n<p>Once you have two geographical positions and you wake up &#8230; well, once (a few moons ago) &#8230; as a Land Surveyor &#8230; you&#8217;d be obliged &#8230; well, you&#8217;d just have to &#8230; for all intents and purposes &#8230; in the fullness of time &#8230; calculate an Earth Great Circle Distance &#8230; or if you think we live in a wonderful worrrrrrld &#8230; we calculate an Earrrrrrth Great Circle Distance &#8230; believe it or not they calculate to be the same?!  Here&#8217;s some JavaScript code &#8230;<\/p>\n<p><code><br \/>\nfunction great_circle_distance(talis, gnolis, latis, longis) {<br \/>\n  var ourdist=0.0;<br \/>\n  var rgnol=eval((gnolis) * Math.PI \/ 180.0);<br \/>\n  var rtal=eval((talis) * Math.PI \/ 180.0);<br \/>\n  var rlong=eval((longis) * Math.PI \/ 180.0);<br \/>\n  var rlat=eval((latis) * Math.PI \/ 180.0);<br \/>\n  var deltalong = Math.abs(eval(((gnolis)-(longis)) * Math.PI \/ 180.0));<br \/>\n  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<br \/>\n  ourdist = eval(Math.round((Math.acos(acof) * 6371000.0) + 0.00001) * 100) \/ 100;<br \/>\n  return ourdist;<br \/>\n}<br \/>\n<\/code><\/p>\n<p>So we calculate this in JavaScript and show you this along with three <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4832' title='PHP\/Javascript\/HTML Google Chart Map Tutorial'>Google Chart Map Chart<\/a> scenarios &#8230;<\/p>\n<ol>\n<li>ISP IP address position<\/li>\n<li>Your position<\/li>\n<li>ISP IP address position and Your position (to see how far apart they are on a map)<\/li>\n<\/ol>\n<p>&#8230; if <a target=_blank title='Ferdinand Magellan' href='https:\/\/www.google.com.au\/search?q=magellan&#038;ie=utf-8&#038;oe=utf-8&#038;gws_rd=cr&#038;ei=NZstVeVTgtqaBf_RgcgL'>Magellan<\/a> had had Google Maps I&#8217;m sure he&#8217;d have done something similar.<\/p>\n<p>Hopefully you will find something interesting with today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.htm\" title='Click picture'>live run<\/a>, and you can download HTML programming source code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.html-GETME\" title=\"geoip.html\">geoip.html<\/a>, with changes to yesterday described in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.html-GETME\" title=\"geoip.html\">this link<\/a>.<\/p>\n<hr>\n<p id='giipt'>Previous relevant <a target=_blank title='Geolocation ISP IP Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=14180'>Geolocation ISP IP Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.html\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Geolocation ISP IP Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.jpg\" title=\"Geolocation ISP IP Primer Tutorial\" \/><\/a><p class=\"wp-caption-text\">Geolocation ISP IP Primer Tutorial<\/p><\/div>\n<p>It&#8217;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 <a target=_blank title='Great link for latest public feeds of interest' href='http:\/\/gearside.com\/public-json-feeds\/'>great link<\/a>, we got onto the wonderful Acronym lookup resource at <a target=_blank title='' href='http:\/\/www.nactem.ac.uk\/'>NaCTeM<\/a> (The National Centre for Text Mining) which resulted in <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=14143' title='Acronyms Lookup Follow Up Tutorial'>Acronyms Lookup Follow Up Tutorial<\/a> yesterday and the day before.  Today we turn our attention to another great resource <a target=_blank title='JSON IP and GeoIP REST API (IP Geolocation)' href='http:\/\/www.telize.com'>JSON IP and GeoIP REST API (IP Geolocation)<\/a> by Telize, whose functionality we have really enjoyed, and been intrigued by.<\/p>\n<p><a target=_blank title='Geolocation information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Geolocation'>Geolocation<\/a> is about the &#8220;where&#8221; in life.  Arguably the best looked after concept out of &#8230;<\/p>\n<ul>\n<li>where?<\/li>\n<li>how?<\/li>\n<li>when?<\/li>\n<li>who?<\/li>\n<li>why?<\/li>\n<li>what?<\/li>\n<\/ul>\n<p> &#8230; for web applications is &#8220;where&#8221; &#8230; and as a former Land Surveyor it&#8217;s a great and interesting I.T. worrrrrrld out there <strike>man<\/strike> person.<\/p>\n<p>But to use that &#8220;last&#8221; questioning word &#8230; &#8220;what is the geolocation showing?&#8221; &#8230; today it is not &#8220;your&#8221; position, but with the Telize functionality, it is what your <a target=_blank title='Internet Service Provider information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Internet_service_provider'>ISP<\/a> has determined is the publicly released position of the &#8220;visitor <a target=_blank title='IP address information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/IP_address'>IP address<\/a>&#8221; of your session.<\/p>\n<p>And so it came to pass that we created the HTML\/JavaScript (<a target=_blank title='jQuery landing page' href='https:\/\/jquery.com\/'>jQuery<\/a>) geoip.html &#8230; nice looking &#8220;word&#8221; huh?! &#8230; if you want the &#8220;what&#8221; of geoip.html &#8230; here it is <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.html_GETME\" title=\"geoip.html\">here<\/a>.  Golly, woke up on the &#8220;awkward cuss&#8221; side of the bed &#8230; didn&#8217;t we? &#8230; eh, wot?! &#8230; charley &#8230; maaaate?<\/p>\n<p>So took geoip.html on a field trip to one of those <a target=_blank title='Telstra public Wi-Fi ... thanks' href='https:\/\/www.google.com.au\/search?q=telstra+wi-fi+phone+box&#038;source=lnms&#038;tbm=isch&#038;sa=X&#038;ei=5CMrVbryJ4TAmAWOqIDoBg&#038;ved=0CAcQ_AUoAQ&#038;biw=1287&#038;bih=674'>public Telstra Wi-Fi connections<\/a> you get around some public phones sometimes (isn&#8217;t it great?) &#8230; speaking of which, the public phone near Clem&#8217;s in Newtown, at Mardi Gras time got a creative makeover &#8230; take a squizz <a target=_blank href='http:\/\/pinsta.me\/tag\/Discoinfono' title=\"Phone box near Clem's at Mardi Gras time\">here<\/a> &#8230; and geoip.html came up with <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.png\">this<img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.png\" \/><\/a> &#8230; see how the latitude and longitude are rounded &#8220;hugely&#8221; &#8230; which puts it right in the middle of the land mass of Australia &#8230; 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 &#8230; with the tutorial picture too, I don&#8217;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 &#8220;ball park&#8221; usage, but intriguing in the information available none the less, and we link things off all these interesting data items for our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.html\" title=\"Click picture\">live run<\/a> &#8230; try it yourself? &#8230; was intrigued by &#8220;continent code&#8221; and found a useful link that lists countries and their capital cities for a &#8220;continent code&#8221; &#8230; pretty useful .. eh? wot? gov&#8217;nor? &#8230; see you at the <a target=_blank href='https:\/\/www.google.com.au\/search?q=jasmine+alley+the+bill&#038;ie=utf-8&#038;oe=utf-8&#038;gws_rd=cr&#038;ei=sxorVZ_0E-XQmwWP64DgBg#tbm=vid&#038;q=%22jasmine+allen%22+%22the+bill%22' title='The Bill'>Jasmine Allen<\/a> in two shakes &#8230; or see you for a <a target=_blank title='Arnotts Monte biscuit' href='https:\/\/www.google.com.au\/search?q=%22arnotts+monte+biscuit%22&#038;biw=1287&#038;bih=674&#038;tbm=isch&#038;source=lnms&#038;sa=X&#038;ei=3BsrVfSEIIPbmgWKoICQBQ&#038;ved=0CAYQ_AUoAQ'>Monte<\/a> on the <a target=_blank title='The Bill' href='http:\/\/thebill.wikia.com\/wiki\/The_Bronte_Estate'>Bronte<\/a>.<\/p>\n<p>Below are linking-to (thank you) websites with derived information of great use &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Google' href='https:\/\/www.google.com.au\/'>Google<\/a><\/li>\n<li><a target=_blank title='Google Maps' href='https:\/\/www.google.com.au\/maps'>Google Maps<\/a><\/li>\n<li><a target=_blank title='Who Is' href='http:\/\/whois.com'>Who Is<\/a><\/li>\n<li><a target=_blank title='Geotags' href='http:\/\/geotags.com'>Geotags<\/a><\/li>\n<li><a target=_blank title='Wikipedia' href='http:\/\/en.wikipedia.org'>Wikipedia<\/a><\/li>\n<li><a target=_blank title='World Cities DB' href='http:\/\/www.worldcitiesdb.com\/'>World Cities Database<\/a><\/li>\n<li><a target=_blank title='Data Center Map' href='http:\/\/www.datacentermap.com\/'>Data Center Map<\/a><\/li>\n<li><a target=_blank title='Time and Date Timezone' href='http:\/\/www.timeanddate.com\/'>Time and Date Timezone<\/a><\/li>\n<li><a target=_blank href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4832' title='PHP\/Javascript\/HTML Google Chart Map Tutorial'>Google Chart Map Chart<\/a><\/li>\n<\/ul>\n<p>Here&#8217;s the crux of the HTML&#8217;s JavaScript (jQuery) that sets up the environment for the &#8220;onload&#8221; event logic which mainly involves <a target=_blank href='http:\/\/en.wikipedia.org\/wiki\/JSON' title='JSON information from Wikipedia ... thanks'>JSON<\/a> <a target=_blank title='JSON parsing' href='http:\/\/jsonlint.com'>parsing<\/a> and analysis &#8230;<\/p>\n<p><code><br \/>\n<a target=_blank title='jQuery ready() method information from w3schools' href='http:\/\/www.w3schools.com\/jquery\/event_ready.asp'>$(document).ready<\/a>(function() {<br \/>\n\t<a target=_blank title='jQuery getJSON() method information from w3schools' href='http:\/\/www.w3schools.com\/jquery\/ajax_getjson.asp'>$.getJSON<\/a>(\"http:\/\/www.telize.com\/geoip?callback=?\",<br \/>\n\t\tfunction(json) {<br \/>\n                        \/\/ start of JSON parsing logic<br \/>\n                        \/\/ ...<br \/>\n                        \/\/ end of JSON parsing logic<br \/>\n\t\t\t});<br \/>\n});<br \/>\n<\/code><\/p>\n<p>So maybe you will find something interesting with today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/geoip.html\" title='Click picture'>live run<\/a>, and hope to see you tomorrow with more functionality ideas.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d14180' onclick='var dv=document.getElementById(\"d14180\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=geolocation\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d14180' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d14201' onclick='var dv=document.getElementById(\"d14201\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=jquery\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d14201' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d25851' onclick='var dv=document.getElementById(\"d25851\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/geolocation\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d25851' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The World Wide Web is one big &#8220;sharing&#8221; community, at least in the Open Source world, but most &#8220;Services&#8221; are subject to those &#8220;global economic headwinds&#8221; &#8230; you&#8217;ll forgive me, have just come from the news &#8230; and it is &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/geolocation-isp-ip-new-api-service-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[88,483,519,576,629,638,652,997,2031,1319],"class_list":["post-25851","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-api","tag-geolocation","tag-google-charts","tag-html","tag-ip-address","tag-isp","tag-javascript","tag-programming","tag-service","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/25851"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=25851"}],"version-history":[{"count":8,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/25851\/revisions"}],"predecessor-version":[{"id":25872,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/25851\/revisions\/25872"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=25851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=25851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=25851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}