I’ve noticed that when I used GeoJsonDataSource to add entities with a billboard, the billboard image is not displayed
in the center of the entity’s position. This happens because, for some reason the billboard created by the GeoJsonDataSource, have a verticalOrigin with value 1 (BOTTOM). Whenever I create a plain new entity with a billboard, there’s no verticalOrigin on the billboard graphics.
The code below demonstrates the issue - it creates two entities with the same position and the same billboard, which you can see are shown in
different positions. Currently as a workaround I will set the verticalOrigin to undefined after the parsed geojson is processed.
To reproduce- paste to sandcastle :
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var facilityUrl = ‘…/images/facility.gif’;
var geoJson = {
type : "Point",
coordinates : [-75.5979392,40.0367852]
};
Cesium.GeoJsonDataSource.load(geoJson).then(function(dataSource){
var entity = dataSource.entities.values[0];
entity.billboard.image = facilityUrl;
entity.billboard.color = Cesium.Color.RED.withAlpha(0.5);
viewer.entities.add(entity);
});
var entity = new Cesium.Entity();
entity.position = Cesium.Cartesian3.fromDegrees(-75.5979392,40.0367852);
entity.billboard = new Cesium.BillboardGraphics();
entity.billboard.image = facilityUrl;
entity.billboard.color = Cesium.Color.YELLOW.withAlpha(0.5);
viewer.entities.add(entity);
``