static void Main(string[] args) { try { Console.WriteLine("Working directory: " + Directory.GetCurrentDirectory()); Console.WriteLine("Trying to configure all twice"); GdalBase.ConfigureAll(); GdalBase.ConfigureAll(); Console.WriteLine("GDAL configured"); Console.WriteLine(string.Join('\n', "GDAL Version: " + Gdal.VersionInfo("RELEASE_NAME"), "GDAL INFO: " + Gdal.VersionInfo(""))); var spatialReference = new SpatialReference(null); spatialReference.SetWellKnownGeogCS("wgs84"); var dataset = OSGeo.OGR.Ogr.Open("test222.shp", 0); var layer = dataset.GetLayerByIndex(0); var feature = layer.GetNextFeature(); var field = feature.GetFieldAsString("overflade"); Console.WriteLine("test222 overflade attribute value"); Console.WriteLine("expected:" + "Befæstet"); Console.WriteLine("actual:" + field); } catch (Exception ex) { Console.WriteLine(ex); } }
private void button1_Click(object sender, EventArgs e) { Gdal.AllRegister(); //регистрация драйверов для доступа к растровым данным Ogr.RegisterAll(); //регистрирует драйвера доступа в векторным данным label1.Text = "Версия библиотеки:\n" + Gdal.VersionInfo(""); progressBar1.Minimum = 0; orgImg = new OriganalImage(filename, progressBar1); }
static void Main(string[] args) { try { Console.WriteLine($"Working directory: {Directory.GetCurrentDirectory()}"); Console.WriteLine("Trying to configure all twice"); GdalBase.ConfigureAll(); GdalBase.ConfigureAll(); Console.WriteLine("GDAL configured"); var version = Assembly.GetAssembly(typeof(MaxRev.Gdal.Core.GdalBase)) .GetCustomAttribute <AssemblyInformationalVersionAttribute>() .InformationalVersion; Console.WriteLine($"Package version: {version}"); Console.WriteLine(string.Join('\n', $"GDAL Version: {Gdal.VersionInfo("RELEASE_NAME")}", $"GDAL INFO: {Gdal.VersionInfo("")}")); var spatialReference = new SpatialReference(null); spatialReference.SetWellKnownGeogCS("wgs84"); // list of common drivers var drivers = new[] { "hdf4", "hdf5", "gtiff", "aaigrid", "adrg", "airsar", "arg", "blx", "bmp", "bsb", "cals", "ceos", "coasp", "cosar", "ctg", "dimap", "dted", "e00grid", "elas", "ers", "fit", "gff", "gxf", "hf2", "idrisi", "ignfheightasciigrid", "ilwis", "ingr", "iris", "jaxapalsar", "jdem", "kmlsuperoverlay", "l1b", "leveller", "map", "mrf", "msgn", "ngsgeoid", "nitf", "pds", "prf", "r", "rmf", "rs2", "safe", "saga", "sdts", "sentinel2", "sgi", "sigdem", "srtmhgt", "terragen", "til", "tsx", "usgsdem", "xpm", "xyz", "zmap", "rik", "ozi", "grib", "rasterlite", "mbtiles", "pdf", "aeronavfaa", "arcgen", "bna", "cad", "csv", "dgn", "dxf", "edigeo", "geoconcept", "georss", "gml", "gpsbabel", "gpx", "htf", "jml", "mvt", "openair", "openfilegdb", "pgdump", "rec", "s57", "segukooa", "segy", "selafin", "ESRI Shapefile", "sua", "svg", "sxf", "tiger", "vdv", "wasp", "xplane", "idrisi", "pds", "sdts", "gpkg", "vfk", "osm", "PostgreSQL" }; foreach (var driver in drivers) { var driverByName = Gdal.GetDriverByName(driver); Console.WriteLine( driverByName != default ? $"{driver} loaded successfully" : $"Failed to load {driver}"); } } catch (Exception ex) { Console.WriteLine(ex); } }
public static void WriteVersionInfoLog() { string logString = ""; logString += MainSeparatorString; logString += Environment.NewLine; logString += "[버전 정보]"; logString += Environment.NewLine; logString += string.Format("JIMap-Trans : {0}", Application.ProductVersion); logString += Environment.NewLine; logString += string.Format("GDAL : {0}", Gdal.VersionInfo("RELEASE_NAME")); logString += Environment.NewLine; logString += MainSeparatorString; WriteInfoLog(logString); }
/// <summary> /// Collect the versions of the dependent libraries /// </summary> /// <returns></returns> private string CollectVersionInfo() { Gdal.AllRegister(); StringBuilder s = new StringBuilder(); s.AppendLine("MapServer version " + mapscript.MS_VERSION); s.AppendLine(Gdal.VersionInfo("GDAL_RELEASE_NAME")); s.AppendLine("proj " + Marshal.PtrToStringAnsi(pj_get_release())); s.AppendLine("geos " + Marshal.PtrToStringAnsi(GEOSversion())); s.AppendLine("zlib " + Marshal.PtrToStringAnsi(zlibVersion())); s.AppendLine(Marshal.PtrToStringAnsi(curl_version())); return(s.ToString()); }
public GdalInfo GetGdalInfo() { var info = new GdalInfo(); info.ReleaseName = Gdal.VersionInfo("RELEASE_NAME"); info.VersionNumber = Gdal.VersionInfo("VERSION_NUM"); info.BuildInfo = Gdal.VersionInfo("BUILD_INFO"); var drivers = new List <string>(); for (var i = 0; i < Ogr.GetDriverCount(); i++) { drivers.Add(Ogr.GetDriver(i).GetName()); } info.Drivers = drivers; return(info); }
static void Main(string[] args) { try { Console.WriteLine($"Working directory: {Directory.GetCurrentDirectory()}"); Console.WriteLine("Trying to configure all twice"); GdalBase.ConfigureAll(); GdalBase.ConfigureAll(); Console.WriteLine("GDAL configured"); var version = Assembly.GetAssembly(typeof(MaxRev.Gdal.Core.GdalBase)) .GetCustomAttribute <AssemblyInformationalVersionAttribute>() .InformationalVersion; Console.WriteLine($"Package version: {version}"); Console.WriteLine(string.Join('\n', $"GDAL Version: {Gdal.VersionInfo("RELEASE_NAME")}", $"GDAL INFO: {Gdal.VersionInfo("")}")); var spatialReference = new SpatialReference(null); spatialReference.SetWellKnownGeogCS("wgs84"); for (int driverIndex = 0; driverIndex < Gdal.GetDriverCount(); driverIndex++) { var driverByName = Gdal.GetDriver(driverIndex); Console.WriteLine( driverByName != default ? $"{driverByName.ShortName} loaded successfully" : $"Failed to load {driverByName.ShortName}"); } // retrieve list of drivers for tests Console.WriteLine("Test string:"); var driverList = string.Join(',', Enumerable.Range(0, Gdal.GetDriverCount()) .Select(i => Gdal.GetDriver(i).ShortName) .OrderBy(x => x) .Select(x => $"\"{x}\"")); Console.WriteLine(driverList); Console.WriteLine("Drivers:" + Gdal.GetDriverCount()); } catch (Exception ex) { Console.WriteLine(ex); } }
public static void GetGdalInfo() { logger.Trace(Gdal.VersionInfo("RELEASE_NAME")); logger.Trace(Gdal.VersionInfo("VERSION_NUM")); logger.Trace(Gdal.VersionInfo("BUILD_INFO")); var drivers = new List <string>(); for (var i = 0; i < Ogr.GetDriverCount(); i++) { drivers.Add(Ogr.GetDriver(i).GetName()); } logger.Trace($"OGR Drivers list: {string.Join(",", drivers)}."); drivers = new List <string>(); for (var i = 0; i < Gdal.GetDriverCount(); i++) { drivers.Add(Gdal.GetDriver(i).GetDescription()); } logger.Trace($"GDAL Drivers list: {string.Join(",", drivers)}."); }
static void Main(string[] args) { Console.WriteLine("Testing GDAL C# Bindings"); Gdal.UseExceptions(); Console.WriteLine($"Gdal version {Gdal.VersionInfo(null)}"); }