Tag Archives: geographicals

Australian Postcode Place Modal Backdrop Popup Move Tutorial

Today’s extension to yesterday’s Australian Postcode Place Modal Backdrop Popup Tutorial predominantly CSS themes is the “prove to ourselves” working of … window.open based Window with that 3rd argument popup positioning used … Window object method moveTo … when that Window URL is … cross-domain … and me being the optimist that I am thought though our Google Directions URL involved was cross-domain we would be able to harness the cuteness of moveTo so that it could ring around the Modal Backdrop Popup over time. Alas, no such luck, and guess there are good (web browser) security reasons here. Instead what we did was … window.open based Window with that 3rd argument popup positioning used … that [last Window object].close() then another window.open based Window with that 3rd argument popup new positioning … for that Window URL that is … cross-domain Make the scenario not be cross-domain and no worries regarding Window object method moveTo method. And so, again, feel free to try the changed australia_place_crowfly_distances.php‘s live run link. Previous relevant Australian Postcode Place Modal Backdrop Popup Tutorial is shown below. Yesterday’s Australian Postcode Place Nearby Tutorial had us attending to an “Australian Postcode Nearby” subset of functionality in terms of the event … onmouseover … or “on hover” which programmers out there will know, in “mobile land” is about as useful as a screen door on a submarine … so, today, we attend to some event logic everybody relates to, that being … onclick … and today, for an aesthetic change, we’re going to show our Google Charts Map Chart interfacing functionality in a Modal Backdrop Popup “window” (ie. not a window as such, but more an HTML nested div that acts like a “modal” (has to be attended to) popup). Consequently, that Javascript nearestto function changed as per … function nearestto(ogset, gset) { var iou=0, outset=gset, this_lat=0.0, this_long=0.0, this_diff=-1.0, smallest_diff=-1.0, largest_diff=-1.0, smallest_num=0; var sofar=’;’, pa=”; var things=[]; ourarguments=’?title=’ + encodeURIComponent(‘Australian Postcode Places Nearby ‘ + ogset.innerHTML) + ‘&onclick=y&label=%5b%27Lat%27,&value=%27Lon%27,%20%27Name%27%5d&data=’; if (postcodea.length > 1) { this_long=eval(gset.split(‘ ‘)[0].split(‘,’)[1]); this_lat=eval(gset.split(‘ ‘)[0].split(‘,’)[0]); for (iou=0; iou<postcodea.length; iou++) { this_diff=eval(Math.abs(eval((” + this_long)) – eval((” + longa[iou]))) + Math.abs(eval((” + this_lat)) – eval((” + lata[iou])))); if (this_diff < 20 && this_diff > 0.00001) { sofar+=” + iou + ‘+’ + placea[iou] + ‘+’ + longa[iou] + ‘+’ + lata[iou] + ‘-‘ + this_diff + ‘;’; things.push(” + eval(1000000.0 + eval(” + this_diff)) + ‘ ~’ +

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Australian Postcode Place Modal Backdrop Popup Tutorial

Yesterday’s Australian Postcode Place Nearby Tutorial had us attending to an “Australian Postcode Nearby” subset of functionality in terms of the event … onmouseover … or “on hover” which programmers out there will know, in “mobile land” is about as useful as a screen door on a submarine … so, today, we attend to some event logic everybody relates to, that being … onclick … and today, for an aesthetic change, we’re going to show our Google Charts Map Chart interfacing functionality in a Modal Backdrop Popup “window” (ie. not a window as such, but more an HTML nested div that acts like a “modal” (has to be attended to) popup). Consequently, that Javascript nearestto function changed as per … function nearestto(ogset, gset) { var iou=0, outset=gset, this_lat=0.0, this_long=0.0, this_diff=-1.0, smallest_diff=-1.0, largest_diff=-1.0, smallest_num=0; var sofar=’;’, pa=”; var things=[]; ourarguments=’?title=’ + encodeURIComponent(‘Australian Postcode Places Nearby ‘ + ogset.innerHTML) + ‘&onclick=y&label=%5b%27Lat%27,&value=%27Lon%27,%20%27Name%27%5d&data=’; if (postcodea.length > 1) { this_long=eval(gset.split(‘ ‘)[0].split(‘,’)[1]); this_lat=eval(gset.split(‘ ‘)[0].split(‘,’)[0]); for (iou=0; iou<postcodea.length; iou++) { this_diff=eval(Math.abs(eval((” + this_long)) – eval((” + longa[iou]))) + Math.abs(eval((” + this_lat)) – eval((” + lata[iou])))); if (this_diff < 20 && this_diff > 0.00001) { sofar+=” + iou + ‘+’ + placea[iou] + ‘+’ + longa[iou] + ‘+’ + lata[iou] + ‘-‘ + this_diff + ‘;’; things.push(” + eval(1000000.0 + eval(” + this_diff)) + ‘ ~’ + lata[iou] + ‘~’ + longa[iou] + ‘~ near to ‘ + placea[iou] + ‘,’ + postcodea[iou]); if (smallest_diff < 0.0 || eval(” + this_diff) < eval(” + smallest_diff)) { smallest_diff=this_diff; smallest_num=iou; } if (largest_diff < 0.0 || eval(” + this_diff) > eval(” + largest_diff)) { largest_diff=this_diff; } } else if (this_diff < 20 && this_diff <= 0.00001) { ourarguments+=’,%20[‘ + lata[iou] + ‘,’ + longa[iou] + ‘,~’ + encodeURIComponent(placea[iou] + ‘,’ + postcodea[iou]) + ‘~]’; } } things.sort(); outset+=’ near to ‘ + placea[smallest_num] + ‘,’ + postcodea[smallest_num]; ourarguments+=’,%20[‘ + lata[smallest_num] + ‘,’ + longa[smallest_num] + ‘,~’ + encodeURIComponent(placea[smallest_num] + ‘,’ + postcodea[smallest_num]) + ‘~]’; pa=”//www.rjmprogramming.com.au/PHP/Map/map.php” + ourarguments; for (iou=0; iou<=15; iou++) { if (things.length > iou && outset.indexOf(things[iou].split(‘ near to ‘)[1]) == -1) { outset+=’ and near to ‘ + things[iou].split(‘ near to ‘)[1]; pa+=’,%20[‘ + things[iou].split(‘~’)[1] + ‘,’ + things[iou].split(‘~’)[2] + ‘,~’ + encodeURIComponent(things[iou].split(‘ near to ‘)[1]) + ‘~]’; if (pa.length < 751) { ourarguments=’?’ + pa.split(‘?’)[1]; } } } // Modal backdrop below … if (ogset.innerHTML != ”) { ogset.onclick=function() { document.getElementById(‘mypopup’).style.display=’block’; document.getElementById(‘mypopup-inner’).style.display=’block’; if (1 == 1) {

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment

Australian Postcode Place Nearby Tutorial

Back in “the where of life” web application wooooooorrrrrllllldd it’s all fine and good to know “crowfly distances” as we did in Australian Postcode Place Distances Map Chart Tutorial but that level of mathematics is not everybody’s cup of tea. Often we just want to know a … nearby place … and that is all fine and good using that incredible Australian Postcode resource we talked about below. What broad brush steps were done to arrange this information be displayed hovering over an Australian Postcode Place, in addition to ideas of that previous blog post, and its predecessors? a top priority in all software integration is to first protect whatever already works, and that involved the establishment of a blank ” ” delimitation rule to the “hovering over text” … it used to be latitude,longitude and this is separated by “nearby” information by a space ” ” character delimitation … and in any existing Javascript code it is a simple matter of appending … .split(” “)[0] … onto any Javascript DOM “.title” usages (as the title attribute is what is displayed when hovering) add global arrays … var postcodea=[]; var placea=[]; var lata=[]; var longa=[]; at document.body onload event arrange to have … function fillcomparray(dataarr) { var fldsa, ij, jk, cdelim=”, thisplace=”, lm=-1, xpc=”; for (ij=1; ij<dataarr.length; ij++) { if ((dataarr[ij] + ‘ ‘).substring(0,1) >= ‘0’ && (dataarr[ij] + ‘ ‘).substring(0,1) <= ‘9’) { fldsa=dataarr[ij].split(‘,’); //postcodea.push(fldsa[0]); xpc=fldsa[0]; cdelim=”; thisplace=”; lm=-1; for (jk=1; jk<fldsa.length; jk++) { if ((fldsa[jk] + ‘ ‘).substring(0,1) == ‘-‘ || ((fldsa[jk] + ‘ ‘).substring(0,1) >= ‘0’ && (fldsa[jk] + ‘ ‘).substring(0,1) <= ‘9’)) { if (lm < 0) { lm=jk; } } if (lm == -1) { thisplace+=cdelim + fldsa[jk]; cdelim=’,’; } } if (fldsa[lm].match(/^[0-9-.]*$/) && fldsa[eval(1 + eval(” + lm))].match(/^[0-9-.]*$/)) { postcodea.push(xpc); placea.push(thisplace); longa.push(fldsa[lm]); lm++; lata.push(fldsa[lm]); } } } } … populate those global arrays … ready for user places of interest to trigger … onblur logic that when determining a “.title” attribute, now does … document.getElementById(‘setofthree_’ + eval(-1 + setofthree) + ‘_01’).title=nearestto(findit[jj].split(‘,’)[eval(4 – indivo.innerHTML.split(‘,’).length)] + ‘,’ + findit[jj].split(‘,’)[eval(3 – indivo.innerHTML.split(‘,’).length)]); … and within that new Javascript function … Javascript array sort() method becomes a useful intervention as per … function nearestto(gset) { var iou=0, outset=gset, this_lat=0.0, this_long=0.0, this_diff=-1.0, smallest_diff=-1.0, largest_diff=-1.0, smallest_num=0; var sofar=’;’; var things=[]; if (postcodea.length > 1) { this_long=eval(gset.split(‘ ‘)[0].split(‘,’)[1]); this_lat=eval(gset.split(‘ ‘)[0].split(‘,’)[0]); for (iou=0; iou<postcodea.length; iou++) { this_diff=eval(Math.abs(eval((” + this_long)) – eval((” +

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , | Leave a comment

MySql Polygon Spatial Relations via Image Map Tutorial

It’s “tomorrow” as per … Continuing the theme of PHP using MySql databases and dealing with Spatial functionality of MySql Stored Procedures Geometry Tutorial, today we establish some PHP to add into a MySql database table as POLYGON data type data, the HTML area coords attribute. Pourquoi? You’ll see more on this tomorrow. … of yesterday’s MySql Polygon Insert via Image Map Tutorial, and today, we wanted to show you some really great MySql Spatial Relation Functions That Use Object Shapes. Think polygons and thinking geometry and thinking GIS you would want SQL functionality we show today as per … tell whether one polygon CROSSES another polygon tell whether one polygon is DISJOINT relative to another polygon tell whether one polygon EQUALS another polygon in a spatial sense tell whether one polygon INTERSECTS another polygon tell whether one polygon OVERLAPS another polygon tell whether one polygon TOUCHES another polygon tell whether one polygon is WITHIN another polygon Here is some downloadable supervisory PHP programming source code which gathers the MySql SQL requests made for POLYGON data type INSERT MySql SQL statements and can be renamed to the changed map_area_polygon_mysql.php for your perusal, and which we use incorporated with our local MAMP Apache/PHP/MySql web server, or via this live run link. Now with the supervised PHP programming source code which gathers the MySql SQL requests made for POLYGON data type INSERT MySql SQL statements and can be renamed to the changed ourmysqlstoredprocedure.php for your perusal. You can also see this play out at WordPress 4.1.1’s MySql Polygon Insert via Image Map Tutorial. Previous relevant MySql Polygon Insert via Image Map Tutorial is shown below. Continuing the theme of PHP using MySql databases and dealing with Spatial functionality of MySql Stored Procedures Geometry Tutorial, today we establish some PHP to add into a MySql database table as POLYGON data type data, the HTML area coords attribute. Pourquoi? You’ll see more on this tomorrow. Let’s today, just get to insert records, and that looks like, in MySql SQL … Table Creation DROP TABLE IF EXISTS POLYGONS; CREATE TABLE POLYGONS ( polyid INT NOT NULL AUTO_INCREMENT, mapid VARCHAR(20) NOT NULL, onepolygon POLYGON NOT NULL, PRIMARY KEY (polyid)); Insert Statement Examples INSERT INTO POLYGONS (`mapid`,`onepolygon`) values (‘sh80879’,ST_POLYGONFROMTEXT(‘POLYGON ((190 653, 193 645, 192 641, 191 635, 193 629, 195 623, 192 622, 194 610, 192 606, 186 607, 183 597, 185 593, 181 590, 178 586,

Posted in Database, eLearning, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

MySql Polygon Insert via Image Map Tutorial

Continuing the theme of PHP using MySql databases and dealing with Spatial functionality of MySql Stored Procedures Geometry Tutorial, today we establish some PHP to add into a MySql database table as POLYGON data type data, the HTML area coords attribute. Pourquoi? You’ll see more on this tomorrow. Let’s today, just get to insert records, and that looks like, in MySql SQL … Table Creation DROP TABLE IF EXISTS POLYGONS; CREATE TABLE POLYGONS ( polyid INT NOT NULL AUTO_INCREMENT, mapid VARCHAR(20) NOT NULL, onepolygon POLYGON NOT NULL, PRIMARY KEY (polyid)); Insert Statement Examples INSERT INTO POLYGONS (`mapid`,`onepolygon`) values (‘sh80879’,ST_POLYGONFROMTEXT(‘POLYGON ((190 653, 193 645, 192 641, 191 635, 193 629, 195 623, 192 622, 194 610, 192 606, 186 607, 183 597, 185 593, 181 590, 178 586, 176 580, 172 576, 181 576, 189 574, 198 570, 204 565, 198 562, 202 559, 202 551, 207 550, 214 553, 219 553, 226 546, 232 544, 239 543, 241 539, 248 539, 255 534, 259 535, 259 545, 259 551, 255 558, 250 567, 246 575, 249 580, 249 590, 250 598, 250 604, 242 604, 234 610, 232 619, 229 627, 221 631, 214 637, 211 646, 204 651, 197 656, 191 655, 190 653))’)); INSERT INTO POLYGONS (`mapid`,`onepolygon`) values (‘sh80879’,ST_POLYGONFROMTEXT(‘POLYGON ((190 651, 193 644, 190 638, 193 633, 195 627, 196 622, 191 621, 194 617, 192 611, 193 607, 188 607, 185 606, 184 604, 184 599, 185 594, 181 592, 183 587, 181 585, 176 585, 177 582, 173 580, 172 576, 174 575, 170 569, 164 570, 157 564, 153 556, 149 554, 141 549, 148 564, 152 569, 158 580, 165 590, 167 600, 173 610, 173 619, 175 622, 171 622, 175 632, 180 638, 184 644, 191 652, 190 651))’)); … featuring MySql’s ST_POLYGONFROMTEXT function usage to INSERT POLYGON data into a MySql database table. Here is some downloadable (so far only) supervisory PHP programming source code which gathers the MySql SQL requests made for POLYGON data type INSERT MySql SQL statements and can be renamed to map_area_polygon_mysql.php for your initial perusal, and which we use incorporated with our local MAMP Apache/PHP/MySql web server, or via this live run link. Previous relevant MySql Stored Procedures Geometry Tutorial is shown below. We’re back from rjmprogramming.com.au domain thoughts at MySql Stored Procedures User Grant Tutorial back to thinking more about where MySql is at these

Posted in Database, eLearning, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

MySql Stored Procedures Geometry Tutorial

We’re back from rjmprogramming.com.au domain thoughts at MySql Stored Procedures User Grant Tutorial back to thinking more about where MySql is at these days regarding General Geometry Property Functions. This series of functions applicable with MySql SQL DML or “Stored Procedures” (given you have a recent enough version of MySql) may be a more efficient approach for an application you write, perhaps avoiding “double handling” … maybe even “triple handling” in the hierarchy… MySql called from PHP (server side code) as a SELECT statement query result set … down to … PHP (calling the MySql) could achieve this too … down to … Javascript (at the client side) could, perhaps, achieve this too … depending on what, geometry wise, you want to achieve. On our MAMP Apache/PHP/MySql web server incarnation of our MySql series, as you can see with our tutorial picture today using … PHP 7 … and … mysqli_connect() via 5.7.23 – MySQL … we show … ST_Envelope Returns the minimum bounding rectangle (MBR) for the geometry value … via pretty obsessive application of MySql CONCAT function (as well as below) ST_Length Returns a double-precision number indicating the length of the LineString or MultiLineString value Generally speaking, we totally recommend finding out more here, because the closer you keep the data to the functionality, the faster will be the applications you write. You’re here because you have decided on MySql as the data source (database) engine. Being as you’ve gone to all that organizational trouble, it would be a shame to not use MySql in a savvy way interfacing to what your data represents, as soon as integrated as possible. And here is some downloadable supervisory PHP programming source code which gathers the MySql SQL requests made and can be renamed to the changed ourmysql_storedprocedure.php as required. Previous relevant MySql Stored Procedures User Grant Tutorial is shown below. Yesterday’s MySql Stored Procedures Spatial Tutorial was fully functional for what we wanted to cover on our local MAMP Apache/PHP/MySql web server featuring … PHP 7 … and … mysqli_connect() via 5.7.23 – MySQL … but to offer any version of it “live” on rjmprogramming.com.au domain (which we generally try to do for your “reality of purpose” here at this blog) we came across many issues … PHP 5 … and … mysqli_connect() (ie. now the same, ditching the old mysql_connect() ideas) via 5.1.70-cll – MySQL … as well as

Posted in Database, eLearning, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

MySql Stored Procedures User Grant Tutorial

Yesterday’s MySql Stored Procedures Spatial Tutorial was fully functional for what we wanted to cover on our local MAMP Apache/PHP/MySql web server featuring … PHP 7 … and … mysqli_connect() via 5.7.23 – MySQL … but to offer any version of it “live” on rjmprogramming.com.au domain (which we generally try to do for your “reality of purpose” here at this blog) we came across many issues … PHP 5 … and … mysqli_connect() (ie. now the same, ditching the old mysql_connect() ideas) via 5.1.70-cll – MySQL … as well as … security concerns Hence yesterday’s trepidation, huh?! But what makes databases like MySql, especially with its brilliant phpMyAdmin GUI interface, that “step up” from other data storage methodologies such as HTTP Cookies or Local Storage or Flat Files is the concept of a “user” … yoo, hoo! The concept of a “user” with “databases” can then team up with concepts such as … privileges role … in order to add so much more nuance and organization regarding who handles what computing task. Think blogs, for example, and you can have … administration users (you’ll hear “superuser” references) who can achieve all of the functionalities below, and more … versus … users who just read and never intend to write or comment users who want to write blog postings but need administrator help to delete them users who want to comment … and various other “roles”. “Privileges” can help the “database” decide on what is allowed by a “user” to happen on the “database”. Very good and secure “database” brands will start very restrictively, maybe on any database starting out with the one administrator “user”. To nuance from that position we need the “MySql” SQL GRANT command (for allowing, and REVOKE is for the other way around), and we’d like to thank and direct you to the excellent MySql GRANT advice as per … Grant Permissions to MySQL User The basic syntax for granting permissions is as follows: GRANT permission ON database.table TO ‘user’@’localhost’; Here is a short list of commonly used permissions : ALL – Allow complete access to a specific database. If a database is not specified, then allow complete access to the entirety of MySQL. CREATE – Allow a user to create databases and tables. DELETE – Allow a user to delete rows from a table. DROP – Allow a user to drop databases and tables. EXECUTE –

Posted in Database, eLearning, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

MySql Stored Procedures Spatial Tutorial

Back when we wrote MySql Stored Procedures Primer Tutorial we wrote it more or less to use … PHP 5 and its … mysql_connect() … MySql database connection logic, but today we have a dual (even trial) purpose in mind (… or “out of mind” if you were naughty and picked some of those mushrooms out and about at the moment (ie. please don’t)) for today’s revisit. get with the plan of using PHP 7 (as we do with our local MAMP Apache/PHP/MySql web server here) along with mysqli_connect … and … start you thinking about MySql’s excellent Spatial Convenience Functions, such as st_distance_sphere() function to determine (in metres) crow fly distances between points (longitude, latitude) on Earth … and … verify that MySql Stored Procedures haven’t changed as far as arrangements go with all this So, here is some downloadable PHP programming source code which shows the results of the MySql SQL requests made and can be renamed to the changed ourmysqlstoredprocedure.php as required. And here is some downloadable supervisory PHP programming source code which gathers the MySql SQL requests made and can be renamed to the changed ourmysql_storedprocedure.php as required. A tad trepidatiously we also offer you today’s live run link that we explain more about regarding restrictiveness and its allowances, tomorrow. Previous relevant MySql Stored Procedures Primer Tutorial is shown below. Today’s tutorial follows up on phpMyAdmin interface to MySql and PHP Primer Tutorial in that we again use the brilliant phpMyAdmin to oversee the results of some PHP code which uses MySql calls to create tables called POINT and CIRCLE used to store information defining a circle, and then it creates three MySql stored procedures in the database to help add circle data with the single MySql statement that goes CALL AddCircle(x, y, radius); via the use of those stored procedures. Let’s see below what Wikipedia says about Stored Procedures generally. A stored procedure is a subroutine available to applications that access a relational database system. A stored procedure (sometimes called a proc, sproc, StoPro, StoredProc, sp or SP) is actually stored in the database data dictionary. Typical use for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures can consolidate and centralize logic that was originally implemented in applications. Extensive or complex processing that requires execution of several SQL statements is moved into stored procedures, and all applications

Posted in Database, eLearning, Tutorials | Tagged , , , , , , , , , , , , , , | Leave a comment