Skip to content

Instantly share code, notes, and snippets.

@johnd0e
Last active December 13, 2018 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnd0e/fde0c88502df88a88e1068f5b397aa69 to your computer and use it in GitHub Desktop.
Save johnd0e/fde0c88502df88a88e1068f5b397aa69 to your computer and use it in GitHub Desktop.

https://raw.githack.com/oliverkurth/draw2intel/master/draw2intel.html

draw2intel

Simple html/javascipt page to convert IITC drawstring to intel

If you haven't bothered to setup IITC, but people keep posting drawstrings but no intel links for their grand field plans you need this if you don't want to be left out.

If you still have no idea what this is good for you won't need it ... :-P

To use it just download the file draw2string.html and open it with your browser. Copy and paste the drawstring into the text box and press the button.

https://github.com/oliverkurth/draw2intel

<!DOCTYPE html>
<html>
<body>

<h3>Convert IITC drawstring to an intel link</h3>

Copy the drawstring here:<br>
<textarea id="drawstring" rows="10" cols="100">
 [{"type":"polyline","latLngs":[{"lat":37.415838,"lng":-120.672754},{"lat":37.51055,"lng":-121.876036}],"color":"#a24ac3"}]
</textarea>

<button type="button" onclick="toIntel()">Convert</button>

<p id="intel"></p>

<script>
function toIntel() {
	var drawstring = '{"drawstring":' + document.getElementById("drawstring").value + '}';
	var obj = JSON.parse(drawstring);
	document.getElementById("intel").innerHTML = '';
	var strlines = [];
	for(i = 0; i < obj.drawstring.length; i++){
		var lat0 = obj.drawstring[i].latLngs[0].lat;
		var lng0 = obj.drawstring[i].latLngs[0].lng;
		var lat1 = obj.drawstring[i].latLngs[1].lat;
		var lng1 = obj.drawstring[i].latLngs[1].lng;
		var strline = lat0 + ',' + lng0 + ',' + lat1 + ',' + lng1;
		strlines.push(strline);
	}
	var intelurl = 'https://www.ingress.com/intel?ll=' + lat0 + ',' + lng0 + '&z=15&pls=' + strlines.join('_');
	document.getElementById("intel").innerHTML = "<a href='" + intelurl + "'>" + intelurl + "</a>";
}
</script>

</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment