Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump coordinates of this polygon #7

Open
papajds opened this issue Mar 7, 2022 · 3 comments
Open

Dump coordinates of this polygon #7

papajds opened this issue Mar 7, 2022 · 3 comments

Comments

@papajds
Copy link

papajds commented Mar 7, 2022

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
Copy link
Owner

tcoupin commented Mar 7, 2022

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
Copy link
Author

papajds commented Mar 7, 2022 via email

@cmlnrowan
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants