A globe using orthographic projection with raster tiles from d3.carto.map.
If you set map.mode("globe") it will overwrite the projection with an orthographic projection and modify panning to allow for rotating a globe along two axes.
A globe using orthographic projection with raster tiles from d3.carto.map.
If you set map.mode("globe") it will overwrite the projection with an orthographic projection and modify panning to allow for rotating a globe along two axes.
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>d3.carto.map - globe mode</title> | |
<meta charset="utf-8" /> | |
<link type="text/css" rel="stylesheet" href="https://raw.githubusercontent.com/emeeks/d3-carto-map/master/d3map.css" /> | |
<link type="text/css" rel="stylesheet" href="https://raw.githubusercontent.com/emeeks/d3-carto-map/master/examples/example.css" /> | |
</head> | |
<style> | |
html,body { | |
height: 100%; | |
width: 100%; | |
margin: 0; | |
} | |
#map { | |
height: 100%; | |
width: 100%; | |
position: absolute; | |
} | |
</style> | |
<script> | |
function makeSomeMaps() { | |
map = d3.carto.map(); | |
d3.select("#map").call(map); | |
map.mode("globe"); | |
map.refresh(); | |
tileLayer = d3.carto.layer(); | |
tileLayer | |
.type("tile") | |
.path("examples.map-zgrqqx0w") | |
.label("Base Layer") | |
geojsonLayer = d3.carto.layer.geojson(); | |
geojsonLayer | |
.path("http://bl.ocks.org/emeeks/raw/c970c9ee3e242e90004b/world.geojson") | |
.label("Canvas Features") | |
.cssClass("halffilledcountries") | |
.renderMode("canvas") | |
.on("load", selectFeatures); | |
map.addCartoLayer(tileLayer).addCartoLayer(geojsonLayer); | |
function selectFeatures() { | |
fNamedCountries = geojsonLayer.features().filter(function (d) {return d.properties.name.length < 6}); | |
featureLayer = d3.carto.layer.featureArray(); | |
featureLayer | |
.features(fNamedCountries) | |
.label("SVG Features") | |
.cssClass("francelike") | |
.renderMode("svg"); | |
map.addCartoLayer(featureLayer); | |
} | |
} | |
</script> | |
<body onload="makeSomeMaps()"> | |
<div id="map"></div> | |
<footer> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8" type="text/javascript"></script> | |
<script src="http://d3js.org/topojson.v1.min.js" type="text/javascript"> | |
</script> | |
<script src="http://d3js.org/d3.geo.projection.v0.min.js" type="text/javascript"> | |
</script> | |
<script src="http://bl.ocks.org/emeeks/raw/f3105fda25ff785dc5ed/tile.js" type="text/javascript"> | |
</script> | |
<script src="http://bl.ocks.org/emeeks/raw/f3105fda25ff785dc5ed/d3.quadtiles.js" type="text/javascript"> | |
</script> | |
<script src="http://bl.ocks.org/emeeks/raw/f3105fda25ff785dc5ed/d3.geo.raster.js" type="text/javascript"> | |
</script> | |
<script src="https://rawgit.com/emeeks/d3-carto-map/master/d3.carto.map.js" type="text/javascript"> | |
</script> | |
</footer> | |
</body> | |
</html> |