Create Blue Marble XYZ tiles

I am trying to create my own XYZ tiles to use them with OpenLayers 3 as my local tiles. On this example you can see the objective/idea.

I want to use the NASA Blue Marble Earth Visible maps, as an example this one from July 2004

On the readme PDF it says that the image is on projection datum WGS84. So the as we know this projection bounds are on EPSG:4326.

I georeference the image on this way.

gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -180 90 180 -90 world.topo.bathy.200407.3x5400x2700.jpg world.topo.bathy.200407.3x5400x2700.tif 

The information of the new generated GeoTIFF can be checked with:

$ gdalinfo world.topo.bathy.200407.3x5400x2700.tif Driver: GTiff/GeoTIFF Files: world.topo.bathy.200407.3x5400x2700.tif Size is 5400, 2700 Coordinate System is: GEOGCS["WGS 84",     DATUM["WGS_1984",         SPHEROID["WGS 84",6378137,298.257223563,             AUTHORITY["EPSG","7030"]],         AUTHORITY["EPSG","6326"]],     PRIMEM["Greenwich",0],     UNIT["degree",0.0174532925199433],     AUTHORITY["EPSG","4326"]] Origin = (-180.000000000000000,90.000000000000000) Pixel Size = (0.066666666666667,-0.066666666666667) Metadata:   AREA_OR_POINT=Area Image Structure Metadata:   INTERLEAVE=PIXEL Corner Coordinates: Upper Left  (-180.0000000,  90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"N) Lower Left  (-180.0000000, -90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"S) Upper Right ( 180.0000000,  90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"N) Lower Right ( 180.0000000, -90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"S) Center      (   0.0000000,   0.0000000) (  0d 0' 0.01"E,  0d 0' 0.01"N) Band 1 Block=5400x1 Type=Byte, ColorInterp=Red Band 2 Block=5400x1 Type=Byte, ColorInterp=Green Band 3 Block=5400x1 Type=Byte, ColorInterp=Blue 

As I want to create XYZ tiles with OpenLayers 3, checking the documentation, I see I need to warp the projection from EPSG:4326 to EPSG:3857, which I do with:

gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 world.topo.bathy.200407.3x5400x2700.tif Marble_3857.tif 

The problem is that the shape of this final image is (4009 x 4514) so it is not square which should be for XYZ tiles.

I have seen from MapTiler this example that uses that map which is already tiled in Create Blue Marble XYZ tiles

, something similar to what I want.

First of all, I have no square shape image projection so I cannot make tiles. And secondly, how can I make different zoom level tiles (zoom till 8 level)? Is there any tool on GDAL for that? I tried gdal2tiles but does not work with following command:

gdal2tiles.py --s_srs EPSG:3857 --zoom 0-3 -p 'raster' Marble_3857.tif 

EDIT

Following the answer of AndreJ it mostly seems to work. First I used gdal_translate as mentioned:

gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -180 90 180 -90 world.topo.bathy.200407.3x5400x2700.jpg world.topo.bathy.200407.3x5400x2700.tif 

Then, before gdal2tiles, as I am using Ubuntu I had to change something on the python code as mentioned here to avoid errors on projection.

After that, I could run the command of AndreJ:

gdal2tiles.py --s_srs EPSG:4326 --zoom 0-5 world.topo.bathy.200407.3x5400x2700.tif ./tiles 

But the result is quite strange because it leaves a transparency column on the right on all the zoom levels... (can be checked downloading the below picture)

What can be the reason? The modified code? Any option I should define?

Create Blue Marble XYZ tiles

Replay

There is no need to reproject the raster. This one worked for me:

gdal2tiles --s_srs EPSG:4326 --zoom 0-5 bluemarble.tif D:\Tiles\bluemrble

gdal2tiles automatically cuts off the pole areas at 85.011 degrees to get a square output at zoom level 0:

Create Blue Marble XYZ tiles

Category: gdal Time: 2016-07-28 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.190 (s). 12 q(s)