How to load shapefile to spatialite using c#?
-
18-06-2021 - |
سؤال
I am trying to write a code in c-sharp to import shapefile to spatialite database.
Code written to initialize sqlite connection as follows,
SQLiteConnection conn = new SQLiteConnection(@"Data Source=" + sqLiteFile + ";Version=3;");
conn.Open();
SQLiteCommand cmd = new SQLiteCommand(@"SELECT load_extension('libspatialite-2.dll')", conn);
cmd.ExecuteNonQuery();
cmd = new SQLiteCommand("select .loadshp ShapeTest ShapeTest CP1252 23032", conn);
cmd.ExecuteNonQuery(); //Getting error here.
I think there is a syntax error. Any one with any idea?
المحلول
.loadshp is provided by the command line utilities, not by the spatialite extension. I think what you wanted to do is to use the VirtualShape virtual table:
"CREATE VIRTUAL TABLE ShapeTest USING VirtualShape(\"ShapeTest\", \"CP1252\", 23032)"
لا تنتمي إلى StackOverflow