CesiumGS / CesiumGS/cesium

KML viewer.flyTo placemark goes underground

Open
#4,327 13 comments 3 reactions 0 assignees View on GitHub
category - camera category - kml priority - high type - bug
Dominant language
JavaScript
Stars
15.8k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Reported on the forum: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/E27D7WJHWZ8
Using viewer.flyTo for a pin created by this KML file results in the camera going under ground.

``` javascript
var viewer = new Cesium.Viewer('cesiumContainer');
var options = {
camera : viewer.scene.camera,
canvas : viewer.scene.canvas,
clampToGround: true
};
var zoomTarget;

var kmlFile = "https://raw.githubusercontent.com/googlemaps/kml-samples/gh-pages/kml/Placemark/placemark.kml";
var promise = Cesium.KmlDataSource.load(kmlFile, options);
Cesium.when(promise, function(dataSource) {
viewer.dataSources.add(dataSource);
zoomTarget = dataSource.entities.values[0];
});

Sandcastle.addToolbarButton('Fly to Placemark', function() {
viewer.flyTo(promise);
}, 'toolbar');
```

Interestingly enough, the same thing does not happen when you create a pin at the same location with the entities API

``` javascript
var viewer = new Cesium.Viewer('cesiumContainer');
var options = {
camera : viewer.scene.camera,
canvas : viewer.scene.canvas
};

var pinBuilder = new Cesium.PinBuilder();
var entity = viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(-122.087461,37.422069),
label : {
text : 'pin',
verticalOrigin : Cesium.VerticalOrigin.TOP
},
billboard : {
image : pinBuilder.fromColor(Cesium.Color.SALMON, 24).toDataURL(),
verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
}
});

Sandcastle.addToolbarButton('Fly To Entity', function() {
viewer.flyTo(entity);
}, 'toolbar');
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied Sandcastle example, then trace the KmlDataSource.load and viewer.flyTo entry points shown in the report. Compare the KML placemark camera destination with the entities API case; the issue is done when flying to the KML placemark no longer places the camera underground.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.