Last active
September 26, 2022 06:20
-
-
Save piggynl/013895ebf16a315b25918f90130d355f to your computer and use it in GitHub Desktop.
Convert polygons to polylines in exported drawn Items from Draw Tools in IITC.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var drawnItems = [{"type":"polygon","latLngs":[{"lat":0,"lng":0},{"lat":0,"lng":60},{"lat":30,"lng":30}],"color":"#a24ac3"}]; | |
drawnItems = drawnItems.map(o => o.type !== "polygon" ? o : { ...o, type: "polyline", latLngs: [...o.latLngs, o.latLngs[0]] }); | |
copy(JSON.stringify(drawnItems)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment