Skip to content

Instantly share code, notes, and snippets.

@maptastik
Created November 8, 2016 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maptastik/a8ed721b183a113f1e34ab8d56cb0a5a to your computer and use it in GitHub Desktop.
Save maptastik/a8ed721b183a113f1e34ab8d56cb0a5a to your computer and use it in GitHub Desktop.
Bing Map w/ GeoJSON
license: mit
var usgsEarthquakeUrl = 'http://earthquake.usgs.gov/fdsnws/event/1/query?minmagnitude=3&format=geojson';
function GetMap() {
var map = new Microsoft.Maps.Map('#myMap', {
credentials: ‘AlXPdK-o4cuvCuOi_uBF6wUJBEbe8x8o0U00Uk579z2IQFfFGK1uu4tnpXIDhM58’
});
Microsoft.Maps.loadModule('Microsoft.Maps.GeoJson', function () {
Microsoft.Maps.GeoJson.readFromUrl(usgsEarthquakeUrl,
function (shapes) {
//Add the shape(s) to the map.
map.entities.push(shapes);
}, 'callback');
});
}
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<div id="myMap" style="position:relative;width:1200px;height:800px;"></div>
<script type='text/javascript'
src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap'
async defer></script>
<script src="app.js" type='text/javascript'></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment