Geoscience Reference
In-Depth Information
-w WEBVIEWER, --webviewer=WEBVIEWER
Web viewer to generate (all,google,openlayers,none) - default 'all'.
-t TITLE, --title=TITLE
Title of the map.
-c COPYRIGHT, --copyright=COPYRIGHT
Copyright for the map.
-g GOOGLEKEY, --googlekey=GOOGLEKEY
Google Maps API key from http://code.google.com/apis/maps/signup.html.
-b BINGKEY, --bingkey=BINGKEY
Bing Maps API key
In older versions of the Google Maps API, you needed a valid Google API key,
which you could obtain the Google website. 4 However, in the current version, this
is no longer needed. The raster input file must be a Byte image. You can do this with
gdal_translate by using the -ot Byte option. It is important to take into
account the data range, which can be scaled with the -scale option. There is an
autoscale function, which scales the output range to 0-255. To apply the autoscale
function, just use the -scale option without additional arguments.
Then we can generate the tiles with a single command:
gdal2tiles.py 2013_IEEE_GRSS_DF_Contest_CASI.tif
This results in a new directory 2013_IEEE_GRSS_DF_Contest_CASI_ql .
It contains the tiles, metadata and web pages. You can now open the html files,
googlemaps.html and openlayers.html in your web browser. For example,
openlayers.html shows the raster image with a number of open base layers you
can choose from. The layers include satellite imagery and topographic data from
Google, Virtual Earth, Yahoo and OpenStreetMap. You can navigate across the map
and zoom out until you reach a world view level.
For a paletted file (e.g., a landcover map in GTiff with a color table attached),
you first need to convert it to a RGB(A) file. This can be a virtual file (see Chap. 11 ) .
As an example, we create a pyramid of PNG images from the landcover map of the
IEEE 2013 data fusion contest. We first convert the paletted raster ( testmap.tif )
to a four band (RGBA) virtual raster ( testmap_rgba.vrt using gdal_trans
late . The first instance of gdal2tiles.py creates the pyramid of tiled PNG
images and html files that can be opened in a browser. As an example, we have
overlaid OpenStreetMap on our landcover map in Fig. 7.4 a. The second instance
of gdal2tiles.py creates in the same folder a KML file that can be opened in
Google Earth (see Fig. 7.4 b).
4 https://developers.google.com/maps/documentation/javascript/tutorial?hl=nl#api_key
 
 
Search WWH ::




Custom Search