Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function showTrack() {
- var iconFeatures=[];
- var num = $('#tracker-grid').datagrid('getData').total;
- for(var i=0; i<num; i++){
- var lon=$('#tracker-grid').datagrid('getRows')[i].longitude;
- var lat=$('#tracker-grid').datagrid('getRows')[i].latitude;
- var coord = ol.proj.fromLonLat([lon, lat]);
- var iconFeature = new ol.Feature({
- geometry: new ol.geom.Point(coord)
- });
- iconFeatures.push(iconFeature);
- }
- var vectorSource = new ol.source.Vector({
- features: iconFeatures //add an array of features
- });
- var iconStyle = new ol.style.Style({
- image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
- scale: 0.5,
- anchor: [0.5, 46],
- anchorXUnits: 'fraction',
- anchorYUnits: 'pixels',
- opacity: 0.75,
- src: 'img/pin-blue.png'
- }))
- });
- var vectorLayerLoc = new ol.layer.Vector({
- source: vectorSource,
- style: iconStyle
- });
- map.addLayer(vectorLayerLoc);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement