Ejemplo n.º 1
0
        /// <summary>
        /// Cell by cell op using using a RASTERIZED VECTOR for some purpose
        /// </summary>
        /// <param name="rRasters"></param>
        /// <param name="rPolygonMask"></param>
        /// <param name="vPolygonMask"></param>
        /// <param name="rOutputRasters"></param>
        public CellByCellOperator(List <Raster> rRasters, VectorRaster rPolygonMask, List <Raster> rOutputRasters = null) :
            base(rRasters, rOutputRasters)
        {
            _hasVectorPolymask     = false;
            _hasRasterizedPolymask = true;

            // Make sure we add the rasterized vector as the last item we can look up
            AddInputRaster(rPolygonMask);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is the Budget Seggregation with propError Constructor using a raster mask
        /// </summary>
        /// <param name="rInput"></param>
        /// <param name="rPropError"></param>
        /// <param name="theStats"></param>
        /// <param name="PolygonMask"></param>
        /// <param name="FieldName"></param>
        public GetChangeStats(Raster rInput, Raster rPropError, DoDStats theStats,
                              VectorRaster rPolygonMask, string FieldName) :
            base(new List <Raster> {
            rInput, rPropError
        }, rPolygonMask)
        {
            Stats    = theStats;
            SegStats = new Dictionary <string, DoDStats>();

            _rasterVectorFieldVals = rPolygonMask.FieldValues;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Pass in a rasterized vector mask
 /// </summary>
 /// <param name="otType"></param>
 /// <param name="rInputA"></param>
 /// <param name="rInputB"></param>
 /// <param name="rPolymask"></param>
 /// <param name="rOutputRaster"></param>
 public RasterMath(RasterOperators.MathOpType otType, Raster rInputA,
                   Raster rInputB, VectorRaster rPolymask, Raster rOutputRaster) :
     base(new List <Raster> {
     rInputA, rInputB
 }, rPolymask, new List <Raster> {
     rOutputRaster
 })
 {
     _type   = otType;
     _scalar = false;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Budget Seggregation Constructor with RASTERized vector mask
        /// </summary>
        /// <param name="rDod"></param>
        /// <param name="rErr"></param>
        /// <param name="theStats"></param>
        /// <param name="rPolymask"></param>
        /// <param name="vPolygonMask"></param>
        /// <param name="FieldName"></param>
        public GetDoDPropStats(Raster rDod, Raster rErr, DoDStats theStats, VectorRaster rPolymask,
                               string FieldName) :
            base(new List <Raster> {
            rDod, rErr
        }, rPolymask)
        {
            Stats      = theStats;
            SegStats   = new Dictionary <string, DoDStats>();
            _fieldname = FieldName;

            _rasterVectorFieldVals = rPolymask.FieldValues;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Rasterized Vector Budget Seggregation constructor
        /// </summary>
        /// <param name="rawDoD"></param>
        /// <param name="thrDoD"></param>
        /// <param name="thresh"></param>
        /// <param name="theStats"></param>
        /// <param name="PolygonMask"></param>
        /// <param name="FieldName"></param>
        public GetDodMinLodStats(Raster rawDoD,
                                 decimal thresh, DoDStats theStats, VectorRaster rPolymask, string FieldName) :
            base(new List <Raster> {
            rawDoD
        }, rPolymask)
        {
            Stats    = theStats;
            _thresh  = (double)thresh;
            SegStats = new Dictionary <string, DoDStats>();

            _rasterVectorFieldVals = rPolymask.FieldValues;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Multi-method Constructor (Rasterized Vector Method)
        /// </summary>
        /// <param name="rawDEM"></param>
        /// <param name="PolygonMask"></param>
        /// <param name="MaskFieldName"></param>
        /// <param name="props"></param>
        /// <param name="rOutputRaster"></param>
        public CreateErrorRaster(Raster rawDEM, VectorRaster rPolygonMask, string MaskFieldName,
                                 Dictionary <string, ErrorRasterProperties> props, Raster rOutputRaster) :
            base(new List <Raster> {
            rawDEM
        }, rPolygonMask, new List <Raster> {
            rOutputRaster
        })
        {
            _initMultiMethod(MaskFieldName, props);

            _rasterVectorFieldVals = rPolygonMask.FieldValues;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Budget Seggregation constructor using a RASTERIZED vector
        /// </summary>
        /// <param name="rInput"></param>
        /// <param name="numBins"></param>
        /// <param name="rPolymask"></param>
        /// <param name="vPolygonMask"></param>
        /// <param name="FieldName"></param>
        public BinRaster(Raster rInput, int numBins, VectorRaster rPolymask,
                         string FieldName) :
            base(new List <Raster> {
            rInput
        }, rPolymask)
        {
            SegHistograms = new Dictionary <string, Histogram>();
            _fieldname    = FieldName;
            _segNumBins   = numBins;

            _rasterVectorFieldVals = rPolymask.FieldValues;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Budget Seggregation constructor using a raster mask
        /// </summary>
        /// <param name="rInput"></param>
        /// <param name="theStats"></param>
        /// <param name="PolygonMask"></param>
        /// <param name="FieldName"></param>
        public GetChangeStats(Raster rInput, DoDStats theStats, VectorRaster rPolygonMask,
                              string FieldName) :
            base(new List <Raster> {
            rInput
        }, rPolygonMask)
        {
            // Note how we don't pass the vector into the base. We're not going to do anything
            // with the geometry of the shapefile.
            Stats    = theStats;
            SegStats = new Dictionary <string, DoDStats>();

            _rasterVectorFieldVals = rPolygonMask.FieldValues;
        }
Ejemplo n.º 9
0
        public void RasterizeTest()
        {
            Raster rTemplate        = new Raster(new FileInfo(DirHelpers.GetTestRootPath(@"VerificationProject\inputs\2005DecDEM\2005DecDEM.tif")));
            Vector vPolyMaskSimple  = new Vector(new FileInfo(DirHelpers.GetTestRootPath(@"SulphurGCDMASK\Sulphur_SimpleGCDMask.shp")));
            Vector vPolyMaskComplex = new Vector(new FileInfo(DirHelpers.GetTestRootPath(@"SulphurGCDMASK\Sulphur_ComplexGCDMask.shp")));

            using (ITempDir tmp = TempDir.Create())
            {
                VectorRaster.Rasterize(vPolyMaskComplex, new Raster(rTemplate, new FileInfo(Path.Combine(tmp.Name, "Complex.tif"))));
                VectorRaster.Rasterize(vPolyMaskSimple, new Raster(rTemplate, new FileInfo(Path.Combine(tmp.Name, "Simple.tif"))));

                Debug.WriteLine(tmp.Name);
            }
        }
Ejemplo n.º 10
0
        public void VectorRasterTest()
        {
            Raster rTemplate        = new Raster(new FileInfo(DirHelpers.GetTestRootPath(@"VerificationProject\inputs\2005DecDEM\2005DecDEM.tif")));
            Vector vPolyMaskSimple  = new Vector(new FileInfo(DirHelpers.GetTestRootPath(@"SulphurGCDMASK\Sulphur_SimpleGCDMask.shp")));
            Vector vPolyMaskComplex = new Vector(new FileInfo(DirHelpers.GetTestRootPath(@"SulphurGCDMASK\Sulphur_ComplexGCDMask.shp")));


            using (ITempDir tmp = TempDir.Create())
            {
                FileInfo fiPolyMaskSimpleCOPY  = new FileInfo(Path.Combine(tmp.Name, "Sulphur_SimpleGCDMask.shp"));
                FileInfo fiPolyMaskComplexCOPY = new FileInfo(Path.Combine(tmp.Name, "Sulphur_ComplexGCDMask.shp"));

                vPolyMaskSimple.Copy(fiPolyMaskSimpleCOPY);
                vPolyMaskComplex.Copy(fiPolyMaskComplexCOPY);

                Vector vPolyMaskSimpleCOPY  = new Vector(fiPolyMaskSimpleCOPY);
                Vector vPolyMaskComplexCOPY = new Vector(fiPolyMaskComplexCOPY);

                List <string> times = new List <string> {
                };
                var watch           = Stopwatch.StartNew();

                // Try with a numeric field
                watch.Restart();
                VectorRaster test1 = new VectorRaster(rTemplate, vPolyMaskComplexCOPY, "Category");
                string       time1 = string.Format("MyRasterizationTest1, , {0}.{1}", watch.Elapsed.Seconds, watch.Elapsed.Milliseconds);

                // Try the same shape file with a string field
                watch.Restart();
                VectorRaster test2 = new VectorRaster(rTemplate, vPolyMaskComplexCOPY, "Desc_");
                string       time2 = string.Format("MyRasterizationTest1, , {0}.{1}", watch.Elapsed.Seconds, watch.Elapsed.Milliseconds);

                // Now try a simpler shapefule with a string field
                watch.Restart();
                VectorRaster test3 = new VectorRaster(rTemplate, vPolyMaskSimpleCOPY, "Method");
                string       time3 = string.Format("MyRasterizationTest1, , {0}.{1}", watch.Elapsed.Seconds, watch.Elapsed.Milliseconds);

                Debug.WriteLine("");
                Debug.WriteLine(time1);
                Debug.WriteLine(time2);
                Debug.WriteLine(time3);
            }
        }