diff --git a/doc/stages/readers.i3s.rst b/doc/stages/readers.i3s.rst index 13c4baea8c..bd0a97fd4f 100644 --- a/doc/stages/readers.i3s.rst +++ b/doc/stages/readers.i3s.rst @@ -22,7 +22,7 @@ This example will download the Autzen dataset from the arcgis scene server, repr ``pdal traslate i3s://https://tiles.arcgis.com/tiles/8cv2FuXuWSfF0nbL/arcgis/rest/services/AUTZEN_LiDAR/SceneServer \ autzen.las \ - --reprojection filters.reprojection.out_srs=EPSG:3857 \ + reprojection --filters.reprojection.out_srs=EPSG:3857 \ --readers.i3s.threads=64 \ --readers.i3s.bounds="([-123.075542,-123.06196],[44.049719,44.06278])"`` @@ -33,8 +33,8 @@ filename Exmaple remote file: ``pdal translate i3s://https://tiles.arcgis.com/tiles/8cv2FuXuWSfF0nbL/arcgis/rest/services/AUTZEN_LiDAR/SceneServer autzen.las`` threads - This specifies the number of threads that you would like to use while reading. The default number of threads to buse used is 8. This affects the speed at which files are fetched and added to the PDAL view. - Example: ``--readers.i3s.threads=numThreads`` + This specifies the number of threads that you would like to use while reading. The default number of threads to be used is 8. This affects the speed at which files are fetched and added to the PDAL view. + Example: ``--readers.i3s.threads=64`` bounds The bounds refers to the extents of the resource in X, Y, Z coordinates with the Z dimension being optional. This must be input as a string. diff --git a/kernels/InfoKernel.cpp b/kernels/InfoKernel.cpp index 37057da2fd..51882993a7 100644 --- a/kernels/InfoKernel.cpp +++ b/kernels/InfoKernel.cpp @@ -277,9 +277,7 @@ MetadataNode InfoKernel::dumpSummary(const QuickInfo& qi) void InfoKernel::makePipeline(const std::string& filename, bool noPoints) { - if (filename.find("://") != std::string::npos) - m_log->get(LogLevel::Debug) << "Protocol Found" << std::endl; - else if (!pdal::Utils::fileExists(filename)) + if (!pdal::Utils::fileExists(filename)) throw pdal_error("File not found: " + filename); if (filename == "STDIN") diff --git a/kyle-config.sy b/kyle-config.sy deleted file mode 100755 index 73d94e563e..0000000000 --- a/kyle-config.sy +++ /dev/null @@ -1,23 +0,0 @@ -cd ubuild - -echo CMake.... - -cmake .. \ - -G "Unix Makefiles" \ - -DCMAKE_INSTALL_PREFIX=/home/kylea/Documents/I3S/PDAL/ubuild \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_MAKE_PROGRAM=make \ - -DBUILD_PLUGIN_PYTHON=ON \ - -DBUILD_PLUGIN_GREYHOUND=ON \ - -DBUILD_PLUGIN_SQLITE=ON \ - -DBUILD_PLUGIN_I3S=ON \ - -DWITH_LASZIP=ON \ - -DWITH_LAZPERF=ON \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=Debug \ - ; \ - -echo Make... - -make -j 4 diff --git a/pdal/StageExtensions.cpp b/pdal/StageExtensions.cpp index 596a403c44..caa736aeba 100644 --- a/pdal/StageExtensions.cpp +++ b/pdal/StageExtensions.cpp @@ -81,8 +81,8 @@ R"PDALEXTENSIONS( "readers.mrsid" : "sid", "readers.rxp" : "rxp", "readers.fbx" : "fbx", - "readers.i3s" : "i3s", - "readers.slpk" : "slpk" + "readers.slpk" : "slpk", + "readers.i3s" : "i3s" } )PDALEXTENSIONS" diff --git a/plugins/i3s/io/EsriReader.cpp b/plugins/i3s/io/EsriReader.cpp index 086ad3baa8..da577a152e 100644 --- a/plugins/i3s/io/EsriReader.cpp +++ b/plugins/i3s/io/EsriReader.cpp @@ -112,16 +112,14 @@ namespace pdal { dimData data; std::string readName = attributes[i]["name"].asString(); - int key = std::stoi(attributes[i]["key"].asString()); - data.key = key; + data.key = std::stoi(attributes[i]["key"].asString()); if(attributes[i].isMember("valueType")) { - std::string type = attributes[i]["valueType"].asString(); - data.dataType = type; + data.dataType = attributes[i]["valueType"].asString(); } - else if (readName == "RGB") + if (readName == "RGB") { layout->registerDim(Dimension::Id::Red); layout->registerDim(Dimension::Id::Green); diff --git a/plugins/i3s/io/EsriReader.hpp b/plugins/i3s/io/EsriReader.hpp index d4f1f889df..4183a15f07 100644 --- a/plugins/i3s/io/EsriReader.hpp +++ b/plugins/i3s/io/EsriReader.hpp @@ -76,11 +76,19 @@ class EsriReader : public Reader std::unique_ptr m_stream; std::unique_ptr m_arbiter; + struct I3SArgs + { + Bounds bounds; + int threads = 8; + }; + I3SArgs m_args; Json::Value m_info; std::mutex m_mutex; BOX3D m_bounds; int m_nodeCap; + int m_maxNode = 0; + gzip::Decompressor m_decomp; @@ -102,7 +110,7 @@ class EsriReader : public Reader std::string dataType; }; std::map m_dimMap; - std::map m_dimensions { + std::map const m_dimensions { {"INTENSITY", Dimension::Id::Intensity}, {"CLASS_CODE", Dimension::Id::ClassFlags}, {"FLAGS", Dimension::Id::Flag}, diff --git a/plugins/i3s/io/EsriReceiver.cpp b/plugins/i3s/io/EsriReceiver.cpp index b8401a2cc8..afb2564010 100644 --- a/plugins/i3s/io/EsriReceiver.cpp +++ b/plugins/i3s/io/EsriReceiver.cpp @@ -37,11 +37,6 @@ namespace pdal { std::vector decompressXYZ(std::vector* compData) { - unsigned char* c = new unsigned char [compData->size()]; - - std::copy(compData->begin(), compData->end(), c); - - const unsigned char* compressed = c; int nInfo = lepcc_getBlobInfoSize(); lepcc_ContextHdl ctx(nullptr); ctx = lepcc_createContext(); @@ -49,6 +44,8 @@ namespace pdal lepcc::uint32 blobSize = 0; + const unsigned char* compressed = reinterpret_cast + (compData->data()); lepcc::Byte vec; lepcc_status stat; std::vector decVec; @@ -58,23 +55,22 @@ namespace pdal (lepcc::ErrCode)lepcc_getBlobInfo( ctx, compressed, nInfo, &bt, &blobSize); - const lepcc::Byte* pByte = &compressed[0]; + const lepcc::Byte* pByte = reinterpret_cast( + compData->data()); int nBytes = (errCode == lepcc::ErrCode::Ok) ? (int)blobSize : -1; if (nBytes > 0) { stat = lepcc_getPointCount(ctx, pByte, nBytes, &xyzPts); if(stat != (lepcc_status) lepcc::ErrCode::Ok) { - std::cout << "lepcc_getPointCount() failed. \n"; - return decVec;//TODO throw error here + throw (std::string("LEPCC point count fetch failed")); } decVec.resize(xyzPts); stat = lepcc_decodeXYZ( ctx, &pByte, nBytes, &xyzPts, (double*)(&decVec[0])); if(stat != (lepcc_status) lepcc::ErrCode::Ok) { - std::cout << "lepcc_decodeXYZ() failed. \n"; - return decVec;//TODO throw error here + throw (std::string("LEPCC decompression failed")); } } return decVec; @@ -109,17 +105,14 @@ namespace pdal stat = lepcc_getRGBCount(ctx, pByte, nBytes, &nPts); if(stat != (lepcc_status) lepcc::ErrCode::Ok) { - std::cout << stat << std::endl; - std::cout << "lepcc_getPointRGB() failed. \n"; - //TODO throw error here + throw (std::string("RGB point count fetch failed")); } rgbVec.resize(nPts); stat = lepcc_decodeRGB( ctx, &pByte, nBytes, &nPts, (lepcc::Byte*)(&rgbVec[0])); if(stat != (lepcc_status) lepcc::ErrCode::Ok) { - std::cout << "lepcc_decodergb() failed. \n"; - return rgbVec;//TODO throw error here + throw (std::string("RGB decompression failed")); } } return rgbVec; @@ -154,17 +147,14 @@ namespace pdal stat = lepcc_getIntensityCount(ctx, pByte, nBytes, &nPts); if(stat != (lepcc_status) lepcc::ErrCode::Ok) { - std::cout << stat << std::endl; - std::cout << "lepcc_getPointRGB() failed. \n"; - //TODO throw error here + throw (std::string("Intensity point count fetch failed")); } intVec.resize(nPts); stat = lepcc_decodeIntensity( ctx, &pByte, nBytes, &nPts, (unsigned short*)(&intVec[0])); if(stat != (lepcc_status) lepcc::ErrCode::Ok) { - std::cout << "lepcc_decodergb() failed. \n"; - return intVec;//TODO throw error here + throw (std::string("Intensity decompression failed")); } return intVec; diff --git a/plugins/i3s/io/EsriReceiver.hpp b/plugins/i3s/io/EsriReceiver.hpp index 641248a843..aa5d1706d2 100644 --- a/plugins/i3s/io/EsriReceiver.hpp +++ b/plugins/i3s/io/EsriReceiver.hpp @@ -65,12 +65,6 @@ namespace pdal return json; } - struct I3SArgs - { - Bounds bounds; - int threads = 8; - }; - struct compare3d { bool operator()(const lepcc::Point3D & first, @@ -87,7 +81,6 @@ namespace pdal if(first.z < second.z) return true; return false; - } }; diff --git a/plugins/i3s/io/I3SReader.cpp b/plugins/i3s/io/I3SReader.cpp index 26696d601e..e5a0b1926e 100644 --- a/plugins/i3s/io/I3SReader.cpp +++ b/plugins/i3s/io/I3SReader.cpp @@ -33,10 +33,6 @@ ****************************************************************************/ #include "EsriReader.hpp" -#include "../lepcc/src/include/lepcc_c_api.h" -#include "../lepcc/src/include/lepcc_types.h" -#include "pool.hpp" -#include "SlpkExtractor.hpp" #include #include @@ -61,7 +57,7 @@ namespace pdal { "readers.i3s", "I3S Reader", - "http://pdal.io/stages/reader.i3s.html" + "http://pdal.io/stages/readers.i3s.html" }; CREATE_SHARED_STAGE(I3SReader, i3sInfo) @@ -71,6 +67,7 @@ namespace pdal void I3SReader::initInfo() { m_info = parse(m_arbiter->get(m_filename))["layers"][0]; + m_filename += "/layers/0"; } @@ -87,8 +84,6 @@ namespace pdal // TODO Avoid doing this by using the max child node to figure out when // to stop traversing. nodeIndexJson = parse(m_arbiter->get(nodeUrl)); - if (nodeIndexJson.isMember("error")) - return; int pageSize = nodeIndexJson["nodes"].size(); int initialNode = nodeIndexJson["nodes"][0]["resourceId"].asInt(); @@ -103,6 +98,15 @@ namespace pdal { nodes.push_back(name); } + //keeps track of largest node so recursive loop knows when to stop + if ((nodeIndexJson["nodes"][i]["firstChild"].asInt() + + cCount - 1) > m_maxNode) + { + m_maxNode = nodeIndexJson["nodes"][i]["firstChild"].asInt() + + cCount - 1; + } + else if (initialNode + i == m_maxNode) + return; } buildNodeList(nodes, ++pageIndex); } diff --git a/plugins/i3s/io/SlpkReader.cpp b/plugins/i3s/io/SlpkReader.cpp index bcfd684c7e..078aba8c04 100644 --- a/plugins/i3s/io/SlpkReader.cpp +++ b/plugins/i3s/io/SlpkReader.cpp @@ -61,7 +61,7 @@ namespace pdal { "readers.slpk", "SLPK Reader", - "http://pdal.io/stages/reader.slpk.html" + "http://pdal.io/stages/readers.slpk.html" }; CREATE_SHARED_STAGE(SlpkReader, slpkInfo)