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 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='';
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(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;
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) {
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=50,left=50,width=600,height=600');
} else {
mapwo=window.open(mapurl, '_blank', 'top=50,left=50,width=600,height=600');
}
}
}
function checkif(iois) {
var morehuh=false;
var what='';
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; }
if (aconto.body != null) {
lastl='';
longlastl='';
if (ourlong != '') {
what=aconto.body.innerText.replace(/\)/g,') ');
if (aconto.body.innerText.indexOf('rror:') != -1) {
alert(aconto.body.innerText.replace(/\)/g,') ') + ' ' + ourlong);
} else {
morehuh=confirm(aconto.body.innerText.replace(/\)/g,') ') + ' See these on a map? ' + ourlong);
}
} else {
what=aconto.body.innerText.replace(/\)/g,') ');
if (aconto.body.innerText.indexOf('rror:') != -1) {
alert(aconto.body.innerText.replace(/\)/g,') ') + ' ' + ourl);
} else {
morehuh=confirm(aconto.body.innerText.replace(/\)/g,') ') + ' See these on a map? ' + ourl);
}
}
}
}
}
if (morehuh) { callmap(what); }
}
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 Coastline
RJM Programming - January, 2023
";
$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";
}
if (!file_exists('regions.html') && strpos(('' . $_SERVER['QUERY_STRING']), 'zoom=') === false && strpos(('' . $_SERVER['QUERY_STRING']), 'uselatlaong=') === false) {
file_put_contents('regions.html', str_replace($onebit, substr($onebit,0,(-1 + strlen($onebit))) . " context.stroke(); \n elem.style.cursor='pointer'; \n} \n " . $midbit, str_replace("", $abit . "", $htmlis)));
}
$bitsare=explode("}", $htmlis);
$onebit=$bitsare[0] . "}";
echo str_replace($onebit, substr($onebit,0,(-1 + strlen($onebit))) . " context.stroke(); \n elem.style.cursor='pointer'; \n} \n " . $midbit, str_replace("", $abit . "", $htmlis));
?>