Created
November 28, 2022 06:21
-
-
Save DylanCodeCabin/21d0646640d03ae7d051548d89fea8ff to your computer and use it in GitHub Desktop.
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
const customMapId = 1; | |
/* An array with objects, each object represents a polygon */ | |
const customPolygonData = [ | |
{ | |
description : "This is an example", | |
fillcolor: "#808080", | |
linecolor: "#666666", | |
lineopacity: "0.5", | |
linethickness: "3", | |
map_id: customMapId, | |
ohfillcolor: "#333333", | |
ohlinecolor: "#333333", | |
ohopacity: "0.7", | |
opacity: "0.5", | |
polydata: [ | |
{ | |
"lat":"41.973052569247955", | |
"lng":"-120.2621297558594" | |
}, | |
{ | |
"lat":"42.03836216459711", | |
"lng":"-114.0218953808594" | |
}, | |
{ | |
"lat":"34.16782039785561", | |
"lng":"-113.6703328808594" | |
}, | |
{ | |
"lat":"35.32328519432706", | |
"lng":"-115.0765828808594" | |
}, | |
{ | |
"lat":"38.69117201150283", | |
"lng":"-119.9984578808594" | |
} | |
], | |
polyname: "Example", | |
title: "Example", | |
} | |
]; | |
jQuery(function($){ | |
$(document.body).on('markersplaced.wpgmza', () => { | |
const map = WPGMZA.getMapByID(customMapId); | |
if(map){ | |
for(let i in customPolygonData){ | |
const data = customPolygonData[i]; | |
const instance = WPGMZA.Polygon.createInstance(data); | |
map.addPolygon(instance); | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment