Created
April 22, 2015 02:10
-
-
Save hanislovingit/3bc4d530de2cd91e2959 to your computer and use it in GitHub Desktop.
Bing-map-creation-api-polygon
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
// Create the locations | |
var location1 = new Microsoft.Maps.Location(20,-20); | |
var location2 = new Microsoft.Maps.Location(20,20); | |
var location3 = new Microsoft.Maps.Location(-20,20); | |
var location4 = new Microsoft.Maps.Location(-20,-20); | |
// Create an array of locations. Notice the last one in the locations array is the same as the first one | |
var vertices = new Array(location1, location2, location3, location4, location1); | |
// Create a Color object for use in PolygonOptions | |
var polygoncolor = new Microsoft.Maps.Color(100,100,0,100); | |
// Create a polygon object | |
var polygon = new Microsoft.Maps.Polygon(vertices,{ | |
fillColor: polygoncolor, | |
strokeColor: polygoncolor | |
}); | |
// Add the polygon object to the map | |
map.entities.push(polygon); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment