[Liblas-commits] hg: 2 new changesets
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Aug 12 15:47:51 EDT 2010
changeset dcc51120b167 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=dcc51120b167
summary: support writing header into a specified blob column in he pc table
changeset 1c5a6bdddda2 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=1c5a6bdddda2
summary: re-order arguments for change of liblas::Bounds
diffstat:
apps/las2oci.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++---
apps/laskernel.cpp | 2 +-
2 files changed, 46 insertions(+), 4 deletions(-)
diffs (140 lines):
diff -r 75f49aa797a6 -r 1c5a6bdddda2 apps/las2oci.cpp
--- a/apps/las2oci.cpp Thu Aug 12 12:27:44 2010 -0500
+++ b/apps/las2oci.cpp Thu Aug 12 14:47:44 2010 -0500
@@ -1,7 +1,7 @@
#include "las2oci.hpp"
-
+#include <liblas/detail/utility.hpp>
@@ -749,7 +749,10 @@
int blk_capacity,
long precision,
bool bUseSolidGeometry,
- bool bUse3d)
+ bool bUse3d,
+ bool bInsertHeaderBlob,
+ std::string const& header_blob_column,
+ std::vector<uint8_t> const& header_data)
{
ostringstream oss;
@@ -762,6 +765,7 @@
std::string pcTableName_u = to_upper(pcTableName);
std::string cloudColumnName_u = to_upper(cloudColumnName);
std::string aux_columns_u = to_upper(aux_columns);
+ std::string header_blob_column_u = to_upper(header_blob_column);
ostringstream columns;
ostringstream values;
@@ -774,6 +778,11 @@
columns << cloudColumnName_u;
values << "pc";
}
+
+ if (!header_blob_column_u.empty()){
+ columns << "," << header_blob_column_u;
+ values <<", :2";
+ }
ostringstream s_srid;
@@ -871,6 +880,13 @@
long output = 0;
statement = connection->CreateStatement(oss.str().c_str());
statement->Bind(&pc_id);
+ if (bInsertHeaderBlob) {
+ OCILobLocator** locator =(OCILobLocator**) VSIMalloc( sizeof(OCILobLocator*) * 1 );
+ statement->Define( locator, 1 );
+
+ statement->Bind((char*)&(header_data[0]),(long)header_data.size());
+
+ }
if (statement->Execute() == false) {
std::cout << "statement execution failed " << CPLGetLastErrorMsg() << std::endl;
@@ -911,6 +927,19 @@
fprintf(stderr,"----------------------------------------------------------\n");
}
+std::vector<uint8_t> GetHeaderData(std::string const& filename, uint32_t offset)
+{
+
+ std::istream* in = OpenInput(filename, false);
+
+
+ std::vector<uint8_t> data(offset);
+
+ liblas::detail::read_n(data.front(), *in, offset);
+
+ return data;
+
+}
// select sdo_pc_pkg.to_geometry(a.points, a.num_points, 3, 4326) from NACHES_BAREEARTH_BLOCK1 a where a.obj_id= 8907
int main(int argc, char* argv[])
@@ -924,6 +953,7 @@
std::string point_cloud_name("CLOUD");
std::string base_table_name("HOBU");
std::string block_table_name("");
+ std::string header_blob_column("");
std::string pre_sql("");
std::string post_sql("");
@@ -936,6 +966,7 @@
bool bDropTable = false;
bool bUseSolidGeometry = false;
bool bUse3d = false;
+ bool bInsertHeaderBlob = false;
uint32_t nCapacity = 10000;
@@ -1084,6 +1115,13 @@
{
bUse3d=true;
}
+ else if ( strcmp(argv[i],"--header-blob-column") == 0
+ )
+ {
+ bInsertHeaderBlob=true;
+ i++;
+ header_blob_column = std::string(argv[i]);
+ }
else if ( strcmp(argv[i],"--xmin") == 0 ||
strcmp(argv[i],"-xmin") == 0
)
@@ -1257,6 +1295,7 @@
istrm2 = OpenInput(input, false);
liblas::Reader* reader2 = new liblas::Reader(*istrm2);
+ std::vector<uint8_t> header_data = GetHeaderData(input, reader2->GetHeader().GetDataOffset());
long pc_id = CreatePCEntry( con,
query,
@@ -1270,7 +1309,10 @@
nCapacity,
precision,
bUseSolidGeometry,
- bUse3d);
+ bUse3d,
+ bInsertHeaderBlob,
+ header_blob_column,
+ header_data);
std::cout << "Writing " << results.size() << " blocks ..." << std::endl;
diff -r 75f49aa797a6 -r 1c5a6bdddda2 apps/laskernel.cpp
--- a/apps/laskernel.cpp Thu Aug 12 12:27:44 2010 -0500
+++ b/apps/laskernel.cpp Thu Aug 12 14:47:44 2010 -0500
@@ -114,7 +114,7 @@
po::options_description filtering_options("Filtering options");
filtering_options.add_options()
- ("extent,e", po::value< string >(), "Extent window that points must fall within to keep.\nUse a comma-separated list, for example, \n -e minx, miny, maxx, maxy\n or \n -e minx, miny, maxx, maxy, minz, maxz")
+ ("extent,e", po::value< string >(), "Extent window that points must fall within to keep.\nUse a comma-separated list, for example, \n -e minx, miny, maxx, maxy\n or \n -e minx, miny, minz, maxx, maxy, maxz")
("thin,t", po::value<uint32_t>()->default_value(0), "Simple decimation-style thinning.\nThin the file by removing every t'th point from the file.")
("last_return_only", po::value<bool>()->zero_tokens(), "Keep last returns (cannot be used with --first_return_only)")
("first_return_only", po::value<bool>()->zero_tokens(), "Keep first returns (cannot be used with --last_return_only")
More information about the Liblas-commits
mailing list