Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add Support for GDAL.gdalsievefilter #431

Open
JoshuaBillson opened this issue Jun 17, 2024 · 1 comment
Open

Feature Request: Add Support for GDAL.gdalsievefilter #431

JoshuaBillson opened this issue Jun 17, 2024 · 1 comment

Comments

@JoshuaBillson
Copy link

Sieve filtering is a fairly standard tool for removing small raster polygons, a summary of which can be found in the GDAL Docs.

It appears that this method is already exposed by GDAL.jl, with the following method signature:

  GDALSieveFilter(GDALRasterBandH hSrcBand,
                  GDALRasterBandH hMaskBand,
                  GDALRasterBandH hDstBand,
                  int nSizeThreshold,
                  int nConnectedness,
                  char ** papszOptions,
                  GDALProgressFunc pfnProgress,
                  void * pProgressArg) -> CPLErr

  Removes small raster polygons.

  Parameters
  ––––––––––

    •  hSrcBand: the source raster band to be processed.

    •  hMaskBand: an optional mask band. All pixels in the mask band with a value other than
       zero will be considered suitable for inclusion in polygons.

    •  hDstBand: the output raster band. It may be the same as hSrcBand to update the source
       in place.

    •  nSizeThreshold: raster polygons with sizes smaller than this will be merged into their
       largest neighbour.

    •  nConnectedness: either 4 indicating that diagonal pixels are not considered directly
       adjacent for polygon membership purposes or 8 indicating they are.

    •  papszOptions: algorithm options in name=value list form. None currently supported.

    •  pfnProgress: callback for reporting algorithm progress matching the GDALProgressFunc()
       semantics. May be NULL.

    •  pProgressArg: callback argument passed to pfnProgress.

  Returns
  –––––––

  CENone on success or CEFailure if an error occurs.

Would it be possible to add a high-level interface through ArchGDAL? I don't mind opening a PR, but I'm not sure how to work with the C-level interface provided by GDAL.jl.

@evetion
Copy link
Collaborator

evetion commented Jun 24, 2024

Feel free to open a PR, you can take inspiration from other related calls like gdalwarp https://github.com/yeesian/ArchGDAL.jl/blob/master/src%2Futilities.jl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants