pdal::Stage

pdal::Stage is the base class of pdal::Filter, pdal::Reader, and pdal::MultiFilter classes that implement the reading API in a PDAL pipeline.

class pdal::Stage

A stage performs the actual processing in PDAL.

Stages may read data, modify or filter read data, create metadata or write processed data.

Stages are linked with setInput() into a pipeline. The pipeline is run with by calling in sequence prepare() and execute() on the stage at the end of the pipeline. PipelineManager can also be used to create and run a pipeline.

Subclassed by pdal::Filter, pdal::Reader, pdal::Streamable, pdal::Writer

Public Functions

Stage()
virtual ~Stage()
void setInput(Stage &input)

Add a stage to the input list of this stage.

Parameters
  • input: Stage to use as input.

void setProgressFd(int fd)

Set a file descriptor to which progress information should be written.

Parameters
  • fd: Progress file descriptor.

QuickInfo preview()

Retrieve some basic point information without reading all data when possible.

Usually implemented only by Readers.

void prepare(PointTableRef table)

Prepare a stage for execution.

This function needs to be called on the terminal stage of a pipeline (linked set of stages) before execute can be called. Prepare recurses through all input stages.

Parameters
  • table: PointTable being used for stage pipeline.

PointViewSet execute(PointTableRef table)

Execute a prepared pipeline (linked set of stages).

This performs the action associated with the stage by executing the run function of each stage in depth first order. Each stage is run to completion (all points are processed) before the next stages is run.o

Parameters
  • table: Point table being used for stage pipeline. This must be the same table used in the prepare function.

virtual void execute(StreamPointTable &table)
virtual bool pipelineStreamable() const

Determine if a pipeline with this stage as a sink is streamable.

Return
Whether the pipeline is streamable.

virtual const Stage *findNonstreamable() const

Return a pointer to a pipeline’s first non-streamable stage, if one exists.

Return
nullptr if the stage is streamable, a pointer to this stage otherwise.

void setSpatialReference(SpatialReference const &srs)

Set the spatial reference of a stage.

Set the spatial reference that will override that being carried by the PointView being processed. This is usually used when reprojecting data to a new spatial reference. The stage spatial reference will be carried by PointViews processes by this stage to subsequent stages.

Parameters
  • srs: Spatial reference to set.

const SpatialReference &getSpatialReference() const

Get the spatial reference of the stage.

Get the spatial reference that will override that being carried by the PointView being processed. This is usually used when reprojecting data to a new spatial reference. The stage spatial reference will be carried by PointViews processes by this stage to subsequent stages.

Return
The stage’s spatial reference.

void setOptions(Options options)

Set a stage’s options.

Set the options on a stage, clearing all previously set options.

Parameters

void addConditionalOptions(const Options &opts)

Add options if an option with the same name doesn’t already exist on the stage.

Parameters

void addAllArgs(ProgramArgs &args)

Add a stage’s options to a ProgramArgs set.

Parameters

void addOptions(const Options &opts)

Add options to the existing option set.

Parameters

void removeOptions(const Options &opts)

Remove options from a stage’s option set.

Parameters

void setLog(LogPtr &log)

Set the stage’s log.

Parameters
  • log: Log pointer.

virtual LogPtr log() const

Return the stage’s log pointer.

Return
Log pointer.

void startLogging() const

Push the stage’s leader into the log.

void stopLogging() const

Pop the stage’s leader from the log.

bool isDebug() const

Determine whether the stage is in debug mode or not.

Return
The stage’s debug state.

virtual std::string getName() const = 0

Return the name of a stage.

Return
The stage’s name.

void setTag(const std::string &tag)

Set a specific tag name.

virtual std::string tag() const

Return the tag name of a stage.

Return
The tag name.

std::vector<Stage *> &getInputs()

Return a list of the stage’s inputs.

Return
A vector pointers to input stages.

MetadataNode getMetadata() const

Get the stage’s metadata node.

Return
Stage’s metadata.

void serialize(MetadataNode root, PipelineWriter::TagMap &tags) const

Serialize a stage by inserting apporpritate data into the provided MetadataNode.

Used to dump a pipeline specification in a portable format.

Parameters
  • root: Node to which a stages meatdata should be added.
  • tags: Pipeline writer’s current list of stage tags.

Public Static Functions

bool parseName(std::string o, std::string::size_type &pos)

Parse a stage name from a string.

Return the name and update the position in the input string to the end of the stage name.

Return
Whether the parsed name is a valid stage name.
Parameters
  • o: Input string to parse.
  • pos: Parsing start/end position.

bool parseTagName(std::string o, std::string::size_type &pos)

Parse a tag name from a string.

Return the name and update the position in the input string to the end of the tag name.

Return
Whether the parsed name is a valid tag name.
Parameters
  • o: Input string to parse.
  • pos: Parsing start/end position.
  • tag: Parsed tag name.