Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up
Find file
Copy path
AzureMapsCodeSamples/AzureMapsCodeSamples/Polygon and Polygon Extrusion Layers/Geospatially Accurate Circle.html
Find file
Copy path
Fetching contributors…

<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Geospatially Accurate Circle - Azure Maps Web SDK Samples</title> | |
<meta charset="utf-8" /> | |
<meta http-equiv="x-ua-compatible" content="IE=Edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> | |
<meta name="description" content="This sample shows how to use the extended GeoJSON schema defined by Azure Maps to create a geospatially accurate circle on the map with a filled area and a styled outline." /> | |
<meta name="keywords" content="map, gis, API, SDK, circles, geospatial, geospatial circles" /> | |
<meta name="author" content="Microsoft Azure Maps" /> | |
<!-- Add references to the Azure Maps Map control JavaScript and CSS files. --> | |
<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css" /> | |
<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script> | |
<script type='text/javascript'> | |
var map, datasource; | |
function GetMap() { | |
//Initialize a map instance. | |
map = new atlas.Map('myMap', { | |
center: [-122.33, 47.6], | |
zoom: 13, | |
view: 'Auto', | |
//Add your Azure Maps subscription key to the map SDK. Get an Azure Maps key at https://azure.com/maps | |
authOptions: { | |
authType: 'subscriptionKey', | |
subscriptionKey: '<Your Azure Maps Key>' | |
} | |
}); | |
//Wait until the map resources are ready. | |
map.events.add('ready', function () { | |
//Create a data source and add it to the map. | |
datasource = new atlas.source.DataSource(); | |
map.sources.add(datasource); | |
//Create a circle from a Point feature by providing it a subType property set to "Circle" and radius property. | |
datasource.add(new atlas.data.Feature(new atlas.data.Point([-122.33, 47.6]), { | |
subType: "Circle", | |
radius: 1000 | |
})); | |
//Create a polygon layer to render the filled in area of the circle polygon, and add it to the map. | |
map.layers.add(new atlas.layer.PolygonLayer(datasource, null, { | |
fillColor: 'rgba(0, 200, 200, 0.5)' | |
})); | |
}); | |
} | |
</script> | |
</head> | |
<body onload="GetMap()"> | |
<div id="myMap" style="position:relative;width:100%;min-width:290px;height:600px;"></div> | |
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;"> | |
<legend>Geospatially Accurate Circle</legend> | |
This sample shows how to use the extended GeoJSON schema defined by Azure Maps to create a geospatially accurate circle on the map with a filled area and a styled outline. | |
As you zoom the map in and out you will notice that circles scales such that it covers the same geospatial area of the map. | |
</fieldset> | |
</body> | |
</html> |