Skip to content

Commit

Permalink
playing around with nitf writer
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Jan 10, 2013
1 parent 1356336 commit 6476cf7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
44 changes: 42 additions & 2 deletions src/drivers/nitf/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <pdal/drivers/las/Writer.hpp>

#include <pdal/PointBuffer.hpp>
#include <pdal/GlobalEnvironment.hpp>

#ifdef PDAL_HAVE_GDAL
#include "NitfFile.hpp"
Expand Down Expand Up @@ -100,8 +101,13 @@ void Writer::writeBegin(boost::uint64_t targetNumPointsToWrite)
{
// call super class
pdal::drivers::las::Writer::writeBegin(targetNumPointsToWrite);

NITFCreate(m_filename.c_str(), 1, 1, 1, 1, NULL, NULL);

// char pszPVType[4] = "INT";
// pszPVType[3] = 0;
// char** options = NULL;
// NITFCreate(m_filename.c_str(), 1, 1, 1, 1, pszPVType, options);



return;
}
Expand All @@ -125,6 +131,40 @@ void Writer::writeBufferEnd(PointBuffer const& buffer)
{
// call super class
pdal::drivers::las::Writer::writeBufferEnd(buffer);

GlobalEnvironment::get().getGDALEnvironment();
GDALDriverH hDriver = GDALGetDriverByName( "NITF" );
if (hDriver == NULL)
throw pdal_error("NITF driver was null!");

GDALDatasetH ds;

char **papszMetadata = NULL;
papszMetadata = CSLAddNameValue( papszMetadata, "NITF_DESID", "LIDARA DES" );
papszMetadata = CSLAddNameValue( papszMetadata, "NITF_DESVER", "01" );

char **papszOptions = NULL;

papszOptions = CSLSetNameValue( papszOptions, "CLEVEL", "05" );

papszOptions = CSLSetNameValue( papszOptions, "FSCTLH", "FO" );
papszOptions = CSLSetNameValue( papszOptions, "FDT", "20120323002946" );
papszOptions = CSLSetNameValue( papszOptions, "OSTAID", "PDAL" );
papszOptions = CSLSetNameValue( papszOptions, "FTITLE", "Some LiDAR data we're storing" );
papszOptions = CSLSetNameValue( papszOptions, "FSCLAS", "S" );



ds = GDALCreate( hDriver, m_filename.c_str(), 1, 1, 1, GDT_Byte,
papszOptions );

GDALRasterBandH band = GDALGetRasterBand(ds, 1);
GByte* buf = (GByte*) CPLMalloc( 1 );
int eErr = GDALRasterIO(band,
GF_Write,
0, 0, 1,
1, buf, 1, 1, GDT_Byte, 0, 0);
GDALClose(ds);
}


Expand Down
2 changes: 1 addition & 1 deletion test/unit/drivers/nitf/NitfWriterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(test1)
writer.write(0);
}

FileUtils::deleteFile(nitf_output);
// FileUtils::deleteFile(nitf_output);


return;
Expand Down

0 comments on commit 6476cf7

Please sign in to comment.