Hi Matthew,
Congratulations on your achievements with Cesium so far. I'm really impressed by your effort (and results) here and on github.
I'm trying to migrating a Google Earth api instance to Cesium. To be precise I'm trying to combine the baselayerpicker example in
https://groups.google.com/forum/#!searchin/cesium-dev/providerviewmodels/cesium-dev/2UYkQyA7amU/ULsyQSGbDowJ and the 3D model tutorial and .
Dylan Tusler's flyto-solution in
https://groups.google.com/d/msg/cesium-dev/2rB2xGh8zqM/DAY3GOc8-acJ
I succesfully installed cesium 1.9 , converted a collada model and built a cesium scene with a billboard marker and infoBox and got myself a Bing maps api key. The model and infoBox and billboard-marker all work fine and all relative pathnames are correct) but I'ḿ stuck with these . . .
. . . Issues:
- tiles of selected ImageryProviders won't load in online version. Whilst in local build they do.
- (related?) Imagery provider icons in baselayerpicker won't load (while credits, tooltips and Bing creditlogo do)
- I can't figure out how 'Onclick' to fly smoothly to my scene like in
https://groups.google.com/d/msg/cesium-dev/2rB2xGh8zqM/DAY3GOc8-acJ to flyto my model or Billboard entity.
- I had to kill the terrain imagery layer because it made my model and billboard hover above the ground.
Because this probably is a comon set of issues for a lot of curious Google Earth (API) fans, I'm bold enough to post it here.
Thanks in advance for taking a look at my code below.
Best regards,
Dieter
---------
<!DOCTYPE html>
<html>
<head>
<title>cesium issues 150520</title>
<script src="../../../Cesium/Cesium.js"></script>
<style>
@import url(../../../Cesium/Widgets/widgets.css);
</style>
</head>
<body onload="init();">
<h3>test baselayer picker + flyto + plus model, marker and infoBox</h3>
<div id="cesiumContainer" width="600" height="500"></div>
<!-- Keuze uit imagery providers -->
<script type="text/javascript">
function createImageryProviderViewModels() {
var providerViewModels = [];
providerViewModels.push(new Cesium.ProviderViewModel({
name: 'Bing Maps Aerial',
iconUrl: Cesium.buildModuleUrl('../../../Cesium/Widgets/Images/ImageryProviders/bingAerial.png'),
tooltip: 'Bing Maps aerial imagery \nhttp://
www.bing.com/maps',
creationFunction: function () {
return new Cesium.BingMapsImageryProvider({
url: '//
dev.virtualearth.net',
mapStyle: Cesium.BingMapsStyle.AERIAL
});
}
}));
providerViewModels.push(new Cesium.ProviderViewModel({
name: 'Bing Maps Aerial with Labels',
iconUrl: Cesium.buildModuleUrl('../../../Cesium/Widgets/Images/ImageryProviders/bingAerialLabels.png'),
tooltip: 'Bing Maps aerial imagery with label overlays \nhttp://
www.bing.com/maps',
creationFunction: function () {
return new Cesium.BingMapsImageryProvider({
url: '//
dev.virtualearth.net',
mapStyle: Cesium.BingMapsStyle.AERIAL_WITH_LABELS
});
}
}));
providerViewModels.push(new Cesium.ProviderViewModel({
name: 'ESRI World Imagery',
iconUrl: Cesium.buildModuleUrl('../../../Cesium/Widgets/Images/ImageryProviders/esriWorldImagery.png'),
tooltip: '\
World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution \
satellite imagery worldwide. The map includes NASA Blue Marble: Next Generation 500m resolution imagery at small scales \
(above 1:1,000,000), i-cubed 15m eSAT imagery at medium-to-large scales (down to 1:70,000) for the world, and USGS 15m Landsat \
imagery for Antarctica. The map features 0.3m resolution imagery in the continental United States and 0.6m resolution imagery in \
parts of Western Europe from DigitalGlobe. In other parts of the world, 1 meter resolution imagery is available from GeoEye IKONOS, \
i-cubed Nationwide Prime, Getmapping, AeroGRID, IGN Spain, and IGP Portugal. Additionally, imagery at different resolutions has been \
contributed by the GIS User Community.\nhttp://
www.esri.com',
creationFunction: function () {
return new Cesium.ArcGisMapServerImageryProvider({
url: '//
services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
});
}
}));
providerViewModels.push(new Cesium.ProviderViewModel({
name: 'ESRI World Street Map',
iconUrl: Cesium.buildModuleUrl('../../../Cesium/Widgets/Images/ImageryProviders/esriWorldStreetMap.png'),
tooltip: '\
This worldwide street map presents highway-level data for the world. Street-level data includes the United States; much of \
Canada; Japan; most countries in Europe; Australia and New Zealand; India; parts of South America including Argentina, Brazil, \
Chile, Colombia, and Venezuela; Ghana; and parts of southern Africa including Botswana, Lesotho, Namibia, South Africa, and Swaziland.\n\
http://www.esri.com',
creationFunction: function () {
return new Cesium.ArcGisMapServerImageryProvider({
url: '//
services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer'
});
}
}));
providerViewModels.push(new Cesium.ProviderViewModel({
name: 'Stamen Watercolor',
iconUrl: Cesium.buildModuleUrl('../../../Cesium/Widgets/Images/ImageryProviders/stamenWatercolor.png'),
tooltip: 'Reminiscent of hand drawn maps, Stamen watercolor maps apply raster effect \
area washes and organic edges over a paper texture to add warm pop to any map.\nhttp://
maps.stamen.com',
creationFunction: function () {
return new Cesium.OpenStreetMapImageryProvider({
url: '//
stamen-tiles.a.ssl.fastly.net/watercolor/',
credit: 'Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.'
});
}
}));
providerViewModels.push(new Cesium.ProviderViewModel({
name: 'Stamen Toner',
iconUrl: Cesium.buildModuleUrl('../../../Cesium/Widgets/Images/ImageryProviders/stamenToner.png'),
tooltip: 'A high contrast black and white map.\nhttp://
maps.stamen.com',
creationFunction: function () {
return new Cesium.OpenStreetMapImageryProvider({
url: '//
stamen-tiles.a.ssl.fastly.net/toner/',
credit: 'Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.'
});
}
}));
return providerViewModels;
}
//Bing maps API key
function init() {
// My Bing api key. Why didn't passing this in 'return new Cesium.BingMapsImageryProvider' work?
Cesium.BingMapsApi.defaultKey = "AvOWbRr1xyAtB6hMsKOZDBX03gwAzXoIqhwJBLAtnS1HIrZaLn4toSgCC6MkNFkZ";
var viewer = new Cesium.Viewer('cesiumContainer', {
animation: false,
timeline: false,
homeButton: false,
imageryProviderViewModels: createImageryProviderViewModels()
});
var baseLayerPickerViewModel = viewer.baseLayerPicker.viewModel;
baseLayerPickerViewModel.selectedImagery = baseLayerPickerViewModel.imageryProviderViewModels[0];
//scene zonder startup functie
var scene = viewer.scene;
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(5.3917, 52.1821, 0.0));
var model = scene.primitives.add(Cesium.Model.fromGltf({
url : 'model.gltf',
modelMatrix : modelMatrix,
scale : 1.0
}));
var entity = viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(5.3915, 52.1819),
billboard :{
image : 'justicon.gif'
},
name : 'somename',
description :
'<div style="text-align:center; padding:15px">sometext</div>' +
'<img src="someimage.jpg" border="0" WIDTH="120" HEIGHT="120">'
});
// I had to shut down terain because it made my model float above ground
//
// var terrainProvider = new Cesium.CesiumTerrainProvider({
// url: '//
assets.agi.com/stk-terrain/world',
// requestWaterMask: false
// });
//viewer.terrainProvider = terrainProvider;
// How do I adjust this to flyto my scene above (model,and billboard-marker)? I'd prefer that above creating and flying to an 'invisible rectangle'.
//
// viewer.dataSources.add(datasource.load('
http://XXXXXXXXXXX/kml.asmx/GetFile?fileId=XXXXXXXXXXXX&trackId=0')).then(function(datasource) {
// var maintrack = datasource.entities.values[0];
// viewer.flyTo(maintrack, { duration: 2.0, offset: { heading: 0, pitch: Cesium.Math.toRadians(-45), range: 9000000 } }).then(function () {
// viewer.flyTo(maintrack, { duration: 6.0 });
// });
// });
}
</script>
<p>
some other content
</p>
</body>
</html>
------------------
------------------