Skip to content

Instantly share code, notes, and snippets.

@mapsense-examples
Last active August 29, 2015 14:15
Show Gist options
  • Save mapsense-examples/53f70ebff243cb801821 to your computer and use it in GitHub Desktop.
Save mapsense-examples/53f70ebff243cb801821 to your computer and use it in GitHub Desktop.
Make a Map

Add a Mapsense basemap with one line. Be sure to replace the API key with your own, found at https://developer.mapsense.co/account/.

The resulting map shows the default map settings. Style, center, and zoom can all be set with additional calls. See the documentation for more details. Analytics

<html>
<head>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://d3js.org/topojson.v1.min.js" charset="utf-8"></script>
<script src="https://developer.mapsense.co/mapsense.js" charset="utf-8"></script>
<link type="text/css" href="https://developer.mapsense.co/mapsense.css" rel="stylesheet"/>
<style>
/* Sets the map to be full screen with no margin */
body, html, #myMap{
height: 100%;
width: 100%;
margin: 0;
}
</style>
</head>
<body>
<div id="myMap"></div>
<script>
var map = mapsense
.map("#myMap") // Select an element to add the map to
.add(mapsense.basemap().apiKey("key-2d5eacd8b924489c8ed5e8418bd883bc")) //add a basemap layer and append your API key
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment