Skip to content

Commit

Permalink
rename writers.gdal.edge_length to writers.gdal.resolution. Allow set…
Browse files Browse the repository at this point in the history
…ting of nodata in options
  • Loading branch information
hobu committed Oct 19, 2016
1 parent ba2ad1b commit beada96
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions doc/stages/writers.gdal.rst
Expand Up @@ -20,7 +20,7 @@ potentially contributes to the raster's value.
it is possible that some points will not be considered at all, including
those that may be within the bounds of the raster cell.

The GDAL writer creates rasters using the data in the 'Z' dimension of the
The GDAL writer creates rasters using the data in the 'Z' dimension of the
points. In a :ref:`pipeline_command` one can precede the GDAL writer with
the ferry filter (:ref:`filters.ferry`) in order to copy data from some
other dimension to the 'Z' dimension if desired.
Expand Down Expand Up @@ -78,7 +78,7 @@ whose values contribute to the cell value is 14.14.
"pipeline":[
"pdal/test/data/las/autzen_trim.las",
{
"edge_length": 10,
"resolution": 10,
"radius": 14.14,
"filename":"outputfile.tif"
}
Expand All @@ -92,8 +92,8 @@ Options
filename
Name of output file. [Required]

edge_length
Length of raster cell edges. [Required]
resolution
Length of raster cell edges in X/Y units. [Required]

radius
Radius about cell center bounding points to use to calculate a cell value.
Expand Down
7 changes: 4 additions & 3 deletions io/gdal/GDALWriter.cpp
Expand Up @@ -59,7 +59,7 @@ std::string GDALWriter::getName() const
void GDALWriter::addArgs(ProgramArgs& args)
{
args.add("filename", "Output filename", m_filename).setPositional();
args.add("edge_length", "Length of cell edges (cells are square)",
args.add("resolution", "Cell edge size, in units of X/Y",
m_edgeLength).setPositional();
args.add("radius", "Radius from cell center to use to locate influencing "
"points", m_radius).setPositional();
Expand All @@ -70,6 +70,7 @@ void GDALWriter::addArgs(ProgramArgs& args)
"'idw', 'count', 'stdev' or 'all')", m_outputTypeString, {"all"} );
args.add("window_size", "Cell distance for fallback interpolation",
m_windowSize);
args.add("nodata", "No data value", m_noData, -9999.0);
}


Expand Down Expand Up @@ -124,7 +125,7 @@ void GDALWriter::write(const PointViewPtr view)
view->calculateBounds(m_bounds);
size_t width = ((m_bounds.maxx - m_bounds.minx) / m_edgeLength) + 1;
size_t height = ((m_bounds.maxy - m_bounds.miny) / m_edgeLength) + 1;
m_grid.reset(new GDALGrid(width, height, m_edgeLength, m_radius, -9999.0,
m_grid.reset(new GDALGrid(width, height, m_edgeLength, m_radius, m_noData,
m_outputTypes, m_windowSize));

for (PointId idx = 0; idx < view->size(); ++idx)
Expand Down Expand Up @@ -152,7 +153,7 @@ void GDALWriter::done(PointTableRef table)
pixelToPos[5] = -m_edgeLength;
gdal::Raster raster(m_filename, m_drivername, table.spatialReference(),
pixelToPos);

m_grid->finalize();

gdal::GDALError err = raster.open(m_grid->width(), m_grid->height(),
Expand Down
1 change: 1 addition & 0 deletions io/gdal/GDALWriter.hpp
Expand Up @@ -72,6 +72,7 @@ class PDAL_DLL GDALWriter : public Writer
size_t m_windowSize;
int m_outputTypes;
GDALGridPtr m_grid;
double m_noData;
};

}

0 comments on commit beada96

Please sign in to comment.