2

By default, Cesium globe focuses on the United States, as follows

enter image description here

But I want to show particular country as default (ex:India). I tried many ways to do this, like setting camera positions etc.

emackey
  • 11,818
  • 2
  • 38
  • 58
ChanduRaj
  • 161
  • 1
  • 16

1 Answers1

2

This question has already been asked here and here. You can adapt these answers for the country of India like so:

var west = 68.0;
var south = 7.0;
var east = 89.0;
var north = 35.0;

var rectangle = Cesium.Rectangle.fromDegrees(west, south, east, north);

Cesium.Camera.DEFAULT_VIEW_FACTOR = 0.5;
Cesium.Camera.DEFAULT_VIEW_RECTANGLE = rectangle;

// NOTE: Viewer constructed after default view is set.
var viewer = new Cesium.Viewer('cesiumContainer', {
    navigationHelpButton: false, animation: false, timeline: false
});
html, body, #cesiumContainer {
  width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
  font-family: sans-serif;
}
<link href="http://cesiumjs.org/releases/1.16/Build/Cesium/Widgets/widgets.css" 
      rel="stylesheet"/>
<script src="http://cesiumjs.org/releases/1.16/Build/Cesium/Cesium.js">
</script>
<div id="cesiumContainer"></div>
Community
  • 1
  • 1
emackey
  • 11,818
  • 2
  • 38
  • 58