Generate raster tiles

Converting a file or an existing dataset to a tiling dataset can be performed using the MIKE Platform SDK's TranferClient just as with any other transfer or conversion. The sample below illustrates how to convert a DFS2 file into a tiling dataset.

var filePath ="C:/data/rain.dfs2";
var schemes = "[{\"SchemeType\": \"XYZ\", \"ItemName\": \"rain\", \"SchemeId\": \"precipitation-tiles\", \"OutputType\": \"PNG\", \"AggregationMethod\": \"MEAN\", \"TileWidth\": 256, \"TileHeight\": 256, \"MinValue\": 0.0, \"MaxValue\": 12.0, \"MaxRasterWidth\": 2000, \"Colors\": ['800080', '5500ab', '2a00d5', '0000ff', '0038e1', '006fc3', '00a6a6', '00c46e', '00e237', '00ff00', '55ff00', 'aaff00', 'ffaa00', 'ffaa00', 'ff5500', 'ff0000'], \"RenderValuesOutOfRangeTransparent\": \"Below\", \"ZoomLevels\": [4,5,6,7,8,9,10,11, 12, 13, 14]}]";

var dataset = await _transferClient.CreateFileImport(projectId, filePath)
    .WithReader("Dfs2Reader")
    .WithWriter("TilingWriter", new[]
    {
        new ParameterInput
        {
            Name = "Schemes",
            Value = schemes
        }
    })
    .ExecuteAndWaitAsync();

Console.WriteLine(dataset.DatasetId);
}