0) { $factor=str_replace('+','',urldecode($_GET['zoom'])); } } if (isset($_GET['uselatlaong'])) { $dolatlong=true; $longoff=0.0; $latoff=0.0; } else if (file_exists('regions.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('regions.html')); exit; } else { echo file_get_contents('regions.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 Coastline var jzoom=1.0, 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; var yourtzlist=''; var rivers='', arivers=[], iguess=-1, isofar=' ', jscore=0, jgoes=0, elema=null, contexta=null, rectisleft=0, rectistop=0; var populations='', apopulations=[], jguess=-1, jsofar=' ', isokto=true, both=false, jlastn=''; function onl() { if (izoom != 1.0) document.body.style.zoom=('' + eval(izoom * 100.0) + '%'); elem = document.getElementById('mycanvas'); elem.style.cursor='progress'; elema = document.getElementById('myacanvas'); context = elem.getContext('2d'); contexta = elema.getContext('2d'); context.strokeStyle = '#000000'; context.lineWidth = 0.4; } "; $midbit=" function ouralert(inclist) { if (inclist.indexOf(',') != -1) { var cls=inclist.replace('Longitude,Latitude coordinates are ','').split(','); longlastl=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; if (centerX > eval(izoom * elem.width) || centerY > eval(izoom * elem.height)) return false; 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.lineWidth = 2; context.strokeStyle = '#003300'; context.stroke(); return true; } function callmap(inintzl) { 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=''; var tzls=intzl.split('/'); 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); mapwo=window.open(mapurl, '_blank', 'top=20,left=20,width=' + eval(-40 + screen.width) + ',height=' + eval(-40 + screen.height)); } else { mapwo=window.open(mapurl, '_blank', 'top=20,left=20,width=' + eval(-40 + screen.width) + ',height=' + eval(-40 + screen.height)); } } } 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 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 { 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 { morehuh=confirm(what.replace(/\)/g,') ') + ' See these on a map? ' + ourl); } } } } } if (morehuh) { callmap(what); } } function oldcanvasclick(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 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); if (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); thislat=eval(topllat - eval(-rectistop + e.touches[0].pageY) * onepixelequals); thislong=eval(topllong + eval(-rectisleft + e.touches[0].pageX) * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; } } else { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].clientX * onepixelequals) + ',' + eval(topllat - e.touches[0].clientY * onepixelequals); if (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); thislat=eval(topllat - eval(-rectis.top + e.touches[0].clientY) * onepixelequals); thislong=eval(topllong + eval(-rectis.left + e.touches[0].clientX) * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; } } } else if (e.pageX || e.pageY) { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.clientX * onepixelequals) + ',' + eval(topllat - e.clientY * onepixelequals); if (drawc(e.pageX, e.pageY)) { //thislat=eval(topllat - e.pageY * onepixelequals); //thislong=eval(topllong + e.pageX * onepixelequals); thislat=eval(eval(eval(topllat * onepixelequals - eval(-rectistop + e.pageY) * 1)) / onepixelequals); thislong=eval(eval(eval(topllong * onepixelequals + eval(-rectisleft + e.pageX) * 1)) / onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; } } else { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.pageX * onepixelequals) + ',' + eval(topllat - e.pageY * onepixelequals); if (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('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; } } } function defclick(e) { canvasclick(e); return true; 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]; } } } function populaterivers() { var found=-1, ifnd=0; var rbits=rivers.split(']]}}'); var murraytotal=0.0; rivers=''; var lastn='', hdrbit='', hbits=[]; for (var irr=1; irr<(-1 + rbits.length); irr++) { hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + ''; //alert(hdrbit); hbits=hdrbit.split(',' + String.fromCharCode(34) + 'name' + String.fromCharCode(34) + ':' + String.fromCharCode(34)); if (hbits.length > 1) { if ((!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) || eval('' + arivers.length) <= 200)) { if (lastn != hbits[1].split(String.fromCharCode(34))[0]) { lastn=hbits[1].split(String.fromCharCode(34))[0]; found=-1; if (arivers.length > 0) { for (ifnd=0; ifnd= 0) { if (lastn == 'Murray') { console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { arivers[found]+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } } else { if (lastn == 'Murray') { console.log(lastn + ':' + hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } arivers.push(lastn + ':' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''))); } } else if (1 == 1 || !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { if (lastn == 'Murray') { console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } arivers[-1 + arivers.length]+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } } } } rbits=[]; lastn=''; //if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { // alert(arivers.length); //} //return; //plotariver(getariver()); if (!idone) { idone=true; getariver(); } } function lessit(maybe) { var altmaybe='', altmaybed=''; if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { var acsvs=maybe.split(','); for (var ic=0; ic 1) { if (jlastn != hbits[1].split(String.fromCharCode(34))[0]) { jlastn=hbits[1].split(String.fromCharCode(34))[0]; found=-1; if (apopulations.length > 0) { for (ifnd=0; ifnd= 0) { if (jlastn == 'Sydney') { console.log(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } apopulations[found]+=' ' + lessit(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } else { if (jlastn == 'Sydney') { console.log(jlastn + ':' + hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } apopulations.push(jlastn + ':' + lessit(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''))); } } else { if (jlastn == 'Sydney') { console.log(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } apopulations[-1 + apopulations.length]+=' ' + lessit(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } } } rbits=[]; jlastn=''; //return; //plotariver(getariver()); } function getariver() { //for (var ih=0; ih 0) { iguess=Math.floor(Math.random() * arivers.length); if (isofar.indexOf(',' + iguess + ',') != -1) { while (isofar.indexOf(',' + iguess + ',') != -1) { iguess=Math.floor(Math.random() * arivers.length); } } isofar+=',' + iguess + ','; lastn=arivers[iguess].split(':')[0]; plotariver(iguess); setTimeout(askariver, 8000); return iguess; } } function getapopulation() { //for (var ih=0; ih= 1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='population'; } jgoes++; jscore++; another=confirm('Will pay that. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (lastn.toLowerCase().indexOf(retthis.toLowerCase()) == -1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='population'; } jgoes++; another=confirm('Bad luck. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (lastn.toLowerCase() == retthis.toLowerCase()) { if (retthis.trim() != retthis && !origboth) { both=true; thing='population'; } jgoes++; jscore++; another=confirm('Well done! Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (retthis.trim().length >= 1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='population'; } jgoes++; another=confirm('Bad luck. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else { if (retthis.trim() != retthis && !origboth) { both=true; thing='population'; } jgoes++; jscore++; another=confirm('Will pay that. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } if (both && !origboth) { isitok=true; getapopulation(); return ''; } else if (both) { return ''; } if (another) { if (both) { getariver(); getapopulation(); } else { getariver(); } } else { contexta.clearRect(0,0,360,180); } return ''; } function plotariver(which) { if (both) { isokto=true; } if (isokto) { contexta.clearRect(0,0,360,180); } if (both) { isokto=false; } lastn=arivers[which].split(':')[0]; var rest=arivers[which].split(':')[1]; var consolelog=''; console.log(rest); var restlonglat=[]; //rest.split(','); var therest=rest.split(' '); //alert(eval(180.0 + eval('' + restlonglat[0])) + ',' + eval(90.0 - eval('' + restlonglat[1]))); for (var jrrr=0; jrrr= eval('' + restlonglat.length)) { context.stroke(); } } } contexta.stroke(); } } function getthejson(iois) { if (iois.src.indexOf('.geojson') != -1) { var aconto = (iois.contentWindow || iois.contentDocument); if (aconto != null) { if (aconto.document) { aconto = aconto.document; } if (aconto.body != null) { if (iois.src.indexOf('rivers.geojson') != -1) { rivers='' + aconto.body.innerHTML; setTimeout(populaterivers, 500); iois.src='./population.geojson'; } else if (iois.src.indexOf('population.geojson') != -1) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { populations='' + aconto.body.innerHTML; setTimeout(populatepopulations, 500); } } } } } function askapopulation() { var another=false; var origboth=both; var midbit=''; var thing='population'; if (!both) { midbit='Append spaces to also answer a question regarding the Rivers Quiz, or R to just do Rivers Quiz.'; } else { thing='river'; } var retthis=prompt('What is the name of this new red population area plotted on the world map? ' + midbit + ' Enter ? to get given more time looking at (longitude,latitude) = (' + apopulations[jguess].split(':')[1].split(',')[0] + ',' + apopulations[jguess].split(':')[1].split(',')[1] + ')', ''); if (retthis == null) { both=false; jgoes++; another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (retthis.toLowerCase().trim() == 'r') { both=false; isokto=true; getariver(); return ''; } else if (retthis.trim() == '?') { if (retthis.trim() != retthis && !origboth) { both=true; } setTimeout(askapopulation, 9000); return ''; } else if (retthis.trim() == '') { if (retthis != '' && !origboth) { thing='river'; } jgoes++; another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); if (retthis != '' && !origboth) { isokto=true; both=true; getariver(); } } else if (jlastn.toLowerCase().indexOf(retthis.toLowerCase()) != -1 && jlastn.toLowerCase() == retthis.toLowerCase() && retthis.trim().length >= 1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='river'; } jgoes++; jscore++; another=confirm('Will pay that. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (jlastn.toLowerCase().indexOf(retthis.toLowerCase()) == -1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='river'; } jgoes++; another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (jlastn.toLowerCase() == retthis.toLowerCase()) { if (retthis.trim() != retthis && !origboth) { both=true; thing='river'; } jgoes++; jscore++; another=confirm('Well done! Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (retthis.trim().length >= 1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='river'; } jgoes++; another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else { if (retthis.trim() != retthis && !origboth) { both=true; thing='river'; } jgoes++; jscore++; another=confirm('Will pay that. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } if (both) { contexta.clearRect(0,0,360,180); } if (both && !origboth) { isitok=true; getariver(); return ''; } if (another) { if (both) { getariver(); getapopulation(); } else { getapopulation(); } } else { contexta.clearRect(0,0,360,180); } return ''; } function plotapopulation(which) { if (isokto) { contexta.clearRect(0,0,360,180); } //if (both) { isokto=true; } jlastn=apopulations[which].split(':')[0]; var rest=apopulations[which].split(':')[1]; var restlonglat=[]; //rest.split(','); restlonglat=rest.split(','); if (eval('' + restlonglat.length) >= 2) { contexta.fillStyle = 'red'; contexta.fillRect(eval(180.0 + eval('' + restlonglat[0])), eval(90.0 - eval('' + restlonglat[1])),1,1); contexta.fill(); } } function zoomin() { if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { jzoom*=2; document.getElementById('myviewport').setAttribute('content', 'width=device-width, initial-scale=' + eval(jzoom * izoom) + ', minimum-scale=0.1, maximum-scale=8, user-scalable=yes'); window.scrollTo(0,0); //izoom*=2; } else { //if (1 == 1) { // alert('Please use your web browser View Menu options Zoom In or Zoom Out'); //} else { document.body.style.zoom=('' + eval(izoom * 200.0) + '%'); izoom*=2; //location.href=document.URL.split('?')[0].split('#')[0] + '?zoom=' + encodeURIComponent('' + eval(2 * izoom)); //} } } "; $htmlis.="  

GeoJSON World Coastline

RJM Programming 🔎 January, 2023

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

"; $geojsonis=file_get_contents('coastline.geojson'); $parts=explode("]]", $geojsonis); for ($i=0; $i<(-1 + sizeof($parts)); $i++) { $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('regions.html') && strpos(('' . $_SERVER['QUERY_STRING']), 'zoom=') === false && strpos(('' . $_SERVER['QUERY_STRING']), 'uselatlaong=') === false) { file_put_contents('regions.html', $newh); } echo $newh; ?>