Skip to content

Instantly share code, notes, and snippets.

@mramato
Created August 18, 2015 02:23
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mramato/efbadbd638c32407efde to your computer and use it in GitHub Desktop.
Save mramato/efbadbd638c32407efde to your computer and use it in GitHub Desktop.
//Create's a 1x1 transparent base layer so that the globe has no imagery
var transparentBaseLayer = new Cesium.SingleTileImageryProvider({
url : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNgYAAAAAMAASsJTYQAAAAASUVORK5CYII="
});
//Create the viewer, must specify alpha :true in order for the globe and
//background to be transparent
var viewer = new Cesium.Viewer('cesiumContainer', {
skyBox : false,
skyAtmosphere : false,
baseLayerPicker : false,
imageryProvider : transparentBaseLayer,
contextOptions : {
webgl: {
alpha: true
}
}
});
//Set the background of the scene to transparent
viewer.scene.backgroundColor = Cesium.Color.TRANSPARENT;
//Set the globe base color to transparent
viewer.scene.globe.baseColor = Cesium.Color.TRANSPARENT;
//Work around https://github.com/AnalyticalGraphicsInc/cesium/issues/2866
viewer.scene.fxaa = false;
var rectangle = Cesium.Rectangle.fromDegrees(-115.0, 37.0, -107, 40);
//Add our region limited imagery
viewer.imageryLayers.addImageryProvider(new Cesium.OpenStreetMapImageryProvider({
url : '//a.tile.openstreetmap.org/',
rectangle : rectangle
}));
viewer.camera.viewRectangle(rectangle);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment