[FWTools] Import Shape file using ogr2ogr into MySQL VS - C# / CSharp

Bilal Kilic bilal at geoinformatics.de
Mon Aug 18 05:35:35 EDT 2008


Hi all,


I develop a Win-App and the last step is to import the Shapefile
(exmple.shp) into an existing MySQL Database. At this moment i
use following C#-code and it works fine:

---------------
string appPath = @"C:\Program Files\FWTools2.2.1\bin\ogr2ogr.exe";
string appArgs = " -f MySQL MySQL:myDB,user=root,password=xxx D:\\ex.shp
-nln ex -update -append -nlt GEOMETRY";

Process ogrProcess = new Process();
ogrProcess.StartInfo.FileName = appPath;
ogrProcess.StartInfo.Arguments = appArgs;

ogrProcess.StartInfo.UseShellExecute = false;
ogrProcess.StartInfo.CreateNoWindow = true;
ogrProcess.StartInfo.RedirectStandardOutput = true;

ogrProcess.Start();
ogrProcess.WaitForExit();

string Result = ogrProcess.StandardOutput.ReadToEnd();
---------------

But I think this is not a fancywork. Now I see in the
FW-Tools Software *.dll's for developing with VS-C#.
But i don't now how I can use this. The existing
examples don't help me and Master Google say nothing about
c# and FW-Tools...

Has somebody an example for realizing this? Or a Link to
an existing examples?


TU.

King Regards...


Bilal.





More information about the FWTools mailing list