php - How can I add zones into MySQL database using leaflet? -


i created admin interface user can add markers(hospitals, school) , want extend app drawing polygons(parks, zones). thing connected map , can draw polygons, can't coordinates , add them database. how can this? thanks!

you can try : https://bl.ocks.org/danswick/d30c44b081be31aea483

the interesting part :

var featuregroup = l.featuregroup().addto(map);  var drawcontrol = new l.control.draw({     edit: {         featuregroup: featuregroup     } }).addto(map);  map.on('draw:created', function(e) {      // each time feature created, it's added feature group     featuregroup.addlayer(e.layer); });  // when click on button export document.getelementbyid('export').onclick = function(e) {     // extract geojson featuregroup     var data = featuregroup.togeojson();      // stringify geojson     var converteddata = 'text/json;charset=utf-8,' + encodeuricomponent(json.stringify(data));      // create export     document.getelementbyid('export').setattribute('href', 'data:' + converteddata);     document.getelementbyid('export').setattribute('download','data.geojson'); } 

you have adapt last section database.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -