-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
35 lines (28 loc) · 1.43 KB
/
Program.cs
File metadata and controls
35 lines (28 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine("===========================TESTING GEOCONSEQUENCES NATIVE LIBRARY===========================");
TestImport.InitializeGDAL();
Console.WriteLine("===========================READING FROM THE NSI=============================================");
TestImport.ReadNSI(-122.48, 37.76, -122.479, 37.759, 0);
Console.WriteLine("===========================READING FROM THE NSI AND WRITING TO SHAPEFILE====================");
IntPtr path = Marshal.StringToHGlobalAnsi(@"C:\repos\consequences\AOTTest\generated");
IntPtr driver = Marshal.StringToHGlobalAnsi("ESRI Shapefile");
int projection = 3310;
IntPtr x = Marshal.StringToHGlobalAnsi("x");
IntPtr y = Marshal.StringToHGlobalAnsi("y");
TestImport.WriteNSIToShapefile(path, driver, projection, x, y, -122.48, 37.76, -122.479, 37.759);
}
}
public class TestImport
{
[DllImport("GeoConsequences.dll")]
public static extern int ReadNSI(double ulX, double ulY, double lrX, double lrY, int actionIndex);
[DllImport("GeoConsequences.dll")]
public static extern int InitializeGDAL();
[DllImport("GeoConsequences.dll")]
public static extern int WriteNSIToShapefile(IntPtr outputPath, IntPtr driverName, int projection, IntPtr xField, IntPtr yField, double ulX, double ulY, double lrX, double lrY);
}