Beispiel #1
0
        /// <summary>
        /// Updates an existing coordinate system in the database
        /// </summary>
        /// <param name="cs"></param>
        /// <param name="oldName"></param>
        /// <returns></returns>
        public bool UpdateProjection(CoordinateSystemDefinition cs, string oldName)
        {
            using (var conn = CreateSqliteConnection())
            {
                conn.Open();
                using (IUpdate update = (IUpdate)conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Update))
                {
                    update.SetFeatureClassName("Projections");
                    update.PropertyValues.Add(new OSGeo.FDO.Commands.PropertyValue("Name", new StringValue(cs.Name)));
                    update.PropertyValues.Add(new OSGeo.FDO.Commands.PropertyValue("Description", new StringValue(cs.Description)));
                    update.PropertyValues.Add(new OSGeo.FDO.Commands.PropertyValue("WKT", new StringValue(cs.Wkt)));

                    update.SetFilter("Name = '" + oldName + "'");

                    if (update.Execute() == 1)
                    {
                        LoggingService.InfoFormatted("Coordinate System {0} updated in database", oldName);
                        return(true);
                    }
                }
                conn.Close();
            }
            return(false);
        }