I'm trying to put on the map the route of an ads-b plane, I've managed this so far ...

Poblema is as follows puts all the points since I started to intercept him until the end what is not correct should remain only the last point that shows his exact real time location.

function addMarker(coordinates, data_no) {

            //var marker = new ol.Feature(new ol.geom.Point(coordinates).transform('EPSG:4326', 'EPSG:31700'));
            var marker = new ol.Feature(new ol.geom.Point(coordinates).transform('EPSG:4326', map.getView().getProjection()));
            var zIndex = 1;
            var style_aircraft = new ol.style.Style({
                                      image: new ol.style.Icon(({
                                        anchor: [0.5, 36], 
                                        anchorXUnits: "fraction",
                                        anchorYUnits: "pixels",
                                        opacity: 1,
                                        src: "img/airport.png", 
                                        zIndex: zIndex
                                      zIndex: zIndex,
                                      text: new ol.style.Text({
                                        font: 'bold 16px "Open Sans", "Arial Unicode MS", "sans-serif"',
                                        placement: 'center',
                                        fill: new ol.style.Fill({
                                          color: 'black'

            var data = data_no[0]+"/"+data_no[1]+"/"+data_no[2]+"/"+data_no[3];

enter image description here

1 Answer 1


If data_no[0] is the id of the plane you could use

        var old_marker = vectorSource.aircraft.getFeatureById(data_no[0]);
        if (old_marker) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.