Guest User

Untitled

a guest
Oct 21st, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. function map() {
  2. map = new ol.Map({
  3. controls: ol.control.defaults({
  4. attributionOptions: ({
  5. collapsible: true
  6. })
  7. }).extend([
  8. scaleLineControl, new escalaControl(), new quitarContorno()
  9. ]),
  10. logo: false,
  11. layers: layers,
  12. target: 'map',
  13. view: new ol.View({
  14. center:ol.proj.fromLonLat([-61.530766,-34.865575]),
  15. zoom: 7
  16. })
  17. });
  18. }
  19.  
  20. function addInteraction() {
  21. var value = "polygon";
  22. noDraw();
  23. draw = new ol.interaction.Draw({
  24. source: source,
  25. type: "Polygon",
  26. });
  27.  
  28. map.addInteraction(draw);
  29.  
  30. draw.on('drawend', function(evt){
  31. var feature = evt.feature;
  32. var p = feature.getGeometry();
  33. var format = new ol.format.WKT();
  34.  
  35. poligonoWKT = format.writeGeometry(p.transform(ol.proj.get('EPSG:3857'),ol.proj.get('EPSG:4326')));
  36. p.transform(ol.proj.get('EPSG:4326'),ol.proj.get('EPSG:3857'));
  37. console.log(poligonoWKT);
  38.  
  39. noDraw();
  40.  
  41. $("#listgrouparea").show();
  42. getArea();
  43.  
  44. });
  45.  
  46.  
  47. }
Add Comment
Please, Sign In to add comment