Example #1
0
        public void Export(string spatialiteDatabasePath, ILayer layer)
        {
            SpatialLiteDB db   = new SpatialLiteDB(spatialiteDatabasePath);
            int           srid = this.FindSRID(layer, db);

            this.Export(spatialiteDatabasePath, srid, layer);
        }
Example #2
0
        private void WriteTable(SpatialLiteDB database, int srid, DataTable table, IFeatureClass fc)
        {
            string geometryColumn = "geom";
            string tableName      = table.TableName.Replace(' ', '_');

            string s = CreateTableDDL(table);

            database.CreateTable(s);


            database.InsertEvent += new SpatialLiteDB.InsertEventHandler(database_InsertEvent);

            database.Insert(table, this.FieldNameMap);

            try
            {
                this.OnStatusMessage(string.Format("Adding geometry column ({0}) with SRID: {1} to table: {2}",
                                                   geometryColumn,
                                                   srid,
                                                   tableName));

                database.AddGeometryColumn(
                    tableName,
                    geometryColumn,
                    srid,
                    Constants.SpatialiteGeometryType[fc.ShapeType]);

                this.OnStatusMessage(string.Format("Geometry column ({0}) with SRID: {1} successfully added to table: {2}!",
                                                   geometryColumn,
                                                   srid,
                                                   tableName));

                this.OnStatusMessage(string.Format("Updating geometry column ({0}) in table: {1}",
                                                   geometryColumn,
                                                   tableName));


                this.OnGeometryExportProgress(0, 1);

                database.UpdateGeometryColumnFromWKB(
                    tableName,
                    geometryColumn,
                    srid,
                    "wkb");

                this.OnGeometryExportProgress(1, 1);

                this.OnStatusMessage(string.Format("Sucessfully update geometry column ({0}) in table: {1}!",
                                                   geometryColumn,
                                                   tableName));
            }
            catch (Exception)
            {
                throw;
            }


            database.InsertEvent -= database_InsertEvent;
        }
Example #3
0
        public int FindSRID(ISpatialReference sr, SpatialLiteDB database, string authname)
        {
            int srid = -1;

            srid = sr.FactoryCode;

            // string s = Umbriel.GIS.SpatialReferenceDotOrg.GetSpatialReference(sr.FactoryCode, Umbriel.GIS.Format.Proj4);

            srid = database.FindSRID(srid, authname);

            return(srid);
        }
Example #4
0
 public int FindSRID(ISpatialReference sr, SpatialLiteDB database)
 {
     return(FindSRID(sr, database, "esri"));
 }
Example #5
0
        public int FindSRID(ILayer layer, SpatialLiteDB database)
        {
            IGeoDataset g = (IGeoDataset)layer;

            return(this.FindSRID(g.SpatialReference, database));
        }