DCS Viggen ELINT map viewer
An ELINT parser for showing map boxes for the DCS Viggen AJS37 AA sensor.
HTML
<div id='step1'>
<textarea rows=10 cols=80 id='inputElint' placeholder="Paste into here the full Viggen ELINT output found in your DCS\Saved Games\DCS_AJS37\ELINTData.info file and hit the button below"></textarea>
<button id='process_button' onclick='processElint();'>Process ELINT</button>
</div>
<div id="map"></div>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk">
</script>
CSS
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#process_button {
margin-left: 10px;
}
JavaScript
function processElint(){
//$('#step1').hide();
document.getElementById('step1').style.display = 'none';
initMap();
}
// Viggen ELINT plot example
function initMap() {
// Somewhere PG ish
var TL_Y = 28.5375;
var TL_X = 56.245;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: {lat: TL_Y, lng: TL_X},
mapTypeId: 'hybrid'
});
var textarea1 = document.getElementById("inputElint");
if (textarea1.value == "") {
// Empty defaults - Replace these examples below if you want your own plots..
// First emitter Freq: A PRF: 967
var elintLine1 = "NW: 28:32:15 056:14:42 SE: 26:13:30 058:13:06";
var elintFreq1 = "Freq: A PRF: 967";
plotOnMap(map, elintLine1, elintFreq1);
// Second emitter Freq: A PRF: 1763
var elintLine2 = "NW: 27:00:15 056:16:16 SE: 26:13:56 056:47:57";
var elintFreq2 = "Freq: A PRF: 1763";
plotOnMap(map, elintLine2, elintFreq2);
}
else {
// Simple parse from textbox test
var elintFreq = "";
var elintLine = "";
var lines = textarea1.value.split('\n');
for(var i = 0;i < lines.length;i++){
console.log(lines[i]);
if (lines[i].startsWith("Freq: ")){
elintFreq = lines[i];
}
if (lines[i].startsWith("NW: ")){
elintLine = lines[i];
}
if ( elintLine != "" && elintFreq != "") {
console.log("Plotting: " + elintLine + " - " + elintFreq);
plotOnMap(map, elintLine, elintFreq);
elintLine = "";
elintFreq = "";
}
}
}
}
// Example: elintLine: "NW: 28:32:15 056:14:42 SE: 26:13:30 058:13:06"
function plotOnMap(map, elintLine, elintFreq){
// Parse output string from Viggen
var spaceBits = elintLine.split(' ');
var tl_lat = spaceBits[1].split(":");
var tl_lng = spaceBits[2].split(":");
var br_lat = spaceBits[4].split(":");
var br_lng = spaceBits[5].split(":");
var tl_y = ConvertDMSToDD(tl_lat[0], tl_lat[1], tl_lat[2], 'N');
var tl_x =...