how to save drawable entities with leaflet.draw/draw polygons into my Postgis database with getting also the coordinates

by Dimitris Floyd   Last Updated July 20, 2017 12:22 PM

I am very new to creating webmaps with Leaflet and I try to save my shapes I draw into my postgis db. I would prefer to be saved as .shp or any default format (i.e. json). I would appreciate for answering me a step-by-step code like a small demo.

the script till now:

var drawnItems = new L.FeatureGroup();

    map.on('draw:created', function (e) {
        var type = e.layerType,
        layer = e.layer;

    polygon_options = {
        allowIntersection: false,
                drawError: {
                    color: '#b00b00',
                    timeout: 1000
                showArea: true,
                metric: false,
                repeatMode: false,
        shapeOptions: {
            stroke: true,
            color: '#6e83f0',
            weight: 4,
            opacity: 0.5,
            fill: true,
            fillColor: null,
            fillOpacity: 0.2,
            clickable: true

    function drawPolygon(){
            var polygonDrawer = new L.Draw.Polygon(map, polygon_options);     

Related Questions

Download google tile layer maps

Updated March 23, 2017 10:22 AM

Leaflet, saving stringified geojson to postgis

Updated February 18, 2017 09:22 AM