gdal icon indicating copy to clipboard operation
gdal copied to clipboard

Mixed raster/vector pipelines

Open dbaston opened this issue 6 months ago • 3 comments

Feature description

The new CLI has a number of algorithms that convert between raster and vector:

Vector in, raster out

  • grid
  • rasterize

Raster in, vector out

  • contour
  • footprint
  • pixel_info (sort of)
  • polygonize

Currently these algorithms cannot participate in pipelines, which must be exclusively raster or vector. But is possible to imagine this being more general, i.e.

gdal pipeline read in.tif !
    footprint !
    buffer 20 !
    write covered_area.shp

Are there any major barriers to generalizing the pipeline logic such that pipelines can involve raster and vector processing steps? This could allow some commands such as gdal raster footprint to be simplified, as they would no longer need their own arguments for densification, buffering, convex hull, etc.

Additional context

No response

dbaston avatar Jun 10 '25 22:06 dbaston

This feels fun!

jratike80 avatar Jun 10 '25 23:06 jratike80

That's an interesting proposal and that idea also occurred to me, given that the general mechanics for dealing with raster and vector pipelines is very similar and the code almost identical. One difficulty with generalized pipelines though is that there are raster and vector steps which share the same names "input", "output", "edit", "clip", etc. but not the same implementation. So the logic in GDAL[Raster|Vector]PipelineAlgorithm::ParseCommandLineArguments() that instantiates the chain of steps should be made smarter to ask each step for the nature of its input and output to be able to instantiate the appropriate one.

rouault avatar Jun 11 '25 15:06 rouault

implemented in https://github.com/OSGeo/gdal/pull/12581

rouault avatar Jun 16 '25 22:06 rouault