Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. function addmarker(lat, long, flag) {
  2.  
  3. iconFeature = new ol.Feature({
  4. geometry: new ol.geom.Point(ol.proj.transform([+long, +lat], 'EPSG:4326', 'EPSG:3857')),
  5. name: 'NULL'
  6. });
  7.  
  8. iconStyle = new ol.style.Style({
  9.  
  10. fill: new ol.style.Fill({
  11. color: '#008000'
  12. }),
  13. stroke: new ol.style.Stroke({
  14. color: '#008000',
  15. width: 3
  16. }),
  17. image: new ol.style.Circle({
  18. radius: 6,
  19. fill: new ol.style.Fill({
  20. color: '#008000'
  21. })
  22. })
  23.  
  24. });
  25.  
  26. iconFeature.setStyle(iconStyle);
  27.  
  28. vectorSource[flag] = new ol.source.Vector({
  29. features: [iconFeature]
  30. });
  31.  
  32. vectorLayer[flag] = new ol.layer.Vector({
  33. source: vectorSource[flag]
  34. });
  35.  
  36. map.addLayer(vectorLayer[flag]);
  37.  
  38. }
  39.  
  40. function changemarker(lat, long, flag) {
  41.  
  42. vectorSource[flag].clear();
  43.  
  44. map.removeLayer(vectorLayer[flag]);
  45.  
  46. addmarker(lat, long, flag);
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement