Guest User

Untitled

a guest
Oct 15th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. var iconFeature = new ol.Feature({
  2. geometry: new ol.geom.Point([8637791.36, 1456487.82]),
  3. name: 'Police Station',
  4. population: 4000,
  5. rainfall: 500
  6. });
  7.  
  8. var vectorSource = new ol.source.Vector({
  9. features: [iconFeature]
  10. });
  11.  
  12. var vectorLayer = new ol.layer.Vector({
  13. source: vectorSource,
  14. title: 'point_layer'
  15. });
  16.  
  17. var ring = [[77.4700927734375, 12.906190219892437],[77.4707794189453, 12.987162237749473],
  18. [77.5188446044922, 12.989838549012532],[77.51060485839844, 12.961066692801282],
  19. [77.51747131347656, 12.953705916047227],[77.52708435058594, 12.94500653581774],
  20. [77.51815795898438, 12.936306851970144],[77.50030517578125, 12.92426063498786],
  21. [77.486572265625, 12.912883118595701],[77.4700927734375, 12.906190219892437]];
  22.  
  23. var polygon = new ol.geom.Polygon([ring]);
  24. polygon.transform('EPSG:4326', 'EPSG:3857');
  25.  
  26. var polygonfeature = new ol.Feature(polygon);
  27. var property = { "name": "Boundary"};
  28. polygonfeature.setProperties(property);
  29.  
  30. var vectorSource1 = new ol.source.Vector();
  31. vectorSource1.addFeature(polygonfeature);
  32.  
  33. var vectorLayer1 = new ol.layer.Vector({
  34. source: vectorSource1,
  35. title: 'polygon_layer'
  36. });
  37.  
  38. map.addLayer(vectorLayer1);
Add Comment
Please, Sign In to add comment