Advertisement
lightxx

GDAL

Oct 16th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2. using OSGeo.GDAL;
  3.  
  4. namespace GDALBug {
  5.     class Program {
  6.         static void Main(string[] args) {
  7.             GdalConfiguration.ConfigureGdal();
  8.             try {
  9.                 using (var sourceDataSet = Gdal.Open(args[0], Access.GA_ReadOnly)) {
  10.                     using (var driver = Gdal.GetDriverByName("GTiff")) {
  11.                         using (driver.CreateCopy(args[1], sourceDataSet, 0, new string[] { }, null, string.Empty)) {
  12.                         }
  13.                     }
  14.                 }
  15.             }
  16.             catch (Exception) {
  17.                 // heap exceptions cannot be caught from managed code ...
  18.             }
  19.            
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement