Пример #1
0
        public static CPLErr ReprojectImage(Dataset src_ds, Dataset dst_ds, string src_wkt, string dst_wkt, ResampleAlg eResampleAlg, double WarpMemoryLimit, double maxerror, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            CPLErr ret = (CPLErr)GdalPINVOKE.ReprojectImage(Dataset.getCPtr(src_ds), Dataset.getCPtr(dst_ds), src_wkt, dst_wkt, (int)eResampleAlg, WarpMemoryLimit, maxerror, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #2
0
        public static int ComputeMedianCutPCT(Band red, Band green, Band blue, int num_colors, ColorTable colors, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.ComputeMedianCutPCT(Band.getCPtr(red), Band.getCPtr(green), Band.getCPtr(blue), num_colors, ColorTable.getCPtr(colors), callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #3
0
        public static int DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.DitherRGB2PCT(Band.getCPtr(red), Band.getCPtr(green), Band.getCPtr(blue), Band.getCPtr(target), ColorTable.getCPtr(colors), callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #4
0
        public static int ContourGenerate(Band srcBand, double contourInterval, double contourBase, int fixedLevelCount, double[] fixedLevels, int useNoData, double noDataValue, OSGeo.OGR.Layer dstLayer, int idField, int elevField, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.ContourGenerate(Band.getCPtr(srcBand), contourInterval, contourBase, fixedLevelCount, fixedLevels, useNoData, noDataValue, OSGeo.OGR.Layer.getCPtr(dstLayer), idField, elevField, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #5
0
        public Dataset CreateCopy(string utf8_path, Dataset src, int strict, string[] options, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            IntPtr  cPtr = GdalPINVOKE.Driver_CreateCopy(swigCPtr, utf8_path, Dataset.getCPtr(src), strict, (options != null)? new GdalPINVOKE.StringListMarshal(options)._ar : null, callback, callback_data);
            Dataset ret  = (cPtr == IntPtr.Zero) ? null : new Dataset(cPtr, true, ThisOwn_true());

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #6
0
        public static int Polygonize(Band srcBand, Band maskBand, OSGeo.OGR.Layer outLayer, int iPixValField, string[] options, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.Polygonize(Band.getCPtr(srcBand), Band.getCPtr(maskBand), OSGeo.OGR.Layer.getCPtr(outLayer), iPixValField, (options != null)? new GdalPINVOKE.StringListMarshal(options)._ar : null, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #7
0
        public int BuildOverviews(string resampling, int overviewlist, IntPtr pOverviews, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.Dataset_BuildOverviews(swigCPtr, resampling, overviewlist, pOverviews, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #8
0
        public CPLErr GetDefaultHistogram(out double min_ret, out double max_ret, out int buckets_ret, out int[] ppanHistogram, int force, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            CPLErr ret = (CPLErr)GdalPINVOKE.Band_GetDefaultHistogram(swigCPtr, out min_ret, out max_ret, out buckets_ret, out ppanHistogram, force, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #9
0
        public static int SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness, string[] options, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.SieveFilter(Band.getCPtr(srcBand), Band.getCPtr(maskBand), Band.getCPtr(dstBand), threshold, connectedness, (options != null)? new GdalPINVOKE.StringListMarshal(options)._ar : null, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #10
0
        public CPLErr ComputeStatistics(bool approx_ok, out double min, out double max, out double mean, out double stddev, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            CPLErr ret = (CPLErr)GdalPINVOKE.Band_ComputeStatistics(swigCPtr, approx_ok, out min, out max, out mean, out stddev, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #11
0
        public CPLErr GetHistogram(double min, double max, int buckets, int[] panHistogram, int include_out_of_range, int approx_ok, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            CPLErr ret = (CPLErr)GdalPINVOKE.Band_GetHistogram(swigCPtr, min, max, buckets, panHistogram, include_out_of_range, approx_ok, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #12
0
 public static bool GdalWarp(string srcPath, string dstPath, string[] options, Gdal.GDALProgressFuncDelegate callback = null)
 {
     GdalConfiguration.ConfigureGdal();
     using (Dataset inputDataset = Gdal.Open(srcPath, Access.GA_ReadOnly))
     {
         IntPtr[] ptr      = { Dataset.getCPtr(inputDataset).Handle };
         GCHandle gcHandle = GCHandle.Alloc(ptr, GCHandleType.Pinned);
         Dataset  result   = null;
         try
         {
             SWIGTYPE_p_p_GDALDatasetShadow dss = new SWIGTYPE_p_p_GDALDatasetShadow(gcHandle.AddrOfPinnedObject(), false, null);
             result = Gdal.wrapper_GDALWarpDestName(dstPath, 1, dss, new GDALWarpAppOptions(options), callback, null);
         }
         catch (Exception) { return(false); }
         finally
         {
             gcHandle.Free();
             result.Dispose();
         }
     }
     return(true);
 }
Пример #13
0
        public static bool GdalTranslate(string srcPath, string dstPath, string[] options, Gdal.GDALProgressFuncDelegate callback = null)
        {
            Dataset result = null;

            using (Dataset inputDataset = Gdal.Open(srcPath, Access.GA_ReadOnly))
            {
                try
                {
                    result = Gdal.wrapper_GDALTranslate(dstPath, inputDataset, new GDALTranslateOptions(options), callback, null);
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.ToString());
                    return(false);
                }
                finally
                {
                    result.Dispose();
                }
                return(true);
            }
        }
Пример #14
0
        public static void SubsetImage2(string srcPath, string dstPath, Point start, Point end, Gdal.GDALProgressFuncDelegate callback = null)
        {
            string subsetOptions = $"-of GTiff -projwin {start.X} {start.Y} {end.X} {end.Y}";

            string[] options = subsetOptions.Split(' ');
            GdalTranslate(srcPath, dstPath, options, callback);
        }
Пример #15
0
        public static int ComputeProximity(Band srcBand, Band proximityBand, string[] options, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.ComputeProximity(Band.getCPtr(srcBand), Band.getCPtr(proximityBand), (options != null)? new GdalPINVOKE.StringListMarshal(options)._ar : null, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #16
0
        public static int RegenerateOverviews(Band srcBand, int overviewBandCount, SWIGTYPE_p_p_GDALRasterBandShadow overviewBands, string resampling, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.RegenerateOverviews(Band.getCPtr(srcBand), overviewBandCount, SWIGTYPE_p_p_GDALRasterBandShadow.getCPtr(overviewBands), resampling, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #17
0
        public static int RasterizeLayer(Dataset dataset, int bands, SWIGTYPE_p_int band_list, OSGeo.OGR.Layer layer, SWIGTYPE_p_void pfnTransformer, SWIGTYPE_p_void pTransformArg, int burn_values, SWIGTYPE_p_double burn_values_list, string[] options, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.RasterizeLayer(Dataset.getCPtr(dataset), bands, SWIGTYPE_p_int.getCPtr(band_list), OSGeo.OGR.Layer.getCPtr(layer), SWIGTYPE_p_void.getCPtr(pfnTransformer), SWIGTYPE_p_void.getCPtr(pTransformArg), burn_values, SWIGTYPE_p_double.getCPtr(burn_values_list), (options != null)? new GdalPINVOKE.StringListMarshal(options)._ar : null, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #18
0
        public static int RegenerateOverview(Band srcBand, Band overviewBand, string resampling, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.RegenerateOverview(Band.getCPtr(srcBand), Band.getCPtr(overviewBand), resampling, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #19
0
        public static int FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, string[] options, Gdal.GDALProgressFuncDelegate callback, string callback_data)
        {
            int ret = GdalPINVOKE.FillNodata(Band.getCPtr(targetBand), Band.getCPtr(maskBand), maxSearchDist, smoothingIterations, (options != null)? new GdalPINVOKE.StringListMarshal(options)._ar : null, callback, callback_data);

            if (GdalPINVOKE.SWIGPendingException.Pending)
            {
                throw GdalPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #20
0
        private bool GdalBuildVrt(string[] inputFilesPaths, string outputFilePath, string[] options, Gdal.GDALProgressFuncDelegate callback)
        {
            try
            {
                using Dataset result = Gdal.wrapper_GDALBuildVRT_names(outputFilePath, inputFilesPaths, new GDALBuildVRTOptions(options), callback, null);
            }
            catch (Exception exception)
            {
                _outputHelper.WriteLine(exception.Message);

                return(false);
            }

            return(true);
        }