I have a list of coordinators and I want to display it in the openlayers map but the line did not show in the map.
This is my code. May someone guide my on this?
for (let i = 0; i < list.length - 1; i++) {
const start_point = [parseInt(list[i].longitude, 10), parseInt(list[i].latitude, 10)];
const end_point = [parseInt(list[i + 1].longitude, 10), parseInt(list[i + 1].latitude, 10)];
const feature = new ol.Feature({
geometry: new ol.geom.LineString([start_point, end_point]),
name: 'Line'
});
const source = new ol.source.Vector({
features: [feature]
});
const layerLines = new ol.layer.Vector({
source: source,
});
this.map.addLayer(layerLines);
}