Framework project: Digital Elevation Models (DEMs)

Tile CopDEM 90 m from AWS

This post is an instruction for tiling the Copernicus DEM (CopDEM) 90 m version to predefined projected tiling system. The core process used is gdalwarp automatically iterated from within Karttur’s GeoImagine Framework to produce DEM tiles for the predefined projection system ease2n (EASE 2 grid North).

Introduction

The previous covers how to download and organise the AWS version of CopDEM 90 m. If you followed the instructions you should now have a virtual layer representing CopDEM at 90 m spatial resolution for the whole Earth. The virtual mosaic is composed of 26470 individual tiles. In this post you will use the Framework to reproject the CopDEM into the predefined tiles of the projection system ease2n.

Prerequisits

You must have installed Karttur’s GeoImagine Framework. You must also have defined and created the Framework projection system for ease2n (EPSG:6931, EASE GRID 2 North). If you did not yet create the projection system, its default tiling system and a user with access to the projection system, you need to follow the instructions in the blog blog and do that before continuing.

Tiling and reprojection

The Framework process TileAncillaryRegion expects a regional dataset belonging to the system ancillary as input. ancillary data is almost always in geographic coordinates (EPSG:4326) whereas all other systems are projected. The user (userid), project (projectid) and tract (tractid) must be defined using the projection system (system) also defined in json tag userproject:

{
  "userproject": {
    "userid": "karttur",
    "projectid": "karttur-northlandease2n",
    "tractid": "karttur-northlandease2n",
    "siteid": "*",
    "plotid": "*",
    "system": "ease2n"
  },

The tiles in the projection system (ease2n) covering the tract (karttur-northlandease2n) are already defined in the postgres database. To check it out, start the database manager (e.g. TablePlus) and execute the following query:

SELECT * FROM regions.tracts WHERE tractid = 'karttur-northlandease2n';

The parentid in the example above is northlandease2n. The parent of any tract is always a default region. You can now ask the database which tiles in the projection system ease2n that are covered by the default region northlandease2n:

SELECT * FROM ease2n.regions WHERE regionid='northlandease2n';

This should return 104 tiles.

When you run the json command file 0180_TileAncillaryRegion_aws-CopDem-90m.json, the Framework will automatically find the 104 tiles linked to the tract karttur-northlandease2n. For each tile the corners are used for defining a gdalwarp operation. By default the process generates a shell script (parameters asscript is by default set to true). For the example above, the first lines of the shell script looks like this:

xyz

Setting the parameter asscript to false will cause the process to execute the gdalwarp operations on the fly instead.

To loop over and generate all 104 tiles covering the land mass of the northern hemisphere at 90 m spatial resolution takes time.

Next step

Many DEM related processes are done using neighbourhoods or regions (e.g. basins). If such processes are done using wall to wall fitted data, edge effects will cause errors. To overcome that Karttur’s GeoImagine Framework can use spatially expanded tiles by using virtual. The next post covers the processing for creating virtual tiles for the 104 CopDEM tiles created in this post.