Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,GaseId,Year,VerticalSlice,Name")] GeoTiffFile geoTiffFile)
        {
            if (id != geoTiffFile.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(geoTiffFile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GeoTiffFileExists(geoTiffFile.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GaseId"] = new SelectList(_context.Gase.Where(g => g.Id != 4), "Id", "Formula", geoTiffFile.GaseId); //not show NO2
            return(View(geoTiffFile));
        }
Esempio n. 2
0
        private int HandleCommand(Lsc2GeoTiffParams par)
        {
            try
            {
                var tiff = new GeoTiffFile();

                tiff.ImageDescription      = par.Desc ?? "";
                tiff.Area_of_use           = par.Area ?? "";
                tiff.Email                 = par.Email ?? "";
                tiff.Dimensions            = par.Dim == 0 ? 3 : par.Dim;
                tiff.TileSize              = par.TileSize;
                tiff.TiffOutput            = (GeoTiffFile.TiffOutputType)par.Type;
                tiff.Epsg2d.CodeString     = par.Epsg2d;
                tiff.EpsgSource.CodeString = par.EpsgSource;
                tiff.EpsgTarget.CodeString = par.EpsgTarget;
                tiff.NRows                 = par.Rows;
                tiff.NColumns              = par.Cols;
                tiff.LowerLeftLatitude     = (double)par.LowerLeftLatitude;
                tiff.LowerLeftLongitude    = (double)par.LowerLeftLongitude;
                tiff.DeltaLatitude         = (double)par.DeltaLatitude;
                tiff.DeltaLongitude        = (double)par.DeltaLongitude;
                tiff.CommonPoints.Agl      = par.Agl;

                if (!tiff.ReadSourceFromFile(par.InputSource.FullName))
                {
                    Console.WriteLine($"Could not read {par.InputSource.Name}.");
                    return(-1);
                }
                if (!tiff.ReadTargetFromFile(par.InputTarget.FullName))
                {
                    Console.WriteLine($"Could not read {par.InputTarget.Name}.");
                    return(-1);
                }
                tiff.CleanNullPoints();
                if (!tiff.PopulatedGrid(par.C0, par.Cl, par.Sn))
                {
                    Console.WriteLine($"Gridding failed.");
                    return(-1);
                }
                if (!tiff.GenerateGridFile(par.Output.FullName))
                {
                    Console.WriteLine($"Generation of tiff file {par.Output.Name} failed.");
                    return(-1);
                }
                return(0);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                return(-1);

                throw ex;
            }
        }
Esempio n. 3
0
        private int HandleCommand(Ct2Gtx2GeoTiffParams par)
        {
            try
            {
                var tiff = new GeoTiffFile();

                tiff.OutputFileName   = par.Output.FullName;
                tiff.Grid_name        = par.GridName;
                tiff.ImageDescription = par.Desc ?? "";
                tiff.Area_of_use      = par.Area ?? "";
                tiff.Email            = par.Email ?? "";
                tiff.TileSize         = par.TileSize;
                tiff.Dimensions       = (par.Dim == 0) ?
                                        ((par.Ct2 != null ? 2 : 0) + (par.Gtx != null ? 1 : 0))
                    : par.Dim;
                tiff.Epsg2d.CodeString     = par.Epsg2d;
                tiff.EpsgSource.CodeString = par.EpsgSource;
                tiff.EpsgTarget.CodeString = par.EpsgTarget;
                tiff.TiffOutput            = (GeoTiffFile.TiffOutputType)par.Type;

                if (par.Ct2 != null && !tiff.Ct2.ReadCt2(par.Ct2.FullName))
                {
                    Console.WriteLine($"Cound not read the ct2 file {par.Ct2.Name}.");
                    return(-1);
                }
                if (par.Gtx != null && !tiff.Gtx.ReadGtx(par.Gtx.FullName))
                {
                    Console.WriteLine($"Cound not read the gtx file {par.Gtx.Name}.");
                    return(-1);
                }
                if (!tiff.GenerateGridFile(par.Output.FullName))
                {
                    Console.WriteLine($"Feil i generering av tiff-fil {par.Output.Name}.");
                    return(-1);
                }
                return(0);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                return(-1);

                throw ex;
            }
        }
Esempio n. 4
0
        private int HandleCommand(Gri2GeoTiffParams par)
        {
            try
            {
                var inputE = par.InputE;
                var inputN = par.InputN;
                var inputU = par.InputU;

                string inputEName = inputE != null ? inputE.FullName : "";
                string inputNName = inputN != null ? inputN.FullName : "";
                string inputUName = inputU != null ? inputU.FullName : "";

                var tiff = new GeoTiffFile(inputEName, inputNName, inputUName);

                tiff.Grid_name             = par.GridName;
                tiff.ImageDescription      = par.Desc ?? "";
                tiff.Area_of_use           = par.Area ?? "";
                tiff.Email                 = par.Email ?? "";
                tiff.TileSize              = par.TileSize;
                tiff.Epsg2d.CodeString     = par.Epsg2d;
                tiff.Epsg3d.CodeString     = par.Epsg3d;
                tiff.EpsgTarget.CodeString = par.EpsgTarget;
                tiff.Dimensions            = par.Dim;
                tiff.TiffOutput            = (GeoTiffFile.TiffOutputType)par.Type;

                if (!tiff.ReadGriFiles())
                {
                    Console.WriteLine($"Could not read gri files.");
                    return(-1);
                }
                if (!tiff.GenerateGridFile(par.Output.FullName))
                {
                    Console.WriteLine($"Generation of tiff file {par.Output.Name} failed.");
                    return(-1);
                }
                return(0);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                return(-1);

                throw ex;
            }
        }
Esempio n. 5
0
        private int HandleCommand(Gtx2GeoTiffParams parameters)
        {
            try
            {
                var tiff = new GeoTiffFile();

                tiff.Grid_name             = parameters.GridName;
                tiff.ImageDescription      = parameters.Desc ?? "";
                tiff.Area_of_use           = parameters.Area ?? "";
                tiff.Email                 = parameters.Email ?? "";
                tiff.TileSize              = parameters.TileSize;
                tiff.Dimensions            = 1;
                tiff.Epsg2d.CodeString     = parameters.Epsg2d;
                tiff.Epsg3d.CodeString     = parameters.Epsg3d;
                tiff.EpsgTarget.CodeString = parameters.EpsgTarget;
                tiff.TiffOutput            = (GeoTiffFile.TiffOutputType)parameters.Type;

                if (!tiff.Gtx.ReadGtx(parameters.Input.FullName))
                {
                    Console.WriteLine($"Cound not read the gtx file {parameters.Input.Name}.");
                    return(-1);
                }
                if (!tiff.GenerateGridFile(parameters.Output.FullName))
                {
                    Console.WriteLine($"Generation of tiff file {parameters.Output.Name} failed.");
                    return(-1);
                }
                return(0);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                return(-1);

                throw ex;
            }
        }