{"id":59006,"date":"2023-04-19T03:01:58","date_gmt":"2023-04-18T17:01:58","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=59006"},"modified":"2023-04-18T15:17:33","modified_gmt":"2023-04-18T05:17:33","slug":"country-data-geodata-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/country-data-geodata-tutorial\/","title":{"rendered":"Country Data Geodata Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/country_data.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Country Data Geodata Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/country_based_data_geo.jpg\" title=\"Country Data Geodata Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Country Data Geodata Tutorial<\/p><\/div>\n<p>We started <a title='Country Data Primer Tutorial' href='#cdpt'>Country Data Primer Tutorial<\/a>&#8216;s perusal of the &#8230;<\/p>\n<blockquote cite=''><p>\n great Open Licence data source concerning a <a target=_blank title='https:\/\/web.archive.org\/web\/20150319012353\/http:\/\/opengeocode.org\/cude\/download.php?file=\/home\/fashions\/public_html\/opengeocode.org\/download\/cow.txt' href='https:\/\/web.archive.org\/web\/20150319012353\/http:\/\/opengeocode.org\/cude\/download.php?file=\/home\/fashions\/public_html\/opengeocode.org\/download\/cow.txt'>country data &#8220;cow.txt&#8221;<\/a> flat file with semicolon column separators, thanks to the heads up at <a target=_blank title='https:\/\/gis.stackexchange.com\/questions\/152758\/countries-latitude-and-longitude-range' href='https:\/\/gis.stackexchange.com\/questions\/152758\/countries-latitude-and-longitude-range'>this great link<\/a>\n<\/p><\/blockquote>\n<p> &#8230; start to our endeavours without referencing <a target=_blank title='Geodata information from Wikipedia, thanks' href='https:\/\/en.wikipedia.org\/wiki\/Geographic_data_and_information'>&#8220;geodata&#8221;<\/a>.   But there is &#8220;geodata&#8221; in &#8220;cow.txt&#8221;, and so it behoves us to represent that in a &#8230; in a &#8230; <a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=uhiCFdWeQfA'>anyone, anyone<\/a>?  Yes, <a target=_blank title='?' href='https:\/\/en.wikipedia.org\/wiki\/Anaximander'>Anaximander, son of Praxiades<\/a> &#8230; <font size=1>or is that Praximander, son of Anaxiades &#8230; please, in future, can you separate or one of you <a target=_blank href='https:\/\/h2g2.com\/entry\/A546518\/conversation\/view\/F66728\/T143709'>take the town drain home<\/a><\/font> &#8230; we <i>can<\/i> plot positions on a <i>map<\/i>.<\/p>\n<p>How about one of <a target=_blank href='https:\/\/developers.google.com\/chart\/interactive\/docs\/index' title='Google Chart Tools provide a perfect way to visualize data on your website. From simple line charts to complex hierarchical tree maps, the chart galley provides a large number of well-designed chart types. Populating your data is easy using the provided client- and server-side tools.'>Google&#8217;s Charts<\/a>, such as &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Google Chart Map Chart information from Google' href='https:\/\/developers.google.com\/chart\/interactive\/docs\/gallery\/map'>Map Chart<\/a> &#8230; and\/or &#8230;<\/li>\n<li><a target=_blank title='Google Chart Geo Chart information from Google' href='https:\/\/developers.google.com\/chart\/interactive\/docs\/gallery\/geochart'>Geo Chart<\/a><\/li>\n<\/ul>\n<p> &#8230; so that the user can see &#8220;where&#8221; in the world the Country (and its Capital) are located?<\/p>\n<p>Try this, in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/country_data.html-GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/country_data.html-GETME\">country_data.html<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/country_data.html\">Country Data<\/a> web application <a href='#myifcow'>start below<\/a>.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/country-data-geodata-tutorial\/'>Country Data Geodata Tutorial<\/a>.<\/p-->\n<hr>\n<p id='cdpt'>Previous relevant <a target=_blank title='Country Data Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/country-data-primer-tutorial\/'>Country Data 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\/country_data.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Country Data Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/country_data_primer.jpg\" title=\"Country Data Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Country Data Primer Tutorial<\/p><\/div>\n<p>The other day we came upon a great Open Licence data source concerning a <a target=_blank title='https:\/\/web.archive.org\/web\/20150319012353\/http:\/\/opengeocode.org\/cude\/download.php?file=\/home\/fashions\/public_html\/opengeocode.org\/download\/cow.txt' href='https:\/\/web.archive.org\/web\/20150319012353\/http:\/\/opengeocode.org\/cude\/download.php?file=\/home\/fashions\/public_html\/opengeocode.org\/download\/cow.txt'>country data &#8220;cow.txt&#8221;<\/a> flat file with semicolon column separators, thanks to the heads up at <a target=_blank title='https:\/\/gis.stackexchange.com\/questions\/152758\/countries-latitude-and-longitude-range' href='https:\/\/gis.stackexchange.com\/questions\/152758\/countries-latitude-and-longitude-range'>this great link<\/a>.<\/p>\n<p>With today&#8217;s blog posting we start out writing a Javascript and HTML web application using &#8220;cow.txt&#8221; hosted in an HTML iframe element arrangement, and relying on its &#8220;onload&#8221; event Javascript language &#8230;<\/p>\n<p><code><br \/>\n  function checkif(iois, four) {<br \/>\n    var aconto = (iois.contentWindow || iois.contentDocument);<br \/>\n    if (aconto != null) {<br \/>\n       if (aconto.document) { aconto = aconto.document; }<br \/>\n       if (aconto.body != null) {<br \/>\n          if (origihcode == '') {<br \/>\n            origihcode=document.getElementById('ccode').innerHTML;<br \/>\n            origihname=document.getElementById('cname').innerHTML;<br \/>\n          } else {<br \/>\n            document.getElementById('ccode').innerHTML=origihcode;<br \/>\n            document.getElementById('cname').innerHTML=origihname;<br \/>\n         }<br \/>\n          var cols=[];<br \/>\n          var lines=aconto.body.innerText.split(String.fromCharCode(10));<br \/>\n          document.getElementById('tdcapital').innerHTML='';<br \/>\n          for (var i=0; i&lt;lines.length; i++) {<br \/>\n            cols=lines[i].split(';');<br \/>\n            if (eval('' + lines[i].length) &gt; 3 && eval('' + cols[0].length) == 2 && eval('' + cols.length) &gt; eval('' + four)) {<br \/>\n              if (prevval != '' && prevval.indexOf(orflag(cols[0])) != -1) {<br \/>\n              var ihis='&lt;option data-capital=\"' + cols[36].trim() + '\"  data-capital4=\"' + cols[36].trim() + '\"  data-capital8=\"' + cols[39].trim() + '\"  data-capital15=\"' + cols[40].trim() + '\"  data-capital17=\"' + cols[41].trim() + '\"  data-capital32=\"' + cols[42].trim() + '\"   data-capital29=\"' + cols[36].trim() + '\" value=\"' + cols[0] + ' ' + orflag(cols[0]) +  '\" selected&gt;' + (cols[eval('' + four)].trim() == '' ? cols[4] : cols[eval('' + four)]) + ' ' + orflag(cols[0]) + '&lt;\/option&gt;';<br \/>\n              document.getElementById('cname').innerHTML+=ihis;<br \/>\n              document.getElementById('ccode').innerHTML+='&lt;option data-capital=\"' + cols[36].trim() + '\"  data-capital4=\"' + cols[36].trim() + '\"  data-capital8=\"' + cols[39].trim() + '\" data-capital15=\"' + cols[40].trim() + '\"  data-capital17=\"' + cols[41].trim() + '\"  data-capital32=\"' + cols[42].trim() + '\"   data-capital29=\"' + cols[36].trim() + '\"   value=\"' + (cols[eval('' + four)].trim() == '' ? cols[4] : cols[eval('' + four)]) + ' ' + orflag(cols[0]) +  '\" selected&gt;' + cols[0] + ' ' + orflag(cols[0])  + '&lt;\/option&gt;';<br \/>\n              document.getElementById('tdcapital').innerHTML=(('' + ihis.split(' data-capital' + document.getElementById('lang').value + '=\"')[1].split('\"')[0].trim()) == '' ? ('' + ihis.split(' data-capital' + '=\"')[1].split('\"')[0].trim())  : ('' + ihis.split(' data-capital' + document.getElementById('lang').value + '=\"')[1].split('\"')[0].trim()) );<br \/>\n              } else {<br \/>\n              document.getElementById('cname').innerHTML+='&lt;option data-capital=\"' + cols[36].trim() + '\"  data-capital4=\"' + cols[36].trim() + '\"  data-capital8=\"' + cols[39].trim() + '\" data-capital15=\"' + cols[40].trim() + '\"  data-capital17=\"' + cols[41].trim() + '\"  data-capital32=\"' + cols[42].trim() + '\"   data-capital29=\"' + cols[36].trim() + '\"   value=\"' + cols[0] + ' ' + orflag(cols[0]) +  '\"&gt;' + (cols[eval('' + four)].trim() == '' ? cols[4] : cols[eval('' + four)])  + ' ' + orflag(cols[0]) + '&lt;\/option&gt;';<br \/>\n              document.getElementById('ccode').innerHTML+='&lt;option data-capital=\"' + cols[36].trim() + '\"  data-capital4=\"' + cols[36].trim() + '\"  data-capital8=\"' + cols[39].trim() + '\" data-capital15=\"' + cols[40].trim() + '\"  data-capital17=\"' + cols[41].trim() + '\"  data-capital32=\"' + cols[42].trim() + '\"   data-capital29=\"' + cols[36].trim() + '\"   value=\"' + (cols[eval('' + four)].trim() == '' ? cols[4] : cols[eval('' + four)])  + ' ' + orflag(cols[0]) +  '\"&gt;' + cols[0] + ' ' + orflag(cols[0])  + '&lt;\/option&gt;';<br \/>\n              }<br \/>\n           }<br \/>\n          }<br \/>\n       }<br \/>\n    }<br \/>\n    prevval='';<br \/>\n  }<br \/>\n<\/code><\/p>\n<p> &#8230; that dovetails with HTML &#8230;<\/p>\n<p><code><br \/>\n&lt;iframe style=display:none; id=myif onload=checkif(this,document.getElementById('lang').value); src='\/cow.txt'&gt;&lt;\/iframe&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; and imagine we&#8217;ll extend its functionality into the near future, onto its <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/country_data.html_GETME\">proof of concept country_data.html<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/country_data.html\">Country Data<\/a> web application start &#8230;<\/p>\n<p><iframe id=myifcow style=\"width:100%;height:1150px;\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/country_data.html\"><\/iframe><\/p>\n<p>We hope you hang about for the ride?!<\/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='#d58994' onclick='var dv=document.getElementById(\"d58994\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/iframe\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d58994' 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='#d59006' onclick='var dv=document.getElementById(\"d59006\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/google-chart\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d59006' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We started Country Data Primer Tutorial&#8216;s perusal of the &#8230; great Open Licence data source concerning a country data &#8220;cow.txt&#8221; flat file with semicolon column separators, thanks to the heads up at this great link &#8230; start to our endeavours &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/country-data-geodata-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,14,37],"tags":[290,2276,2147,2137,1619,480,513,518,519,576,587,652,745,2126,870,877,997,4225,1319,2580],"class_list":["post-59006","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-data","tag-delimitation","tag-delimiter","tag-flat-file","tag-geo-chart","tag-geodata","tag-google","tag-google-chart","tag-google-charts","tag-html","tag-iframe","tag-javascript","tag-map","tag-map-chart","tag-onload","tag-open-source","tag-programming","tag-semicolon","tag-tutorial","tag-where"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/59006"}],"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=59006"}],"version-history":[{"count":4,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/59006\/revisions"}],"predecessor-version":[{"id":59010,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/59006\/revisions\/59010"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=59006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=59006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=59006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}