Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var iconFeature = new ol.Feature({
- geometry: new ol.geom.Point([8637791.36, 1456487.82]),
- name: 'Police Station',
- population: 4000,
- rainfall: 500
- });
- var vectorSource = new ol.source.Vector({
- features: [iconFeature]
- });
- var vectorLayer = new ol.layer.Vector({
- source: vectorSource,
- title: 'point_layer'
- });
- var ring = [[77.4700927734375, 12.906190219892437],[77.4707794189453, 12.987162237749473],
- [77.5188446044922, 12.989838549012532],[77.51060485839844, 12.961066692801282],
- [77.51747131347656, 12.953705916047227],[77.52708435058594, 12.94500653581774],
- [77.51815795898438, 12.936306851970144],[77.50030517578125, 12.92426063498786],
- [77.486572265625, 12.912883118595701],[77.4700927734375, 12.906190219892437]];
- var polygon = new ol.geom.Polygon([ring]);
- polygon.transform('EPSG:4326', 'EPSG:3857');
- var polygonfeature = new ol.Feature(polygon);
- var property = { "name": "Boundary"};
- polygonfeature.setProperties(property);
- var vectorSource1 = new ol.source.Vector();
- vectorSource1.addFeature(polygonfeature);
- var vectorLayer1 = new ol.layer.Vector({
- source: vectorSource1,
- title: 'polygon_layer'
- });
- map.addLayer(vectorLayer1);
Add Comment
Please, Sign In to add comment