Test Data Generator Example

Basic Example

The following code sample shows how to create two random polygons that have a scaleFactor of 0.5, random polygon options and a hole.

<!DOCTYPE html>
    <meta charset="utf-8" />
	<script type='text/javascript'>
    function GetMap() {
        var map = new Microsoft.Maps.Map('#myMap', {
            credentials: ‘Your Bing Maps Key’

        var polygons = Microsoft.Maps.TestDataGenerator.getPolygons(3, map.getBounds(), 5, null, null, true);
    <script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap' async defer></script>
    <div id="myMap" style="position:relative;width:600px;height:400px;"></div>

Here is what these polygons look like when running this code. Note that since the polygons are random, the polygons that will be generated when you run this code will look different.

Test Data Generator

Try it now