How can I create and delete a point in a live mode Google maps?

I'm trying to create I need the points and lines between them. Simultaneously want to tie the ability to delete points. In the documentation there is an example of creation and deletion. And it works individually. However, if you initialize the map without the dots, and then to create them, to them no access. How do I access the points?

const mapOptions = {
//mapOption
};
const map = new google.maps.Map(document.getElementById('map'), mapOptions);

let's flightpath = {};

function createPoint(e) {
//createPoint
}

createLineBetweenPoints function() {
 const flightPathOptions = {
//option
 map: map // add to the map
};
 's flightpath = new google.maps.Polyline(flightPathOptions);
}

function createRoutes(e) {
createPoint(e);
createLineBetweenPoints(e);
}

map.addListener('click', createRoutes); // add points and lines by clicking on the map

google.maps.event.addListener('s flightpath, 'click', function() {
 console.log(123);// Not working! Click on the dots nothing happens. 
});
June 10th 19 at 14:34
0 answer

Find more questions by tags Google Maps