Jump to content
  • 1

Reverse Wherigo Solver?


elrojo14

Question

I was just listening to the Geocaching Podcast last night and one of the Android app designers made a Reverse Wherigo Solver and is about to publish it in their app. Nic, can you throw in a Reverse Wherigo Solver? That would be pretty sweet. And before anyone accuses me of being lazy, the sheer fact reverse wherigos exist confirms anyone who hides one is lazy. We would just be returning the favor!

And by the way, I own like 150 reverse wherigos! LOL. 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
10 minutes ago, elrojo14 said:

Oh and I forgot. He set it up to where it scanned the cache page so you did not have to even input anything. Oh well. One can dream. 

I love this idea. There is a series of 1000 reverse wherigos near Adelaide, SOuth Australia and the only way to currently set the solved coords is to copy and paste each number into a solver then copy and paste the coords back to the cache page. A tool to make this easier would be the most amazing thing ever

Link to comment
Share on other sites

  • 0

Hi there,

using tampermonkey and a script, you can solve it on the geocaching webpage directly. 

The code searches for 3 6-digit codes and calculates the coordinates.

You'll find a button in the top left corner of the Cache-page.

Unfortunately you have to click the button about three times to calculate the coordinates, insert the data into the personal notes, and correct the coordinates, but it is usually much faster than copy and paste...

Install Tampermonkey, Create a new empty script and paste the source-code

My source-code:

// ==UserScript==
// @name           calc Reverse Wherigo (Waldmeister) ohne DB
// @namespace      http://mediastation
// @match        http*://www.geocaching.com/seek/cache_details.aspx?*
// @match        http*://www.geocaching.com/geocache/GC*
// @grant   GM_getValue
// @grant   GM_setValue
// @grant   GM_log
// @grant   GM.xmlhttpRequest
// @grant   GM_addStyle
// @grant   unsafeWindow
// @grant   GM.openInTab
// @description    calculate coordinates from WIG 6-digit codes
//
//
// @version 1.1.0
// ==/UserScript==

/*--- Create a button in a container div.  It will be styled and
    positioned with CSS.
*/
var zNode = document.createElement ('div');
zNode.innerHTML = '<button id="myWIGButton" type="button">Solve Reverse WIG</button>';
zNode.setAttribute ('id', 'myWIGContainer');
document.body.appendChild (zNode);

//--- Activate the newly added button.
document.getElementById ("myWIGButton").addEventListener (
    "click", ButtonClickAction, false
);

//--- Style our newly added elements using CSS.
GM_addStyle ( multilineStr ( function () {/*!
    #myWIGContainer {
        position:               absolute;
        top:                    0;
        left:                   10px;
        font-size:              10px;
        background:             red;
        opacity:                0.9;
        z-index:                1100;
        padding:                5px 20px;
    }
    #myWIGButton {
        cursor:                 pointer;
    }
    #myWIGContainer p {
        color:                  red;
        background:             white;
    }
*/} ) );

function gowherei(args){
  		var answer= [];
		var AAAAAA = parseFloat(args[1]);
        var BBBBBB = parseFloat(args[2]);
        var CCCCCC = parseFloat(args[3]);
  			//alert(AAAAAA + ' - ' + BBBBBB + ' - ' + CCCCCC);
  		var LongVORZ = 1.0;
        var LatKOMP = 0.0;
        var LatVORZ = 1.0;
        var LongKOMP = 0.0;
    	if (( AAAAAA % 1000 - AAAAAA % 100) / 100 == 1) {
            LatVORZ = 1;
            LongVORZ = 1;
            }
        if ((AAAAAA % 1000 - AAAAAA % 100) / 100 == 2) {
		   LatVORZ = -1;
		   LongVORZ = 1;
           }
        if ((AAAAAA % 1000 - AAAAAA % 100) / 100 == 3) {
		   LatVORZ = 1;
		   LongVORZ = -1;
           }
	    if ((AAAAAA % 1000 - AAAAAA % 100) / 100 == 4) {
		   LatVORZ = -1;
		   LongVORZ = -1;
           }

        if ((((CCCCCC % 100000 - CCCCCC % 10000) / 10000 + (CCCCCC % 100 - CCCCCC % 10) / 10) % 2) == 0){
            LongKOMP = (LongVORZ * ((AAAAAA % 100000 - AAAAAA % 10000) / 10000 * 100 + (CCCCCC % 1000000 - CCCCCC % 100000) / 100000 * 10 + CCCCCC % 10 + (BBBBBB % 1000 - BBBBBB % 100) / 100 * 0.1 + (BBBBBB % 1000000 - BBBBBB % 100000) / 100000 * 0.01 + (AAAAAA % 100 - AAAAAA % 10) / 10 * 0.001 + (CCCCCC % 100000 - CCCCCC % 10000) / 10000 * 1.0E-4 + BBBBBB % 10 * 1.0E-5));
		}
		else {
          LongKOMP = (LongVORZ * ((BBBBBB % 100 - BBBBBB % 10) / 10 * 100 + CCCCCC % 10 * 10 + (AAAAAA % 100 - AAAAAA % 10) / 10 + (AAAAAA % 100000 - AAAAAA % 10000) / 10000 * 0.1 + (BBBBBB % 1000 - BBBBBB % 100) / 100 * 0.01 + BBBBBB % 10 * 0.001 + (CCCCCC % 100000 - CCCCCC % 10000) / 10000 * 1.0E-4 + (BBBBBB % 100000 - BBBBBB % 10000) / 10000 * 1.0E-5));
			}
		if ((((CCCCCC % 100000 - CCCCCC % 10000) / 10000 + (CCCCCC % 100 - CCCCCC % 10) / 10) % 2) == 0){
                LatKOMP = (LatVORZ * ((AAAAAA % 10000 - AAAAAA % 1000) / 1000 * 10 + (BBBBBB % 100 - BBBBBB % 10) / 10 + (BBBBBB % 100000 - BBBBBB % 10000) / 10000 * 0.1 + (CCCCCC % 1000 - CCCCCC % 100) / 100 * 0.01 + (AAAAAA % 1000000 - AAAAAA % 100000) / 100000 * 0.001 + (CCCCCC % 100 - CCCCCC % 10) / 10 * 1.0E-4 + AAAAAA % 10 * 1.0E-5));
		}
        else{
			LatKOMP = (LatVORZ * ((BBBBBB % 1000000 - BBBBBB % 100000) / 100000 * 10 + AAAAAA % 10 + (AAAAAA % 10000 - AAAAAA % 1000) / 1000 * 0.1 + (CCCCCC % 1000000 - CCCCCC % 100000) / 100000 * 0.01 + (CCCCCC % 1000 - CCCCCC % 100) / 100 * 0.001 + (CCCCCC % 100 - CCCCCC % 10) / 10 * 1.0E-4 + (AAAAAA % 1000000 - AAAAAA % 100000) / 100000 * 1.0E-5));
			}
		answer[0]=LatKOMP.toFixed(6);
		answer[1]=LongKOMP.toFixed(6);
		return (answer);
}
function wig_split (wig){
	const myregex = /.*?([0-9]{6}).*?([0-9]{6}).*?([0-9]{6})/;
    let wig_value = myregex.exec(wig);
  	return(wig_value);
		}

function coordtotext(coord,my_type){
  	if (coord<0 && my_type =='N'){my_type='S';}
		if (coord<0 && my_type =='E'){my_type='W';}
		coord=Math.abs(coord);
  	var my_grad=Math.floor(coord);
  	var my_dez=(coord - my_grad) *60;
  	my_dez=my_dez.toFixed(3);
  	var my_text = my_type + ' ' +my_grad + ' ' + my_dez;
  	//alert(my_text);
    return(my_text);
	}

function ButtonClickAction (zEvent) {
    /*--- For our dummy action, we'll just add a line of text to the top
        of the screen.
    */
    var udo_GC_Name=btoa(encodeURIComponent(document.getElementById("ctl00_ContentBody_CacheName").textContent));
  	var udo_GC_id=btoa(encodeURIComponent(document.getElementById("ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode").textContent));
    var udo_GC_tupel=wig_split(encodeURIComponent(document.getElementById("ctl00_ContentBody_LongDescription").textContent));
  	var udo_coord=gowherei(udo_GC_tupel);
    //alert(udo_GC_tupel);
    //alert(udo_coord[0]+' - ' +udo_coord[1]);
    var mylat=btoa(coordtotext(udo_coord[0],'N'));
    var mylon=btoa(coordtotext(udo_coord[1],'E'));
  	//alert (mylat + ' ' + mylon);
  	var udo_GC_desc ='Lat (dec)  ' + udo_coord[0] + '\n';
 		udo_GC_desc +='Lon (dec) ' + udo_coord[1] + '\n';
		udo_GC_desc +='coordinate ' + atob(mylat) + ' ' + atob(mylon) + '\n';
		udo_GC_desc +='calculated '+ Date() + '\n';
		udo_GC_desc +='tupel ' + udo_GC_tupel[1] + '-' + udo_GC_tupel[2] + '-'+ udo_GC_tupel[3] + '\n';

    var my_gc_coord = atob(mylat) + ' ' + atob(mylon);
    document.getElementById("viewCacheNote").click();
    document.getElementById("cacheNoteText").value=udo_GC_desc;
    document.querySelector(".js-pcn-submit").click();
    document.getElementById("uxLatLon").click();
    document.getElementById("newCoordinates").value=my_gc_coord;// + ' ' + atob(mylon) ;
    document.querySelector(".btn-cc-parse").click();
    document.querySelector(".btn-cc-accept").click();
  }

function multilineStr (dummyFunc) {
    var str = dummyFunc.toString ();
    str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*!
    .replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ }
    .replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them.
            ;
    return str;
}

sometimes it also gets dates, then an old-school copy & paste has to be done...

Please take it, as it is, no warranty, no guarantee that it will run correctly. I calculate all Waldmeister WIG with this tool. 

hth

Udo

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...