Leaflet js: How to get Lat and lng at the end of drawing any marker on Map

后端 未结 1 337
萌比男神i
萌比男神i 2021-01-29 04:11

i got a one code which is close but i am not sure because i am first time working with Leaflet js.

my intention is: suppose Leaflet js is showing map or non geographical

1条回答
  •  失恋的感觉
    2021-01-29 04:58

    Depends on what you're using to draw polygons/shapes. If you're using leaflet.draw, you would do something like:

    map.on('draw:created', function(e) {
        var points = JSON.stringify(e.layer.toGeoJSON());
    });
    

    And then saving points to your database.

    Read the leaflet.draw documentation, it's pretty complete and straightforward.

    0 讨论(0)
提交回复
热议问题