Hi, i fix my problem using SingleTileImageryProvider. It was a .png file that i tried to generate as Tiles.
Glad to hear. As a follow up though you can still use gdal2tiles to make it into TMS, but you need to use gdal_translate as an intermediary step to convert to a geotiff that contains the bounding and projection information.
This is how I’ve been able to use the NASA’s blue marble PNG files and make a TMS out of them.
Kevin,
Have you ever tried to run from chrome with the with --allow-file-access-from-files in the command-line. ?
Hi Mike,
I am trying to do something very similar to what you said here, I grabbed one of NASAs blue marble images, and used gdal_translate, gdalwarp and gdal2tiles.py to make a TMS out of the image. Here are my steps:
gdal_translate -of VRT -a_srs EPSG:4326 -gcp 0 0 -180 90 -gcp 21600 0 180 90 -gcp 21600 10800 180 -90 world_200401.jpg bluemarble1.vrt
gdalwarp -of VRT -t_srs EPSG:4326 bluemarble1.vrt bluemarble2.vrt
gdal2tiles.py -p geodetic bluemarble2.vrt
After this, I can successfully open the image in Cesium using the following bit of code:
var viewer = new Cesium.Viewer('cesiumContainer', {
baseLayerPicker: false,
geocoder: false,
imageryProvider: new Cesium.createTileMapServiceImageryProvider({
url: '../data/NASA/bluemarble2',
// minimumLevel: 0,
credit: 'NASA'
})
});
HOWEVER, it seems that the image is not wrapped correctly around the globe...it only wraps it half way around, and halfway down from the centre. Leaving a lot of blue.
Any idea what I could be doing wrong? Here is a link to the image I used and some output files I got: https://drive.google.com/folderview?id=0B97NtaPJrVz-a3EwbXhkdlYyM00&usp=sharing
Here is my tilemapresource.xml file:
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0"><Title>bluemarble2.vrt</Title><Abstract/><SRS>EPSG:4326</SRS><BoundingBox minx="-180.00000000000000" miny="-90.00000000000000" maxx="180.00000000000000" maxy="90.00000000000000"/><Origin x="-180.00000000000000" y="-90.00000000000000"/><TileFormat width="256" height="256" mime-type="image/png" extension="png"/><TileSets profile="geodetic"><TileSet href="0" units-per-pixel="0.70312500000000" order="0"/><TileSet href="1" units-per-pixel="0.35156250000000" order="1"/><TileSet href="2" units-per-pixel="0.17578125000000" order="2"/><TileSet href="3" units-per-pixel="0.08789062500000" order="3"/><TileSet href="4" units-per-pixel="0.04394531250000" order="4"/><TileSet href="5" units-per-pixel="0.02197265625000" order="5"/><TileSet href="6" units-per-pixel="0.01098632812500" order="6"/></TileSets></TileMap>
Hello,
You may need to set the option ‘flipXY: true’
See this example with NASA black marble:
var blackMarble = layers.addImageryProvider(Cesium.createTileMapServiceImageryProvider({
url : ‘https://cesiumjs.org/blackmarble’,
credit : ‘Black Marble imagery courtesy NASA Earth Observatory’,
flipXY : true // Only old gdal2tile.py generated tilesets need this flag.
}));
``
Best,
Hannah
Hi Hannah,
Thanks for the response.
I actually tried that but it didn't work. My tilesets generated with gdal2tiles.py is not old as the comment suggests I guess.
Even if it did though, half of the globe will still be left uncovered...
Any other ideas?
Thanks again!
Hi all,
I actually found the solution to my problem: according to the API reference, Cesium uses the mercator tiling scheme.
"A tiling scheme for geometry referenced to a WebMercatorProjection, EPSG:3857. This is the tiling scheme used by Google Maps, Microsoft Bing Maps, and most of ESRI ArcGIS Online."
Thus, instead of using EPSG:4326 I needed to use the EPSG:3857 mercator projection...
gdal_translate -of VRT -a_srs EPSG:3857 -gcp 0 0 -180 90 -gcp 21600 0 180 90 -gcp 21600 10800 180 -90 world_200401.jpg bluemarble1.vrt
gdalwarp -of VRT -t_srs EPSG:3857 bluemarble1.vrt bluemarble2.vrt
gdal2tiles.py bluemarble2.vrt
Hope this helps someone else.
Regards,
Evert
Hi,
i actually try Evert solution but it didn't work. I flip also XY.
it only wraps it half way around, and halfway down from the centre.
File example:
Is there any other solution to generate cesium tiles for free (maybe with cesium)? I have around 6 maps(.jpg with 100mb) to load and it is faster to do it with tiles.
Regards,
Lia
Hi
Evert do you find any good solution for image quality? i need to re-project my maps from epsg:3067 to epsg:3857 so that i can use them with my cesiumin application. I found that image quality will get bad when i re-project them i'll use gdalwarp.
Cheers
Juho