{"id":62964,"date":"2024-03-13T03:01:05","date_gmt":"2024-03-12T17:01:05","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=62964"},"modified":"2024-03-14T12:23:08","modified_gmt":"2024-03-14T02:23:08","slug":"google-geo-chart-and-map-chart-hashtag-emailing-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/google-geo-chart-and-map-chart-hashtag-emailing-tutorial\/","title":{"rendered":"Google Geo Chart and Map Chart Hashtag Emailing Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/australian_waterfalls.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Google Geo Chart and Map Chart Hashtag Emailing Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/geomap_post_emailing.gif\" title=\"Google Geo Chart and Map Chart Hashtag Emailing Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Google Geo Chart and Map Chart Hashtag Emailing Tutorial<\/p><\/div>\n<p>Before we got sidetracked, but along the same &#8220;where of life&#8221; themes, before the latest recent web application predilections &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/HTMLCSS\/earth_scanner.html\" title=\"Earth Scanner\">Earth Scanner<\/a><\/li>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/HTMLCSS\/regions_via_countries.html\" title=\"Region Picker\">Region Picker<\/a><\/li>\n<\/ul>\n<p> &#8230; we were delving into passing on work from the <a 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.\" href=\"https:\/\/developers.google.com\/chart\/interactive\/docs\/index\" target=\"_blank\">Google Chart<\/a>&#8216;s <a title=\"Google Chart Map Chart information from Google\" href=\"https:\/\/developers.google.com\/chart\/interactive\/docs\/gallery\/map\" target=\"_blank\">Map Chart<\/a> to the Google Chart <a target=_blank title='Google Chart Geo Chart information from Google' href='https:\/\/developers.google.com\/chart\/interactive\/docs\/gallery\/geochart'>Geo Chart<\/a> and <a target=_blank title='Google Charts Image Chart' href='https:\/\/developers.google.com\/chart\/image\/docs\/gallery\/chart_gall'>Image Chart<\/a> Map Chart more often, where we started that thread (at <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/google-chart-image-chart-map-chart-mainstream-primer-tutorial\/' title='Google Chart Image Chart Map Chart Mainstream Primer Tutorial'>Google Chart Image Chart Map Chart Mainstream Primer Tutorial<\/a> at the end of last year) with a three point plan <font size=1>(which became four point <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/google-chart-image-chart-map-chart-geo-chart-click-tutorial\/' title='Google Chart Image Chart Map Chart Geo Chart Click Tutorial'><font color=blue>two days later<\/font><\/a>)<\/font> &#8230;<\/p>\n<blockquote cite='https:\/\/www.rjmprogramming.com.au\/ITblog\/google-chart-image-chart-map-chart-geo-chart-click-tutorial\/'>\n<ol>\n<li>Help itself \u2026 map.php \u2026 phase 1<\/li>\n<li>Redirect to Image Chart Map Chart \u2026 map.php and\/or geo_chart.php \u2026 just after first prompt \u2026 phase 2<\/li>\n<li>Caller form method=POST map.php action interventions at onsubmit event \u2026 non map.php \u2026 phase 3<\/li>\n<li><font color=\"blue\">Transfer the onclick prompt window functionality over to geo_chart.php \u2026 phase 4<\/font><\/li>\n<\/ol>\n<\/blockquote>\n<p>And then yesterday&#8217;s work in <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/earth-bearing-distance-missing-two-earth-scanner-integration-tutorial\/' title='Earth Bearing Distance Missing Two Earth Scanner Integration Tutorial'>Earth Bearing Distance Missing Two Earth Scanner Integration Tutorial<\/a> involving the Missing Two web application&#8217;s interfacing to the Google Chart Map Chart saw a more happy interfacing with this Map Chart, and reminding us with both &#8230;<\/p>\n<ul>\n<li>Google Charts Map Chart<\/li>\n<li>Google Charts Geo Chart<\/li>\n<\/ul>\n<p> &#8230; how on occasions we could have large data set scenarios relying on PHP $_POST data (via form method=POST (or you can use Ajax FormData post) arrangements) that had not passed on their data parts when the user clicked the &#8220;Email&#8221; link down the bottom.  But ever since that happy discovery from around about the time of <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/earth-scanner-sharing-itinerary-detail-tutorial\/' title='Earth Scanner Sharing Itinerary Detail Tutorial'>Earth Scanner Sharing Itinerary Detail Tutorial<\/a> that &#8230;<\/p>\n<ul>\n<li>hashtagging &#8230; was the friend of &#8230;<\/li>\n<li>&#8220;a&#8221; &#8220;mailto:&#8221; and\/or &#8220;sms:&#8221; link href<sub>s<\/sub> &#8230; replacing the need for &#8230;<\/li>\n<li>PHP mail via a local mail server methodologies &#8230; when the email body is a single link whose length was greater than about 850 (ie. no such stringent limitations with &#8220;just clientside&#8221; hashtagging <font size=1>(which we&#8217;re yet to know what the limit is,  but it seems <\/font><font size=6>huge<\/font><font size=1>)<\/font>)<\/li>\n<\/ul>\n<p> &#8230; and &#8230; spoiler alert &#8230; we could not break <font size=1>(where we do not count as broken the clicking of a &#8220;Message clipped&#8221; message link, which we always click to fully show the whole link, as a warning from your email client application (eg. <a target=_blank href='http:\/\/gmail.com'>Gmail<\/a>))<\/font> it with any large amounts of data from our <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/php-wikipedia-australian-list-integration-tutorial\/' title='PHP Wikipedia Australian List Integration Tutorial'>PHP Wikipedia Australian List Integration Tutorial<\/a> &#8220;peer to peer&#8221; suite of linked PHP <a target=_blank title='Wikipedia List web applications' href='https:\/\/www.rjmprogramming.com.au\/PHP\/australian_waterfalls.php'>web application<\/a>s passing large amounts of data to those Google Charts and emailing that on to an emailee recipient.  Good news indeed!<\/p>\n<p>The changes feature &#8230;<\/p>\n<table>\n<tr>\n<th>Collect a method=POST (perhaps large data set) into a potentially useful (later) PHP variable hashtag part to an &#8220;a&#8221; &#8220;mailto:&#8221; href &#8230;<\/th>\n<\/tr>\n<tr>\n<td>\n&lt;?php<br \/>\n<code><br \/>\n$shto=\"\";<br \/>\n<br \/>\nif (isset($_POST['title'])) {<br \/>\n        foreach ($_POST as $name => $val) {<br \/>\n          if (strpos($val, 'data:') !== false) {<br \/>\n            $fval=urlencode($val); \/\/str_replace(\" \", \"%20\", str_replace(\"'\", urlencode(\"'\"), str_replace('\"', urlencode('\"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&#038;', urlencode('&#038;'), $val))))))));\n          } else {\n            $fval=str_replace('+','%20',urlencode(str_replace('   ',' + ',str_replace('+',' ',$val)))); \/\/str_replace(\" \", \"%20\", str_replace(\"'\", urlencode(\"'\"), str_replace('\"', urlencode('\"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&#038;', urlencode('&#038;'), $val))))))));\n          }         \n          if ($shto == \"\") {\n            $shto=\"#\" . $name . \"=\" . $fval; \/\/str_replace(\" \", \"%20\", str_replace(\"'\", urlencode(\"'\"), str_replace('\"', urlencode('\"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&#038;', urlencode('&#038;'), $val))))))));\n          } else {\n            $shto.=\"&#038;\" . $name . \"=\" . $fval; \/\/str_replace(\" \", \"%20\", str_replace(\"'\", urlencode(\"'\"), str_replace('\"', urlencode('\"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&#038;', urlencode('&#038;'), $val))))))));\n          }\n        }\n}\n<\/code><br \/>\n?&gt;\n<\/td>\n<\/tr>\n<tr>\n<th>Up the top of where PHP is writing out the Javascript, checking for an email derived URL with huge hashtag we turn into a form method=POST scenario for the user clicking the email body huge link ...<\/th>\n<\/tr>\n<tr>\n<td>\n<code><br \/>\nvar dependssuffix='';<br \/>\nif (('' + location.hash).indexOf('&data=') != -1) {<br \/>\n dependssuffix=('' + location.hash);<br \/>\n}<br \/>\n&lt;?php<br \/>\n    if ($shto != \"\") {<br \/>\n      echo \" if (typeof sethash == \\\"function\\\") {  sethash(encodeURIComponent(\\\"\" . $shto . \"\\\"));  } \" . \"\\n\";<br \/>\n    }<br \/>\n<br \/>\necho \"<br \/>\n var lhpassed=('' + location.hash);<br \/>\n if ((1 == 1 || document.URL.split('#')[0].indexOf('?') == -1) && lhpassed.indexOf('&data=') != -1) {<br \/>\n  if (3 == 3) { \/\/ good for new style of hashtagged email<br \/>\n  var gformoh='&lt;iframe name=lastgif id=lastgif style=\\\"position:absolute;width:100%;height:100%;z-index:897;top:0px;left:0px;\\\" src=&gt;&lt;\/iframe&gt;&lt;br&gt;&lt;form style=display:none; target=_self method=POST action=\\\"' + document.URL.split('#')[0] + '\\\"&gt;&lt;input id=gformsubis type=submit value=Submit style=display:none;&gt;&lt;\/input&gt;&lt;\/form&gt;';<br \/>\n  var fldsare=lhpassed.replace(\/^\\#\/g,'').split('=');<br \/>\n  for (var ifldsare=1; ifldsare&lt;fldsare.length; ifldsare++) {<br \/>\n   gformoh=gformoh.replace('&lt;\/form&gt;','&lt;input type=hidden name=\\\"' + fldsare[eval(-1 + ifldsare)].split('&')[eval(-1 + fldsare[eval(-1 + ifldsare)].split('&').length)] + '\\\" value=\\\"' + (fldsare[ifldsare].split('&')[0]) + '\\\"&gt;&lt;\/input&gt;&lt;\/form&gt;');<br \/>\n  }<br \/>\n  setTimeout(function() {<br \/>\n  document.body.innerHTML+=gformoh;<br \/>\n  document.getElementById('gformsubis').click(); }, 7000);<br \/>\n  } else {<br \/>\n  var gzhr = new XMLHttpRequest();<br \/>\n  var gzform=new FormData();<br \/>\n  var fldsare=lhpassed.replace(\/^\\#\/g,'').split('=');<br \/>\n  for (var ifldsare=1; ifldsare&lt;fldsare.length; ifldsare++) {<br \/>\n   gzform.append(fldsare[eval(-1 + ifldsare)].split('&')[eval(-1 + fldsare[eval(-1 + ifldsare)].split('&').length)], decodeURIComponent(fldsare[ifldsare].split('&')[0]));<br \/>\n  }<br \/>\n  gzhr.open('post', document.URL.split('#')[0], true);<br \/>\n  gzhr.send(gzform);<br \/>\n  }<br \/>\n }<br \/>\n\";<br \/>\n<br \/>\n?&gt;<br \/>\n<\/code>\n<\/td>\n<\/tr>\n<tr>\n<th>All <i>location.search.<\/i> strings become, <font color=blue>for example<\/font> ...<\/th>\n<\/tr>\n<tr>\n<td>\n&lt;?php echo \"<br \/>\n<code><br \/>\n   var ansis=<font color=blue>(<\/font>location.search<font color=blue> + '\" . $shto . \"')<\/font>.split('val' + pnum + '=')[1] ? decodeURIComponent(decodeURIComponent(<font color=blue>(<\/font>location.search<font color=blue> + '\" . $shto . \"')<\/font>.split('val' + pnum + '=')[1].split('&')[0]).replace(\/\\+\/g,' ')) : '';<br \/>\n<\/code><br \/>\n\"; ?&gt;\n<\/td>\n<\/tr>\n<tr>\n<th>Javascript functions that are wrappers to Javascript prompt window scenarios <font color=blue>need<\/font> ...<\/th>\n<\/tr>\n<tr>\n<td>\n&lt;?php echo \"<br \/>\n<code><br \/>\n  function ourprompt(ourp1, ourp2) {<br \/>\n      <font color=blue>if (('' + location.hash).replace('&data=') != ('' + location.hash)) {   return ourp2; } <\/font><br \/>\n      var iop=0;<br \/>\n      tzpn='';<br \/>\n      \/\/ more code here<br \/>\n        thisris=prompt(ourp1, ourp2);<br \/>\n      \/\/ more code here<br \/>\n      return thisris;<br \/>\n  }<br \/>\n<\/code><br \/>\n\"; ?&gt;\n<\/td>\n<\/tr>\n<tr>\n<th>New <i>if<\/i> for code involving no data passed in $_GET[] nor $_POST[] <font color=blue>but huge hashtag (via email)<\/font> ...<\/th>\n<\/tr>\n<tr>\n<td>\n&lt;?php<br \/>\n<code><br \/>\n        <font color=blue>echo ' if ((\"\" + location.hash).replace(\"&data=\") == (\"\" + location.hash)) {  ' . \"\\n\";<\/font><br \/>\n<br \/>\n        echo ' datalineprefix = \" \"; ' . \"\\n\";<br \/>\n        echo ' datalinesuffix = \"\"; ' . \"\\n\";<br \/>\n        echo ' var prethisline = \"\", fti=false, extra = \"\"; ' . \"\\n\";<br \/>\n        echo ' var thisline = 1, gc_m=\"\", gtitle=\"\", glabel=\"\", gvalue=\"\"; ' . \"\\n\";<br \/>\n      \/\/ more code here going on to interactive Javascript prompt window asks<br \/>\n      \/\/ more code here<br \/>\n        echo \"} \\n\";<br \/>\n<br \/>\n        <font color=blue>echo \"} \\n\";<\/font><br \/>\n<\/code><br \/>\n?&gt;\n<\/td>\n<\/tr>\n<tr>\n<th>New Javascript function helpers ...<\/th>\n<\/tr>\n<tr>\n<td>\n&lt;?php echo \"<br \/>\n<code><br \/>\nvar dependssuffix='';<br \/>\n<br \/>\nfunction sethash(towhat) {<br \/>\n  if (towhat.indexOf(encodeURIComponent('#')) == 0) {<br \/>\n    dependssuffix=decodeURIComponent(towhat);<br \/>\n  } else {<br \/>\n    dependssuffix=towhat;<br \/>\n  }<br \/>\n}<br \/>\n<br \/>\nfunction depends(ins) {<br \/>\n  if (ins.indexOf('?') == -1 && ins.indexOf('#') == -1 && dependssuffix != '') {<br \/>\n   if (dependssuffix.indexOf('?') == 0) {<br \/>\n     return (ins + '#' + dependssuffix.substring(1));<br \/>\n   } else if (dependssuffix.indexOf('#') == 0) {<br \/>\n     return (ins + dependssuffix);<br \/>\n   } else {<br \/>\n     return (ins + '#' + dependssuffix);<br \/>\n   }<br \/>\n  }<br \/>\n  return ins;<br \/>\n}<br \/>\n<\/code><br \/>\n\"; ?&gt;\n<\/td>\n<\/tr>\n<tr>\n<th>Add hashtag suffix to \"a\" \"mailto:\" link href attribute <font color=blue>as applicable<\/font> ...<\/th>\n<\/tr>\n<tr>\n<td>\n&lt;?php<br \/>\n<code><br \/>\n      echo '&lt;a id=\"amapid\" title=\"Another Map\" href=\"' . $https . 'www.rjmprogramming.com.au\/PHP\/Map\/map.php\"&gt;Another&lt;\/a&gt; &lt;a id=\"amapidgeo\" title=\"Another Geo Map\" style=\"text-decoration:underline;cursor:pointer;\" onclick=gogeo(\"' . $https . 'www.rjmprogramming.com.au\/PHP\/GeoChart\/geo_chart.php\");&gt;Geo&lt;\/a&gt; &lt;a id=\"amapidtwo\" title=\"Another Map\" href=\"' . $https . 'www.rjmprogramming.com.au\/PHP\/Map\/map.php\"&gt;Map?&lt;\/a&gt;' . '&nbsp;&nbsp;&lt;a onclick=ahdepends(this); href=\"MAILTO:fillin.email@address?subject=Google%' . '20Chart%' . '20Snapshot&body=' . urlencode(\"HTTP:\/\/\" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']<font color=blue> . $shto<\/font>) . '\" style=\"display:inline;\" title=\"To email a snapshot of this Google Chart click me.\" id=\"remail\"&gt;Email snapshot of Google Chart ...&lt;\/a&gt;' . \" \\n\";<br \/>\n<\/code><br \/>\n?&gt;<br \/>\n<\/table>\n<p>Codewise ...<\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/Map\/map.php--------------------------------------------------GETME\">we changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Map\/map.php--------------------------------------------------GETME\">map.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Map\/map.php\">Map Chart interfacer<\/a> ...<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/gchartgen.js---------------------GETME\">we changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/gchartgen.js---------------------GETME\">gchartgen.js<\/a> external Javascript ... called by ...<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/GeoChart\/geo_chart.php--------------------------------------------------------------------------------GETME\">we changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/GeoChart\/geo_chart.php--------------------------------------------------------------------------------GETME\">geo_chart.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/GeoChart\/geo_chart.php\">Geo Chart interfacer<\/a><\/li>\n<\/ul>\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='#d62964' onclick='var dv=document.getElementById(\"d62964\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/hashtag\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d62964' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Before we got sidetracked, but along the same &#8220;where of life&#8221; themes, before the latest recent web application predilections &#8230; Earth Scanner Region Picker &#8230; we were delving into passing on work from the Google Chart&#8216;s Map Chart to the &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/google-geo-chart-and-map-chart-hashtag-emailing-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,33,37],"tags":[2915,211,4286,290,380,4700,452,1619,518,2229,557,3961,2666,4699,4562,652,4698,1807,710,2240,2126,1830,3220,861,932,997,1319,1345,1418,1431],"class_list":["post-62964","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-software","category-tutorials","tag-_post","tag-click","tag-clientside","tag-data","tag-email","tag-emeil-client","tag-form","tag-geo-chart","tag-google-chart","tag-hash","tag-hashtag","tag-hashtagging","tag-href","tag-huge","tag-image-chart","tag-javascript","tag-large","tag-link","tag-list","tag-mail-server","tag-map-chart","tag-method","tag-navigate","tag-onclick","tag-php","tag-programming","tag-tutorial","tag-url","tag-webpage","tag-wikipedia"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/62964"}],"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=62964"}],"version-history":[{"count":14,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/62964\/revisions"}],"predecessor-version":[{"id":62990,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/62964\/revisions\/62990"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=62964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=62964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=62964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}