ImportShapefile() public static method

Imports the provided shapefile into a sqlite database using the VirtualShape extension
public static ImportShapefile ( DbConnection conn, IDataClient client, string filename, string tableName, int srid ) : bool
conn System.Data.Common.DbConnection
client IDataClient
filename string
tableName string
srid int
return bool
        /// <summary>
        /// Helper function for testing the shapefile importer
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public static bool OpenShapefile(string filename, string tableName)
        {
            string databaseFileName = Path.Combine(Path.GetDirectoryName(filename), "shape.dat");
            var    client           = new SqliteDataClient(databaseFileName);

            using (DbConnection conn = client.GetConnection())
            {
                return(ShapefileHelper.ImportShapefile(conn, client, filename, tableName, -1));
            }
        }
        /// <summary>
        /// Imports a shapefile into the database.  Do not use this to load census shapefiles.
        /// </summary>
        /// <param name="filename">The path of the file to import</param>
        /// <param name="DbClient">The database to load the file into</param>
        /// <returns>True on success, False on failure</returns>
        public static bool LoadShapefile(string filename, string tableName, IDataClient DbClient, out ICoordinateSystem CRS)
        {
            CRS = null;
            if ((string.IsNullOrEmpty(filename)) || (!File.Exists(filename)))
            {
                _log.ErrorFormat("LoadShapefile failed: filename was empty or file does not exist {0}", filename);
                return(false);
            }

            try
            {
                string fileWithoutExt = Path.GetFileNameWithoutExtension(filename);
                string prjFileName    = Path.Combine(Path.GetDirectoryName(filename), fileWithoutExt) + ".prj";

                if (ShapefileHelper.IsForbiddenShapefileName(fileWithoutExt))
                {
                    _log.ErrorFormat("LoadShapefile failed: {0} conflicts with a reserved census shapefile name, please rename", fileWithoutExt);
                    return(false);
                }

                if (File.Exists(prjFileName))
                {
                    CRS = Utilities.GetCoordinateSystemByWKTFile(prjFileName);
                }
                else
                {
                    _log.ErrorFormat("LoadShapefile failed: shapefile {0} is missing a .prj file.", filename);
                    return(false);
                }

                using (DbConnection conn = DbClient.GetConnection())
                {
                    if (!ShapefileHelper.ImportShapefile(conn, DbClient, filename, tableName, (int)CRS.AuthorityCode))
                    {
                        _log.Error("LoadShapefile failed: unable to import shapefile.");
                        return(false);
                    }
                }

                _log.Debug("Shapefile imported successfully...");
                return(true);
            }
            catch (Exception ex)
            {
                _log.Error("Error while importing shapefile", ex);
            }

            return(false);
        }