0) { $factor=str_replace('+','',urldecode($_GET['zoom'])); } } if (isset($_GET['uselatlaong'])) { $dolatlong=true; $longoff=0.0; $latoff=0.0; } else if (file_exists('countries.html')) { if ($factor != 1.0) { echo str_replace("function onl() {", "function onl() { \n document.body.style.zoom=((izoom == 1.0) ? ('' + eval(izoom * 100.0) + '%') : '" . (100.0 * $factor) . "%'); \n ", file_get_contents('countries.html')); exit; } else { echo file_get_contents('countries.html'); exit; } } // Create a transparent image thanks to https://www.php.net/manual/en/function.imagecolortransparent.php $im = imagecreatetruecolor((360.0 * $factor), (180.0 * $factor)); $black = imagecolorallocate($im, 0, 0, 0); // Make the background transparent imagecolortransparent($im, $black); // Save the image $udirnameprebimg='/tmp/imagecolortransparent.png'; imagepng($im, $udirnameprebimg); $duis='data:image/' . str_replace('jpg','jpeg',strtolower(explode('.',$udirnameprebimg)[-1 + sizeof(explode('.',$udirnameprebimg))])) . ';base64,' . base64_encode(file_get_contents($udirnameprebimg)); imagedestroy($im); unlink($udirnameprebimg); $htmlis="Display GeoJSON Countries var izoom=location.search.split('zoom=')[1] ? eval(decodeURIComponent(location.search.split('zoom=')[1].split('&')[0])) : 1.0; var lastl='', longlastl='', elem=null, context=null, thislat=0.0, thisong=0.0, mapwo=null, jtwo=' '; var yourtzlist=''; function onl() { if (izoom != 1.0) document.body.style.zoom=('' + eval(izoom * 100.0) + '%'); elem = document.getElementById('mycanvas'); elem.style.cursor='progress'; context = elem.getContext('2d'); context.strokeStyle = '#000000'; } "; $midbit=" function ouralert(ctyname, isothree, isotwo, inclist) { if ('' + isotwo).length == 2) { jtwo=isotwo; } if (inclist.indexOf(',') != -1) { var cls=inclist.replace('Longitude,Latitude coordinates are ','').split(','); longlastl=ctyname + ': ' + inclist; document.getElementById('ntz').value=''; //document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent(cls[1]) + '&longitude=' + encodeURIComponent(cls[0]) + '&ntztontz=y'; //setTimeout(lookforntz, 1000); } } function drawc(centerX, centerY) { var topllong=-180.0; var topllat=90.0; var onepixelequals=izoom; context.beginPath(); context.globalAlpha = 0.5; context.arc(centerX, centerY, 1, 0, 2 * Math.PI, false); context.fillStyle = 'green'; context.fill(); context.lineWidth = 5; context.strokeStyle = '#003300'; context.stroke(); } function callmap(inintzl, tp, itwo) { var intzl=inintzl; var thisplace=-1; var places=['', '', '']; var mapurl=\"//www.rjmprogramming.com.au/PHP/Map/map.php?title=Nearby%20TimeZone%20Places&onclick=y&label=['Lat',&value='Lon','Name']&data=,[\" + thislat + \",\" + thislong + \",~Your%20Place~]\"; var tzs=['', '', '']; var lats=[0, 0, 0]; var longs=[0, 0, 0]; var ioff=0, joff=0; var wasp=''; var prefix='', thismu='', newdatabit='', lastgeourl='', areg='', newpeninfo=''; var tzls=intzl.split('/'); var enin=''; if (tp != '') { if (tp.indexOf('/wiki/') != -1) { enin=encodeURIComponent(' in ') + tp.split('/wiki/')[1].replace(/\_/g,'%20'); mapurl=mapurl.replace('~]', enin + '~]'); } else { enin=encodeURIComponent(' in ' + tp); mapurl=mapurl.replace('~]', encodeURIComponent(' in ' + tp) + '~]'); } } if (eval('' + tzls.length) > 3) { for (var ih=0; ih<3; ih++) { if (tzls[eval(1 + ih + ioff)].indexOf(' ') == -1) { prefix='/' + tzls[eval(1 + ih + ioff)] + '/'; joff++; } else { prefix='/'; } thisplace=-1; while (tzls[eval(0 + ih + ioff)].slice(thisplace).substring(0,1) != '.' && tzls[eval(0 + ih + ioff)].slice(thisplace).substring(0,1) != ' ') { wasp=prefix; prefix=tzls[eval(0 + ih + ioff)].slice(thisplace).substring(0,1) + wasp; //alert('IH=' + ih + ' and prefix=' + prefix + ' ' + tzls[eval(0 + ih + ioff)].slice(thisplace)); thisplace--; } //alert('ih=' + ih + ' and prefix=' + prefix); places[ih]=prefix; tzs[ih]=prefix; thisplace=1; ioff=joff; while (tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1) != '.' && tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1) != ' ') { places[ih]+=tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1); tzs[ih]+=tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1); thisplace++; } //alert('ih=' + ih + ' and thisplace=' + thisplace + ' and tzs[]=' + tzs[eval(0 + ih)] + ' and yourtzlist=' + yourtzlist); if (tzls[eval(1 + ih + ioff)].indexOf(' is ') != -1) { places[ih]+=(' in ' + ('' + tzls[eval(1 + ih + ioff)].substring(thisplace).split(' is ')[0]).replace(' in ','').replace(' in ','').replace(' in ','').replace(' in ','')).replace(' in in ',' in '); } if (yourtzlist.indexOf(tzs[ih]) != -1) { mapurl+=',[' + yourtzlist.split(tzs[ih])[1].split('=')[1].split(',')[0].replace(String.fromCharCode(34),'') + ',' + yourtzlist.split(tzs[ih].replace(/America\!Argentina\//g, 'America/Argentina/'))[1].split('=')[1].split(',')[1].replace(String.fromCharCode(34),'') + ',~' + encodeURIComponent(places[ih].replace(/America\!Argentina\//g, 'America/Argentina/')) + '~]'; } } if (mapwo) { if (!mapwo.closed) { mapwo.close(); mapwo=null; } //alert(mapurl); // https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=GB;Greenwich%20London%20Places&aregexographicals=y&aregeographicals=&width=834&height=520&country=Places&popularity=&data=%20[51.4769|-0.0005|~From~,2]%20,%20[51.4769|-0.0005|~To~,2]%20,%20[51.4769|-0.0005|~Greenwich~,2] mapwo=window.open(mapurl, '_blank', 'top=20,left=20,width=' + eval(-40 + screen.width) + ',height=' + eval(-40 + screen.height)); if (itwo.trim() != '') { newdatabit=' ' + mapurl.split('&data=')[1].substring(1).replace(/\~\]/g, '~,2]'); lastgeourl=(mapurl.split('&')[0].replace('/PHP/Map/map.php?title=', '/PHP/GeoChart/geo_chart.php?title=' + itwo + ';') + '&onclick=nowiki&aregexographicals=y&aregeographicals=' + areg + '&width=556&height=347&country=Places&popularity=Popularity&data=' + (newdatabit).replace(/\ /g, '%20')).replace('%20Places&', '%20Places' + enin + '&'); if (tp == '') { window.open(lastgeourl, '_blank', 'top=80,left=600,width=' + eval(-600 + screen.width) + ',height=' + eval(-40 + screen.height)); } else { window.open(lastgeourl, '_blank', 'top=' + eval(-400 + screen.height) + ',left=0,width=' + eval(-600 + screen.width) + ',height=400'); } } if (tp != '') { window.open(tp, '_blank', 'top=80,left=' + eval(-600 + screen.width) + ',width=600,height=600'); } } else { mapwo=window.open(mapurl, '_blank', 'top=20,left=20,width=' + eval(-40 + screen.width) + ',height=' + eval(-40 + screen.height)); if (itwo.trim() != '') { newdatabit=' ' + mapurl.split('&data=')[1].substring(1).replace(/\~\]/g, '~,2]'); lastgeourl=(mapurl.split('&')[0].replace('/PHP/Map/map.php?title=', '/PHP/GeoChart/geo_chart.php?title=' + itwo + ';') + '&onclick=nowiki&aregexographicals=y&aregeographicals=' + areg + '&width=556&height=347&country=Places&popularity=Popularity&data=' + (newdatabit).replace(/\ /g, '%20')).replace('%20Places&', '%20Places' + enin + '&'); if (tp == '') { window.open(lastgeourl, '_blank', 'top=80,left=600,width=' + eval(-600 + screen.width) + ',height=' + eval(-40 + screen.height)); } else { window.open(lastgeourl, '_blank', 'top=' + eval(-400 + screen.height) + ',left=0,width=' + eval(-600 + screen.width) + ',height=400'); } } if (tp != '') { window.open(tp, '_blank', 'top=80,left=' + eval(-600 + screen.width) + ',width=600,height=600'); } } } jtwo=' '; } function withinit(abi) { var outi=''; var putin=true; for (var ii=0; ii') { putin=true; if (outi != '') { outi+=' '; } } else if (putin) { outi+=abi.substring(ii).substring(0,1); } } return outi.replace('rror :', 'rror:'); } function checkif(iois) { var morehuh=false; var twop=''; var what='', ourabi=''; var ourl=lastl; var ourlong=longlastl; if (iois.src.indexOf('tz_places.php') != -1) { var aconto = (iois.contentWindow || iois.contentDocument); if (aconto != null) { if (aconto.document) { aconto = aconto.document; } ourabi='' + aconto.body.innerHTML; if (aconto.body != null) { lastl=''; longlastl=''; if (ourlong != '') { what=withinit(ourabi).replace(/\)/g,') '); if (what.indexOf('rror:') != -1) { alert(what + ' ' + ourlong); } else if (ourlong.indexOf(': ') != -1) { morehuh=prompt(what + ' See these on a map? See Wikipedia page about ' + ourlong.split(':')[0] + ' by answering Y for just this or Yes for both this and the map. ' + ourlong, ' '); if (morehuh == null) { morehuh=''; } else if (morehuh.trim().toUpperCase() == 'Y') { morehuh=''; window.open('//en.wikipedia.org/wiki/' + encodeURIComponent(ourlong.split(':')[0]), '_blank', 'top=50,left=50,width=600,height=600'); } else if (morehuh.trim().toUpperCase().substring(0,1) == 'Y') { twop='//en.wikipedia.org/wiki/' + encodeURIComponent(ourlong.split(':')[0]); //window.open('//en.wikipedia.org/wiki/' + encodeURIComponent(ourlong.split(':')[0]), '_blank', 'top=50,left=50,width=600,height=600'); } else if (morehuh.trim() == '') { morehuh='n'; } else { morehuh='N'; } if (morehuh == '') { morehuh=false; } else { morehuh=true; } } else { morehuh=confirm(what + ' See these on a map? ' + ourlong); } } else { what=withinit(ourabi).replace(/\)/g,') '); if (what.indexOf('rror:') != -1) { alert(what.replace(/\)/g,') ') + ' ' + ourl); } else if (ourlong.indexOf(': ') != -1) { morehuh=prompt(what + ' See these on a map? See Wikipedia page about ' + ourlong.split(':')[0] + ' by answering Y for just this or Yes for both this and the map. ' + ourlong, ' '); if (morehuh == null) { morehuh=''; } else if (morehuh.trim().toUpperCase() == 'Y') { morehuh=''; window.open('//en.wikipedia.org/wiki/' + encodeURIComponent(ourlong.split(':')[0]), '_blank', 'top=50,left=50,width=600,height=600'); } else if (morehuh.trim().toUpperCase().substring(0,1) == 'Y') { twop='//en.wikipedia.org/wiki/' + encodeURIComponent(ourlong.split(':')[0]); //window.open('//en.wikipedia.org/wiki/' + encodeURIComponent(ourlong.split(':')[0]), '_blank', 'top=50,left=50,width=600,height=600'); } else if (morehuh.trim() == '') { morehuh='n'; } else { morehuh='N'; } if (morehuh == '') { morehuh=false; } else { morehuh=true; } } else { morehuh=confirm(what + ' See these on a map? ' + ourlong); } //} else { //morehuh=confirm(what.replace(/\)/g,') ') + ' See these on a map? ' + ourl); //} } } } } if (morehuh) { callmap(what, twop, jtwo); } } function canvasclick(e) { var topllong=-180.0; var topllat=90.0; var onepixelequals=izoom; //document.title='canvasclick'; e = e || window.event; e.preventDefault(); if (e.touches) { if (e.touches[0].pageX) { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].pageX * onepixelequals) + ',' + eval(topllat - e.touches[0].pageY * onepixelequals); drawc(e.touches[0].pageX, e.touches[0].pageY); thislat=eval(topllat - e.touches[0].pageY * onepixelequals); thislong=eval(topllong + e.touches[0].pageX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].pageX * onepixelequals)) + '&ntztontz=y'; } else { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].clientX * onepixelequals) + ',' + eval(topllat - e.touches[0].clientY * onepixelequals); drawc(e.touches[0].clientX, e.touches[0].clientY); thislat=eval(topllat - e.touches[0].clientY * onepixelequals); thislong=eval(topllong + e.touches[0].clientX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].clientX * onepixelequals)) + '&ntztontz=y'; } } else if (e.clientX || e.clientY) { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.clientX * onepixelequals) + ',' + eval(topllat - e.clientY * onepixelequals); drawc(e.pageX, e.pageY); thislat=eval(topllat - e.pageY * onepixelequals); thislong=eval(topllong + e.pageX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.clientX * onepixelequals)) + '&ntztontz=y'; } else { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.pageX * onepixelequals) + ',' + eval(topllat - e.pageY * onepixelequals); drawc(e.clientX, e.clientY); thislat=eval(topllat - e.clientY * onepixelequals); thislong=eval(topllong + e.clientX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.pageX * onepixelequals)) + '&ntztontz=y'; } } function defclick(e) { var topllong=-180.0; var topllat=90.0; var onepixelequals=izoom; //document.title='defclick'; e = e || window.event; e.preventDefault(); if (e.touches) { if (e.touches[0].pageX) { lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].pageX * onepixelequals) + ',' + eval(topllat - e.touches[0].pageY * onepixelequals); drawc(e.touches[0].pageX, e.touches[0].pageY); thislat=eval(topllat - e.touches[0].pageY * onepixelequals); thislong=eval(topllong + e.touches[0].pageX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].pageX * onepixelequals)) + '&ntztontz=y'; } else { lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].clientX * onepixelequals) + ',' + eval(topllat - e.touches[0].clientY * onepixelequals); drawc(e.touches[0].clientX, e.touches[0].clientY); thislat=eval(topllat - e.touches[0].clientY * onepixelequals); thislong=eval(topllong + e.touches[0].clientX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].clientX * onepixelequals)) + '&ntztontz=y'; } } else if (e.clientX || e.clientY) { lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.clientX * onepixelequals) + ',' + eval(topllat - e.clientY * onepixelequals); drawc(e.pageX, e.pageY); thislat=eval(topllat - e.pageY * onepixelequals); thislong=eval(topllong + e.pageX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.clientX * onepixelequals)) + '&ntztontz=y'; } else { lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.pageX * onepixelequals) + ',' + eval(topllat - e.pageY * onepixelequals); drawc(e.clientX, e.clientY); thislat=eval(topllat - e.clientY * onepixelequals); thislong=eval(topllong + e.clientX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.pageX * onepixelequals)) + '&ntztontz=y'; } } function areado() { var ars=document.getElementsByTagName('area'); var cs=[]; for (var ij=0; ij= 2) { ars[ij].coords+=',' + cs[0] + ',' + cs[1]; } } } "; $htmlis.="  

GeoJSON World Countries

RJM Programming - January, 2023

Thanks to https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_admin_0_scale_rank.geojson

"; $geojsonis=file_get_contents('countries.geojson'); $parts=explode("]]", $geojsonis); $globalattr=""; $mappings=file_get_contents('http://gist.github.com/tadast/8827699'); // thanks if (strpos($mappings, '>IN') !== false) { $mappings.='INKASEHSAHSOSOLSSSDSXKKOSCYCYN'; } for ($i=0; $i<(-1 + sizeof($parts)); $i++) { if (strpos($parts[$i], '"sr_sov_a3":"') !== false) { $globalattr=' data-iso3="' . explode('"', explode('"sr_sov_a3":"', $parts[$i])[1])[0] . '"'; if (strpos($mappings, '>' . explode('"', explode('"sr_sov_a3":"', $parts[$i])[1])[0] . '') !== false) { $iparts=explode('>' . explode('"', explode('"sr_sov_a3":"', $parts[$i])[1])[0] . '', $mappings); $globalattr.=' data-iso2="' . explode('>', explode('', $iparts[0])[-2 + sizeof(explode('', $iparts[0]))])[-1 + sizeof(explode('>', explode('', $iparts[0])[-2 + sizeof(explode('', $iparts[0]))]))] . '"'; } else if (substr(explode('"', explode('"sr_sov_a3":"', $parts[$i])[1])[0],-1,1) >= '0' && substr(explode('"', explode('"sr_sov_a3":"', $parts[$i])[1])[0],-1,1) <= '9') { $globalattr.=' data-iso2="' . substr(explode('"', explode('"sr_sov_a3":"', $parts[$i])[1])[0],0,2) . '"'; } } if (strpos($parts[$i], '"sr_subunit":"') !== false) { $globalattr.=' data-cname="' . explode('"', explode('"sr_subunit":"', $parts[$i])[1])[0] . '"'; } $coords=str_replace('[','',str_replace(']','',explode('[[' , $parts[$i])[-1 + sizeof(explode('[[' , $parts[$i]))])); $newcoords=$coords; if (!$dolatlong || 1 == 1) { $lls=explode(",", $coords); $newcoords=""; for ($j=0; $j\n"; //echo "\n"; } $bitsare=explode("}", $htmlis); $onebit=$bitsare[0] . "}"; $newh=str_replace($onebit, substr($onebit,0,(-1 + strlen($onebit))) . " context.stroke(); \n elem.style.cursor='pointer'; \n} \n" . $midbit, str_replace("", $abit . "", $htmlis)); if (strpos($newh, "function ouralert(") === false) { $newh=str_replace("", "\n" . $midbit . "\n" . "", $newh); } if (!file_exists('countries.html') && strpos(('' . $_SERVER['QUERY_STRING']), 'zoom=') === false && strpos(('' . $_SERVER['QUERY_STRING']), 'uselatlaong=') === false) { file_put_contents('countries.html', $newh); } echo $newh; ?>