Skip to content

Commit 4bb3277

Browse files
authored
Enabled VSI for FileSpec connector (PDAL#4720)
* enabled VSI for FileSpec connector * changed error message check from VSI
1 parent 28e77b0 commit 4bb3277

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

io/private/connector/Connector.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ std::vector<char> Connector::getBinary(const std::string& path) const
140140

141141
arbiter::LocalHandle Connector::getLocalHandle(const std::string& path) const
142142
{
143+
if (Utils::startsWith(Utils::toupper(path), "/VSI"))
144+
// workaround so that arbiter path is not used to read/write with VSI
145+
return arbiter::LocalHandle(path, false);
146+
143147
if (m_arbiter->isLocal(path))
144148
return m_arbiter->getLocalHandle(path);
145149
else

test/unit/io/LasReaderTest.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <pdal/StageFactory.hpp>
4141
#include <pdal/Streamable.hpp>
4242
#include <pdal/util/FileUtils.hpp>
43+
#include <pdal/util/Utils.hpp>
4344
#include <io/HeaderVal.hpp>
4445
#include <io/LasHeader.hpp>
4546
#include <io/LasReader.hpp>
@@ -811,3 +812,28 @@ TEST(LasReaderTest, Laz_with_severals_extra_byte_with_wrong_options_name)
811812
ASSERT_TRUE(view->hasDim( layout->findDim("confidence") ));
812813
ASSERT_TRUE(view->hasDim( layout->findDim("Bad_Name") ));
813814
}
815+
816+
TEST(LasReaderTest, remote_vsi)
817+
{
818+
Options ops1;
819+
ops1.add("filename", "/vsicurl/http://localhost/simple.laz");
820+
821+
LasReader reader;
822+
reader.setOptions(ops1);
823+
824+
PointTable table;
825+
826+
// check we get past looking up the arbiter driver
827+
EXPECT_THROW({
828+
try
829+
{
830+
reader.prepare(table);
831+
}
832+
catch(const pdal_error& e)
833+
{
834+
EXPECT_TRUE(Utils::startsWith(e.what(),
835+
"Unable to open stream for"));
836+
throw;
837+
}
838+
}, pdal_error);
839+
}

0 commit comments

Comments
 (0)