Optimizing, publishing, and styling GeoTIFF data

Styling raster data

  • Select a dataset of the type Raster, go to its details page, and click on Edit > Edit Style

    image

  • By default, a code editor is shown on the left. You can choose to change to a visual editor by clicking on the button in the upper-right corner of the editor. image

    image

  • Note the changes on the dataset as you are making the edits. Once your style is ready, click on Apply to save the changes image

Adding and Optimizing Raster Image Mosaics

An Image Mosaic comprises a set of datasets that are exposed as a single coverage. The ImageMosaic format allows for the automatic build and setup of a mosaic from a set of georeferenced datasets. This section provides better instructions on configuring an Image Mosaic.

Publishing an Image Mosaic

In this section, we will publish a mosaic of aerial orthophotos on GeoNode through the GeoServer ImageMosaic store.

We will need to do some preparation first.

  • Open a terminal and navigate to the folder /opt/data/sample_data/user_data. Change the write permissions of the folder named aerial to allow the user to modify it

    cd /opt/data/sample_data/user_data
    sudo chmod -Rf 777 aerial
    
  • Navigate to aerial, and delete the files aerial.properties and sample_image.dat

    cd aerial
    rm aerial.properties sample_image.dat
    
  • Create, or edit, a file named indexer.properties with the following contents

    vim indexer.properties
    
    Caching=false
    Schema=*the_geom:Polygon,location:String
    
  • Create, or edit, a file named datastore.properties with the following contents

    vim datastore.properties
    
    SPI=org.geotools.data.postgis.PostgisNGDataStoreFactory
    host=localhost
    port=5432
    database=geonode_data
    schema=public
    user=geonode
    passwd=geonode
    Loose\ bbox=true
    Estimated\ extends=false
    validate\ connections=true
    Connection\ timeout=10
    preparedStatements=true
    create\ database\ params=WITH\ TEMPLATE\=postgis20
    
  • Go to the GeoServer admin dashboard, log in as an admin and click on Data > Stores > Add new store

    image

  • Select ImageMosaic from the list of the available Raster Data Sources

    image

  • Provide the following inputs on the ImageMosaic form

    • Name: Aerial

    • Title: Aerial

    • URL*: file:/opt/data/sample_data/user_data/aerial

    image

  • In the next windows, click on Publish and Save the dataset

    image

    image

  • Move to the GeoServer Layer Preview section and open the OpenLayers preview for the Aeriel layer

    image

  • We will suddenly see two main issues:

    1. The load, pan, and zoom are slow

    2. There are some black tiles filling the bounding box

    image

Optimizing an Image Mosaic

  • Open a terminal and navigate to the folder /opt/data/sample_data/user_data. Change the write permissions of the folder named optimized to allow the user to modify it

    cd /opt/data/sample_data/user_data
    sudo chmod -Rf 777 optimized
    
  • Navigate to optimized, and delete the files optimized.properties and sample_image.dat

    cd optimized
    rm optimized.properties sample_image.dat
    
  • Create, or edit, a file named indexer.properties with the following contents

    vim indexer.properties
    
    Caching=false
    Schema=*the_geom:Polygon,location:String
    
  • Create, or edit, a file named datastore.properties with the following contents

    vim datastore.properties
    
    SPI=org.geotools.data.postgis.PostgisNGDataStoreFactory
    host=localhost
    port=5432
    database=geonode_data
    schema=public
    user=geonode
    passwd=geonode
    Loose\ bbox=true
    Estimated\ extends=false
    validate\ connections=true
    Connection\ timeout=10
    preparedStatements=true
    create\ database\ params=WITH\ TEMPLATE\=postgis20
    
  • Add a new ImageMosaic Data Source, like we already done before, and provide the following parameters

  • Provide the following inputs on the ImageMosaic form

    • Name: boulder_bg_optimized

    • Title: boulder_bg_optimized

    • URL*: file:/opt/data/sample_data/user_data/optimized

    image

  • In the next windows; click on Publish, change the name and title to boulder_bg_optimized, and Save the layer

    image

  • Open the GeoServer Layer Preview and zoom/pan around. Notice how much faster the mosaic is now…

    image

    The black tiles are still present.

  • Let’s customize the mosaic options in order to improve the quality and remove the black tiles.

  • Customize the ImageMosaic properties, set the OutputTransparentColor to the value 000000 (which is the Black color), and click on Save when done.

    image

  • Open the GeoServer Layer Preview, clear the browser image cache, and zoom/pan around. Notice how the black tiles are now gone

    image

Image Mosaic Options

There are plenty of options that can be tweaked to optimize an ImageMosaic further.

  • Accurate resolution computation: If true, it computes the resolution of the granules in 9 points, the corners of the requested area, and the middle points and then takes the better one. This will provide better results for cases where there is a lot more deformation on a subregion (top/bottom/sides) of the requested box concerning the other boxes. Otherwise, compute the resolution using a basic affine scale transform.

  • AllowMultithreading: If true, it enables multithreaded tile loading. This performs parallelized loading of the granules that compose the mosaic.

  • BackgroundValues: Sets the value of the mosaic background. Depending on the nature of the mosaic it is wise to set a value for the no data area (usually -9999). This value is repeated on all the mosaic bands.

  • Bands: a comma-separated list of band indexes exposes a particular subset of bands out of a multi-band source. It is normally not configured by hand but driven by SLD styling instead.

  • ExcessGranuleRemoval: An option that should be enabled when using scattered and deeply overlapping images. By default, the image mosaic will try to mosaic together all images in the requested area (even if some are behind other images and won’t show up in the final image). With excess granule removal, the system will use the image footprint to determine which granules contribute pixels to the output. It will only perform the image processing on those images actually contributing to the mosaic. It is best used with footprints and sorting (to control which images stay on top). Possible values are NONE or ROI (Region Of Interest).

  • Filter: Filters granules based on attributes from the input coverage.

  • Footprint Behavior: Sets the behaviour of the regions of a granule that are outside of the granule footprint. It can be None (Ignore the footprint), Cut (Remove regions outside the footprint from the image. This does not add an alpha channel), or Transparent (Make regions outside the footprint completely transparent. This will add an alpha channel if one is not already present). Defaults to None.

  • InputTransparentColor: Sets the transparent colour for the granules prior to mosaicking them in order to control the superimposition process between them. When GeoServer composes the granules to satisfy the user request, some of them can overlap some others. Therefore, setting this parameter with the opportune colour avoids the overlap of no data areas between granules.

  • MaxAllowedTiles: Sets the maximum number of tiles that can be loaded simultaneously for a request. In the case of a large mosaic, this parameter should be opportunely set to not saturate the server with too many granules being loaded simultaneously.

  • MergeBehavior: Merges behaviour for the various granules of the mosaic that GeoServer will produce. This parameter controls whether we want to merge in a single mosaic or stack all the bands into the final mosaic.

  • OVERVIEW_POLICY: Policy used to select the best matching overview for a given target output resolution. The possible values are QUALITY (pick an overview with a higher resolution and downsample), NEAREST (pick the one with the closest resolution), SPEED (pick the closest one with a lower resolution), and IGNORE (do not use overviews).

  • OutputTransparentColor: Sets the transparent color for the created mosaic.

  • SORTING: Specifies the time order of the obtained granules set. Valid values are DESC (descending) or ASC (ascending). Note that it works just by using DBMS as indexes.

  • SUGGESTED_TILE_SIZE: Controls the tile size of the input granules and the tile size of the output mosaic. It consists of two positive integers separated by a comma, like 512,512.

  • USE_JAI_IMAGEREAD: If true, GeoServer will use the JAI ImageRead operation and its deferred loading mechanism to load granules. If false, GeoServer will perform direct ImageIO read calls, resulting in immediate loading.

Introduction To Processing With GDAL Utilities

It’s a common practice to do a preliminary analysis of the available data and, if needed, to optimize it. Since configuring big datasets without proper pre-processing may result in low performance when accessing them.

The previous examples show the difference between a non-optimized and an optimized mosaic, i.e. mosaics with pre-processed GeoTIFF granules and those without.

In this section, instructions about how to do data optimization will be provided by introducing some of the GDAL Utilities.

gdalinfo

This utility allows a user to get information from the GDAL library, for instance, specific Driver capabilities and input Layers/Files properties.

gdalinfo - Getting Driver’s Capabilities

GeoTIFF being a widely adopted geospatial format, it’s helpful to get information about the GDAL GeoTIFF’s Driver capabilities using the command

gdalinfo --format GTIFF
Format Details:
  Short Name: GTiff
  Long Name: GeoTIFF
  Supports: Raster
  Extensions: tif tiff
  Mime Type: image/tiff
  Help Topic: drivers/raster/gtiff.html
  Supports: Sublayers
  Supports: Open() - Open existing datasets.
  Supports: Create() - Create writable dataset.
  Supports: CreateCopy() - Create dataset by copying another.
  Supports: Virtual IO - eg. /vsimem/
  Creation Datatypes: Byte UInt16 Int16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64

<CreationOptionList>
  <Option name="COMPRESS" type="string-select">
    <Value>NONE</Value>
    <Value>LZW</Value>
    <Value>PACKBITS</Value>
    <Value>JPEG</Value>
    <Value>CCITTRLE</Value>
    <Value>CCITTFAX3</Value>
    <Value>CCITTFAX4</Value>
    <Value>DEFLATE</Value>
    <Value>LZMA</Value>
    <Value>ZSTD</Value>
    <Value>WEBP</Value>
  </Option>
  <Option name="PREDICTOR" type="int" description="Predictor Type (1=default, 2=horizontal differencing, 3=floating point prediction)" />
  <Option name="DISCARD_LSB" type="string" description="Number of least-significant bits to set to clear as a single value or comma-separated list of values for per-band values" />
  <Option name="JPEG_QUALITY" type="int" description="JPEG quality 1-100" default="75" />
  <Option name="JPEGTABLESMODE" type="int" description="Content of JPEGTABLES tag. 0=no JPEGTABLES tag, 1=Quantization tables only, 2=Huffman tables only, 3=Both" default="1" />
  <Option name="ZLEVEL" type="int" description="DEFLATE compression level 1-9" default="6" />
  <Option name="LZMA_PRESET" type="int" description="LZMA compression level 0(fast)-9(slow)" default="6" />
  <Option name="ZSTD_LEVEL" type="int" description="ZSTD compression level 1(fast)-22(slow)" default="9" />
  <Option name="WEBP_LEVEL" type="int" description="WEBP quality level. Low values result in higher compression ratios" default="75" />
  <Option name="NUM_THREADS" type="string" description="Number of worker threads for compression. Can be set to ALL_CPUS" default="1" />
  <Option name="NBITS" type="int" description="BITS for sub-byte files (1-7), sub-uint16_t (9-15), sub-uint32_t (17-31), or float32 (16)" />
  <Option name="INTERLEAVE" type="string-select" default="PIXEL">
    <Value>BAND</Value>
    <Value>PIXEL</Value>
  </Option>
  <Option name="TILED" type="boolean" description="Switch to tiled format" />
  <Option name="TFW" type="boolean" description="Write out world file" />
  <Option name="RPB" type="boolean" description="Write out .RPB (RPC) file" />
  <Option name="RPCTXT" type="boolean" description="Write out _RPC.TXT file" />
  <Option name="BLOCKXSIZE" type="int" description="Tile Width" />
  <Option name="BLOCKYSIZE" type="int" description="Tile/Strip Height" />
  <Option name="PHOTOMETRIC" type="string-select">
    <Value>MINISBLACK</Value>
    <Value>MINISWHITE</Value>
    <Value>PALETTE</Value>
    <Value>RGB</Value>
    <Value>CMYK</Value>
    <Value>YCBCR</Value>
    <Value>CIELAB</Value>
    <Value>ICCLAB</Value>
    <Value>ITULAB</Value>
  </Option>
  <Option name="SPARSE_OK" type="boolean" description="Should empty blocks be omitted on disk?" default="FALSE" />
  <Option name="ALPHA" type="string-select" description="Mark first extrasample as being alpha">
    <Value>NON-PREMULTIPLIED</Value>
    <Value>PREMULTIPLIED</Value>
    <Value>UNSPECIFIED</Value>
    <Value aliasOf="NON-PREMULTIPLIED">YES</Value>
    <Value aliasOf="UNSPECIFIED">NO</Value>
  </Option>
  <Option name="PROFILE" type="string-select" default="GDALGeoTIFF">
    <Value>GDALGeoTIFF</Value>
    <Value>GeoTIFF</Value>
    <Value>BASELINE</Value>
  </Option>
  <Option name="PIXELTYPE" type="string-select">
    <Value>DEFAULT</Value>
    <Value>SIGNEDBYTE</Value>
  </Option>
  <Option name="BIGTIFF" type="string-select" description="Force creation of BigTIFF file">
    <Value>YES</Value>
    <Value>NO</Value>
    <Value>IF_NEEDED</Value>
    <Value>IF_SAFER</Value>
  </Option>
  <Option name="ENDIANNESS" type="string-select" default="NATIVE" description="Force endianness of created file. For DEBUG purpose mostly">
    <Value>NATIVE</Value>
    <Value>INVERTED</Value>
    <Value>LITTLE</Value>
    <Value>BIG</Value>
  </Option>
  <Option name="COPY_SRC_OVERVIEWS" type="boolean" default="NO" description="Force copy of overviews of source layer (CreateCopy())" />
  <Option name="SOURCE_ICC_PROFILE" type="string" description="ICC profile" />
  <Option name="SOURCE_PRIMARIES_RED" type="string" description="x,y,1.0 (xyY) red chromaticity" />
  <Option name="SOURCE_PRIMARIES_GREEN" type="string" description="x,y,1.0 (xyY) green chromaticity" />
  <Option name="SOURCE_PRIMARIES_BLUE" type="string" description="x,y,1.0 (xyY) blue chromaticity" />
  <Option name="SOURCE_WHITEPOINT" type="string" description="x,y,1.0 (xyY) whitepoint" />
  <Option name="TIFFTAG_TRANSFERFUNCTION_RED" type="string" description="Transfer function for red" />
  <Option name="TIFFTAG_TRANSFERFUNCTION_GREEN" type="string" description="Transfer function for green" />
  <Option name="TIFFTAG_TRANSFERFUNCTION_BLUE" type="string" description="Transfer function for blue" />
  <Option name="TIFFTAG_TRANSFERRANGE_BLACK" type="string" description="Transfer range for black" />
  <Option name="TIFFTAG_TRANSFERRANGE_WHITE" type="string" description="Transfer range for white" />
  <Option name="STREAMABLE_OUTPUT" type="boolean" default="NO" description="Enforce a mode compatible with a streamable file" />
  <Option name="GEOTIFF_KEYS_FLAVOR" type="string-select" default="STANDARD" description="Which flavor of GeoTIFF keys must be used">
    <Value>STANDARD</Value>
    <Value>ESRI_PE</Value>
  </Option>
  <Option name="GEOTIFF_VERSION" type="string-select" default="AUTO" description="Which version of GeoTIFF must be used">
    <Value>AUTO</Value>
    <Value>1.0</Value>
    <Value>1.1</Value>
  </Option>
</CreationOptionList>

<OpenOptionList>
  <Option name="NUM_THREADS" type="string" description="Number of worker threads for compression. Can be set to ALL_CPUS" default="1" />
  <Option name="GEOTIFF_KEYS_FLAVOR" type="string-select" default="STANDARD" description="Which flavor of GeoTIFF keys must be used (for writing)">
    <Value>STANDARD</Value>
    <Value>ESRI_PE</Value>
  </Option>
  <Option name="GEOREF_SOURCES" type="string" description="Comma separated list made with values INTERNAL/TABFILE/WORLDFILE/PAM/NONE that describe the priority order for georeferencing" default="PAM,INTERNAL,TABFILE,WORLDFILE" />
  <Option name="SPARSE_OK" type="boolean" description="Should empty blocks be omitted on disk?" default="FALSE" />
</OpenOptionList>

  Other metadata items:
    LIBGEOTIFF=1700
    LIBTIFF=LIBTIFF, Version 4.1.0
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.

From the list of create options above, it’s possible to determine the main GeoTIFF Driver’s writing capabilities:

  • COMPRESS: customize the compression to be used when writing output data

  • JPEG_QUALITY: specify a quality factor to be used by the JPEG compression

  • TILED: When set to YES it allows output data to be tiled

  • BLOCKXSIZE, BLOCKYZISE: Specify the Tile dimension width and Tile dimension height

  • PHOTOMETRIC: Specify the photometric interpretation of the data

  • PROFILE: Specify the GeoTIFF profile to be used (some profiles only support a minimal set of TIFF Tags while some others provide a wider range of Tags)

  • BIGTIFF: Specify when to write data as BigTIFF (A TIFF format that breaks the 4GB Offset boundary)

gdalinfo - Getting Dataset/File Properties

The following instructions allow you to get information about the sample dataset that was previously configured on GeoServer

cd /opt/data/sample_data/user_data/aerial
gdalinfo 13tde815295_200803_0x6000m_cl.tif

image

Part of the gdalinfo output on a sample dataset.

  • Block: It represents the internal tiling. Notice that the sample dataset has tiles made of 16 rows having a width equal to the full image width.

  • Overviews: It provides information about the underlying overviews. Notice that the sample dataset doesn’t have overviews since the overviews property is missing from the gdalinfo output.

gdal_translate

This utility converts a dataset to a different format by allowing a wide set of parameters to customize the conversion.

Running the command

gdal_translate

gets the list of supported parameters as well as the supported output formats

Usage: gdal_translate [--help-general]
       [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
             CInt16/CInt32/CFloat32/CFloat64}] [-strict]
       [-of format] [-b band] [-mask band] [-expand {gray|rgb|rgba}]
       [-outsize xsize[%] ysize[%]]
       [- unscale] [-scale [src_min src_max [dst_min dst_max]]]
       [-srcwin xoff yoff xsize ysize] [-projwin ulx uly lrx lry]
       [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-a_nodata value]
       [-gcp pixel line easting northing [elevation]]*
       [-mo "META-TAG=VALUE"]* [-q] [-sds]
       [-co "NAME=VALUE"]* [-stats]
       src_layer dst_layer

The meaning of the main parameters is summarized below.

  • -ot: specifies the output datatype (Make sure that the specified data type is contained in the Creation Datatypes list of the Writing driver)

  • -of: specifies the desired output format (GTIFF is the default value)

  • -b: specifies an input band to be written in the output file. (Use multiple -b options to specify more bands)

  • -mask: specifies an input band to create an output dataset mask band.

  • -expand: exposes a 1 band dataset with a colour table as a dataset with 3 (rgb) or 4 (rgba) bands. The ‘gray’ value enables to expand a dataset with a colour table containing only grey levels to a grey indexed dataset.

  • -outsize: sets the size of the output file in terms of pixels and lines unless the % sign is attached, in which case, it’s as a fraction of the input image size.

  • -unscale: applies the scale/offset metadata for the bands to convert from scaled values to unscaled values.

  • -scale: rescales the input pixels values from the range src_min to src_max to the range dst_min to dst_max. (If omitted, the output range is 0 to 255. If omitted, the input range is automatically computed from the source data).

  • -srcwin: selects a subwindow from the source image in terms of xoffset, yoffset, width, and height

  • -projwin: selects a subwindow from the source image by specifying the corners given in georeferenced coordinates.

  • -a_srs: overrides the projection for the output file. The srs_def may be any of the usual GDAL/OGR forms; complete WKT, PROJ.4, EPSG:n, or a file containing the WKT.

  • -a_ullr: assigns/overrides the georeferenced bounds of the output file.

  • -a_nodata: assigns a specified no data value to output bands.

  • -co: sets a creation option in the form “NAME=VALUE” to the output format driver. (Multiple -co options may be listed.)

  • -stats: gets statistics (min, max, mean, stdDev) for each band

  • src_layer: is the source dataset name. It can be either file name, URL of data source, or sublayer name for multi*-layer files.

  • dst_layer: is the destination file name.

gdal_translate - Tiling the sample dataset

The following steps provide instructions to tile the sample dataset previously configured in GeoServer using the GeoTiff driver.

  • Navigate to the parent folder /opt/data/sample_data/user_data

    cd /opt/data/sample_data/user_data
    
  • Convert the input sample data to an output file that has tiling set to 512x512 (the compression parameters are explained in the code).

    gdal_translate -co "TILED=YES" -co "BLOCKXSIZE=512" -co "BLOCKYSIZE=512"  -co "COMPRESS=JPEG" -co "PHOTOMETRIC=YCBCR" -co "QUALITY=85"  aerial/13tde815295_200803_0x6000m_cl.tif retiled/13tde815295_200803_0x6000m_cl.tif
    
  • Check that the output dataset has successfully been tiled by running the command

    gdalinfo retiled/13tde815295_200803_0x6000m_cl.tif
    

    image

    Part of the gdalinfo output on the tiled dataset. Notice the Block value now is 512x512.

gdaladdo

This utility allows for the addition of overviews to a dataset. The following steps provide instructions to add overviews to the tiled sample dataset.

Running the command

gdaladdo

gets the list of supported parameters

Usage: gdaladdo [-r {nearest,average,gauss,average_mp,average_magphase,mode}]
                [-ro] [--help-general] filename levels

The meaning of the main parameters is summarized below.

  • -r: specifies the resampling algorithm (Nearest is the default value)

  • -ro: opens the dataset in read-only mode, to generate an external overview (for GeoTIFF especially)

  • filename: represents the file to build overviews for.

  • levels: specifies a list of overview levels to build.

gdaladdo - Adding overviews to the sample dataset

  • Navigate to the retiled folder

    cd retiled
    
  • Run the gdaladdo command as follows

    gdaladdo -r average --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config JPEG_QUALITY_OVERVIEW 85 13tde815295_200803_0x6000m_cl.tif 2 4 8 16 32
    
  • Check that the overviews have been added to the dataset by running the command

    gdalinfo 13tde815295_200803_0x6000m_cl.tif
    

    image

    Part of the gdalinfo output on the tiled dataset with overviews. Note the Overviews properties.

Process in Bulk

Instead of manually repeating these 2 steps (retile + add overviews) for each file, we can invoke a few commands to automate it.

cd /opt/data/sample_data/user_data/aerial
for i in `find *.tif`; do gdal_translate -CO "TILED=YES" -CO "BLOCKXSIZE=512" -CO "BLOCKYSIZE=512" -co "COMPRESS=JPEG" -co "PHOTOMETRIC=YCBCR" -co "QUALITY=85" $i ../optimized/$i; gdaladdo -r average --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config JPEG_QUALITY_OVERVIEW 85 ../optimized/$i 2 4 8 16 32; done

You should see a list of run like this.

...
Input file size is 2500, 2500
0...10...20...30...40...50...60...70...80...90...100 - done.
0...10...20...30...40...50...60...70...80...90...100 - done.
Input file size is 2500, 2500
0...10...20...30...40...50...60...70...80...90...100 - done.
0...10...20...30...40...50...60...70...80...90...100 - done.
Input file size is 2500, 2500
0...10...20...30...40...50...60...70...80...90...100 - done.
0...10...20...30...40...50...60...70...80...90...100 - done.
...

At this point, optimized datasets have been prepared, and they are ready to be served by GeoServer as an ImageMosaic.

gdalwarp

This utility warps and reprojects a dataset. The following steps provide instructions to reproject the aerial dataset (EPSG:26913 coordinate reference system) to WGS84 (EPSG:4326).

Running the command

gdalwarp

gets the list of supported parameters

Usage: gdalwarp [--help-general] [--formats]
       [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]
       [-order n | -tps | -rpc | -geoloc] [-et err_threshold]
       [-refine_gcps tolerance [minimum_gcps]]
       [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]
       [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]
       [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha
       [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]
       [-cutline datasource] [-cl layer] [-cwhere expression]
       [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]
       [-of format] [-co "NAME=VALUE"]* [-overwrite]
       srcfile* dstfile

The meaning of the main parameters is summarized below.

  • -s_srs: specifies the source coordinate reference system

  • -t_srs: specifies the target coordinate reference system

  • -te: sets georeferenced extents (expressed in target CRS) of the output

  • -tr: specifies the output resolution (expressed in target georeferenced units)

  • -ts: specifies the output size in pixels and lines.

  • -r: specifies the resampling method (one of near, bilinear, cubic, cubicspline, and lanczos)

  • -srcnodata: specifies band values to be excluded from interpolation.

  • -dstnodata: specifies nodata values on the output file.

  • -wm: specifies the amount of memory (expressed in megabytes) used by the warping API for caching.

gdalwarp - Reprojecting sample dataset to WGS84

  • Navigate to the /opt/data/sample_data/user_data/optimized folder

    cd /opt/data/sample_data/user_data/optimized
    
  • Run the gdalwarp command

    gdalwarp -t_srs "EPSG:4326" -co "TILED=YES" 13tde815295_200803_0x6000m_cl.tif 13tde815295_200803_0x6000m_cl_warped.tif
    
  • Check that reprojection has been successful by running the command

    gdalinfo 13tde815295_200803_0x6000m_cl_warped.tif
    

    image

    Part of the gdalinfo output on the warped dataset. Note the updated Coordinate System property.

Further Reading about GDAL

https://geoserver.geo-solutions.it/educational/en/raster_data/advanced_gdal/index.html

Publish the Optimized Mosaic on GeoNode

  • Activate the geonode virtual env and navigate to /opt/geonode

  • Run the updatelayers management command as follows

    ./manage_local.sh updatelayers --skip-geonode-registered  -w geonode -f boulder_bg_optimized
    
  • Verify the new dataset has been successfully created on GeoNode

Next Section: Optimizing, publishing and styling Vector data