Page 1 of 1

Custom Marker for different Squawks

Posted: Sat Jul 27, 2019 6:25 pm
by ETEJRadar
I want to have a red marker if an aircraft squawk 7700, 7600 or 7500. To test if my code works I used this (there are a few other marker codes in that file so don't worry about the start and the ending of it :):

VRS.globalOptions.aircraftMarkers.unshift(
new VRS.AircraftMarker({
normalFileName: 'MIL-WTC-Medium-2-Jet-Squawk.png',
selectedFileName: 'M-WTC-Medium-2-Jet-Selected.png',
size: { width: 40, height: 40 },
matches: function(aircraft) { return aircraft.Squawk.val === '1000' }
}));
If I use return aircraft.Squawk.val === '1000' it doesn't work. It won't even show any other planes on my map. Does anyone have a solution for squawk based markers?

Re: Custom Marker for different Squawks

Posted: Sat Jul 27, 2019 11:57 pm
by agw
JavaScript is case sensitive. You used the field name aircraft.Squawk, which doesn't exist. I think if you check the console tab on the F12 screen in the browser you'll probably see an error saying as much?

The actual name is squawk with a lower-case S, e.g.

Code: Select all

return aircraft.squawk.val === '1000' 

Re: Custom Marker for different Squawks

Posted: Sun Jul 28, 2019 10:03 am
by ETEJRadar
Thank you awg it worked.