tcoupin / leaflet-paintpolygon

Leaflet plugin to create polygon with circle as paint
https://tcoupin.github.io/leaflet-paintpolygon
GNU General Public License v3.0
50 stars 11 forks source link

Dump coordinates of this polygon #7

Open papajds opened 2 years ago

papajds commented 2 years ago

Hello,

Great work.

I start and ,how can we retrieve the coordinates of the polygon in a "textarea" or, at least, display them all in an "alert"

Thanks

(je débute et ,comment peut on récupérer les coordonnées du polygone dans un "textarea" ou , au moins, toutes les afficher dans une "alert")

tcoupin commented 2 years ago

Hi,

you can call getData() function on the controller object. Next, you convert data to json strint with JSON.stringify

Example for https://github.com/tcoupin/leaflet-paintpolygon/blob/master/index.html#L41 :

alert(JSON.stringify(paintpolygonControl.getData()))
papajds commented 2 years ago

Re Bonjour Thibault

Impec !!

je récupère la ligne dans un" textarea"...je vais pouvoir traiter la chaine , pour ne garder que les coordonnées

Merci Beaucoup A+ [image: dump.jpg]

Le lun. 7 mars 2022 à 16:04, Thibault Coupin @.***> a écrit :

Hi,

you can call getData() function on the controller object. Next, you convert data to json strint with JSON.stringify

Example for https://github.com/tcoupin/leaflet-paintpolygon/blob/master/index.html#L41 :

alert(JSON.stringify(paintpolygonControl.getData()))

— Reply to this email directly, view it on GitHub https://github.com/tcoupin/leaflet-paintpolygon/issues/7#issuecomment-1060785071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM2U4ZELCIJLHIF2RHOFY4DU6YLJRANCNFSM5QDQWINA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

cmlnrowan commented 1 year ago

Just learning leaflet so please be patient with me. The control can create multiple polygons. Is it possible to get the coordinates of only the polygon that you just finished drawing after calling .stop(), or are all polygons related to the control treated as one set of data? The reason I ask is that I'd like the paint a polygon, then attach a tooltip, then paint another different polygon, then attach a different tooltip.