vradarserver / vrs

A .NET web server that can plot the positions of aircraft on a map
http://www.virtualradarserver.co.uk/
Other
267 stars 50 forks source link

Aircraft Markers #86

Open lucapaganotti opened 1 year ago

lucapaganotti commented 1 year ago

Hi all,

happily install VRS on a debian bullseye linux box on a vps, put it online but since the very start aircrafts' markers were not displayed at all.

Try to inject some javascript at head as described by the examples but without any success. I've tried to use the Marker_Airplane.png and Marker_AirplaneSelected.png Trails are displayed but markers are missing.

I've also tried to display some text about the aircrafts on the map but also this was unsuccessfull.

Here it is the javascript code injected:

<script type="text/javascript">
    if(VRS && VRS.globalDispatch && VRS.serverConfig) {
        VRS.globalDispatch.hook(VRS.globalEvent.bootstrapCreated, function(bootStrap) {
            // this will run once, just after the server configuration has been loaded
            // but before any of the javascript objects are initialized.
            // ADD YOUR CONTENT AFTER THIS LINE
            // VRS.globalOptions.currentLocationFixed = { lat: 45.766, lng: 9.766 };
            VRS.globalOptions.aircraftMarkerPinTextLines = 4;
            VRS.globalOptions.aircraftMarkerDefaultPinTexts = [
                VRS.RenderProperty.Registration,
                VRS.RenderProperty.FlightLevel,
                VRS.RenderProperty.Callsign,
                VRS.RenderProperty.RouteShort
            ];
            if(VRS.globalOptions && VRS.globalOptions.aircraftMarkers) {
                    // Add your new rules to the START of the VRS.globalOptions.aircraftMarkers array using unshift.
                    // Add these in the reverse order of precedence - so if you have a marker whose rule should be
                    // applied if all other rules fail then unshift() it first and add more specific rules after.
                VRS.globalOptions.aircraftMarkers.unshift(
                    new VRS.AircraftMarker({
                        normalFileName:   'Marker_Airplane.png',
                        selectedFileName: 'Marker_AirplaneSelected.png',
                        size:             { width: 35, height: 35 },
                        matches: function(aircraft) {
                            return aircraft.altitude.val < 30000;
                        }
                    })
                );
                VRS.globalOptions.aircraftMarkerRotate = True;
            }
            VRS.globalOptions.svgAircraftMarkerNormalFill  = "#0000FF";
            VRS.globalOptions.svgAircraftMarkersSelectFill = "#FF0000";
        });
    }
</script>

maybe this javascript code is not loaded at the correct point (I've chosen HEAD at end for * addresses as a setup and passing the full path of my html custom file).

Any hint will be appreciated.

Thank you.

vradarserver commented 1 year ago

Which version of VRS are you running? Is it V2 or V3, and if it's V2 then is it the latest preview version from Github?

lucapaganotti commented 1 year ago

Hi,

this is what the webadmin plugin tells me in the about page (see the attached image)

Thank you for your answer and sorry for mine's delay

vrs-version

robbyb67 commented 1 year ago

This issue is solved in #36. You are running the latest release version - you may use the latest preview version which definitely solves the issue (I'm running Raspbian Bullseye on Raspi 3B). Preview version shows 2.4.4.31786 on About page.