Changes between Initial Version and Version 2 of Ticket #6250


Ignore:
Timestamp:
Dec 1, 2015, 2:12:47 PM (8 years ago)
Author:
Mateusz Łoskot
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6250

    • Property Owner changed from warmerdam to tamas
    • Property Component defaultCSharpBindings
  • Ticket #6250 – Description

    initial v2  
    1 Ok, so I have some code here
     1Ok, so I have some C# code here
    22
    33
    44{{{
    5                         string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
    6                         var thisDir = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(codeBase).Path)) + Path.DirectorySeparatorChar;
    7                         Directory.SetCurrentDirectory(thisDir);
    8                         //start up map engine
    9                         Environment.SetEnvironmentVariable("PATH",
    10                                 string.Join(Path.PathSeparator.ToString(), new string[] {
    11                                         thisDir + @"gdal\bin",
    12                                         thisDir + @"gdal\bin\gdal\csharp",
    13                                         thisDir + @"gdal\bin\ms\csharp",
    14                                 }) + Path.PathSeparator +
    15                                 Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process), EnvironmentVariableTarget.Process);
    16                         Environment.SetEnvironmentVariable("OGR_SQLITE_CACHE", "256MB", EnvironmentVariableTarget.Process);
    17                         Environment.SetEnvironmentVariable("CPL_DEBUG", "ON", EnvironmentVariableTarget.Process);
    18                         Environment.SetEnvironmentVariable("CPL_LOG", "c:\\Temp\\log.txt", EnvironmentVariableTarget.Process);
    19                         Environment.SetEnvironmentVariable("CPL_LOG_ERRORS", "ON", EnvironmentVariableTarget.Process);
     5string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
     6var thisDir = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(codeBase).Path)) + Path.DirectorySeparatorChar;
     7Directory.SetCurrentDirectory(thisDir);
     8//start up map engine
     9Environment.SetEnvironmentVariable("PATH",
     10        string.Join(Path.PathSeparator.ToString(), new string[] {
     11                thisDir + @"gdal\bin",
     12                thisDir + @"gdal\bin\gdal\csharp",
     13                thisDir + @"gdal\bin\ms\csharp",
     14        }) + Path.PathSeparator +
     15        Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process), EnvironmentVariableTarget.Process);
     16Environment.SetEnvironmentVariable("OGR_SQLITE_CACHE", "256MB", EnvironmentVariableTarget.Process);
     17Environment.SetEnvironmentVariable("CPL_DEBUG", "ON", EnvironmentVariableTarget.Process);
     18Environment.SetEnvironmentVariable("CPL_LOG", "c:\\Temp\\log.txt", EnvironmentVariableTarget.Process);
     19Environment.SetEnvironmentVariable("CPL_LOG_ERRORS", "ON", EnvironmentVariableTarget.Process);
    2020
    21                         OSGeo.GDAL.Gdal.UseExceptions();
    22                         Ogr.RegisterAll();
     21OSGeo.GDAL.Gdal.UseExceptions();
     22Ogr.RegisterAll();
    2323
    24                         var directdb = Ogr.Open(thisDir + "poly_spatialite4.sqlite", update: 0); //open for read only
    25                         directdb.Dispose();
     24var directdb = Ogr.Open(thisDir + "poly_spatialite4.sqlite", update: 0); //open for read only
     25directdb.Dispose();
    2626}}}
    2727
     
    3333
    3434I'm also including the project I'm using to replicate this and all the files.
    35