daily pastebin goal
55%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var drawControl = new L.Control.Draw({
  2. draw: {
  3.     polygon: false,
  4.     polyline: false,
  5.     rectangle: false,
  6.     circle: false,
  7. },
  8.  
  9. edit: {
  10.     featureGroup: drawnItems
  11. }
  12. });
  13. map.addControl(drawControl);
  14. map.on('draw:created', function (e) {
  15.     var type = e.layerType,
  16.         layer = e.layer;
  17.     drawnItems.addLayer(layer);
  18.     var shape = layer.toGeoJSON()
  19.     var shape_for_db = JSON.stringify(shape);
  20.     return shape_for_db;
  21.     var popup = L.popup()
  22.         .setLatLng(layer.getLatLng())
  23.         .setContent('<span><b>Shape Name</b></span><br/><input id="shapeName" type="text"/><br/><br/><span><b>Shape Description<b/></span><br/><textarea id="shapeDesc" cols="25" rows="5"></textarea><br/><br/><input type="button" id="okBtn" value="Save" onclick="savePopup()"/>')
  24.         .openOn(map);
  25.  
  26. });
  27. function savePopup(){
  28.     var sName = $('#shapeName').val();
  29.     var sDesc = $('#shapeDesc').val();
  30.     var drawings = drawnItems.getLayers();
  31.     drawings[drawings.length - 1].title = sName;
  32.     drawings[drawings.length -1].content =sDesc;
  33.     map.closePopup();
  34.  
  35. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top