Skip to content

Commit

Permalink
rev: add test for geopackage subsetting on read
Browse files Browse the repository at this point in the history
changes per #522 (comment)
  • Loading branch information
program-- authored and mattw-nws committed Jul 18, 2023
1 parent 8eb84f9 commit ddffb9a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/geopackage/GeoPackage_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ TEST_F(GeoPackage_Test, geopackage_read_test)
ASSERT_TRUE(third == nullptr);
}

TEST_F(GeoPackage_Test, geopackage_idsubset_test)
{
const auto gpkg = geopackage::read(this->path, "test", { "First" });
EXPECT_NE(gpkg->find("First"), -1);
EXPECT_EQ(gpkg->find("Second"), -1);

const auto& first = gpkg->get_feature(0);
EXPECT_EQ(first->get_id(), "First");
const auto& point = boost::get<geojson::coordinate_t>(first->geometry());
EXPECT_EQ(point.get<0>(), 102.0);
EXPECT_EQ(point.get<1>(), 0.5);

ASSERT_TRUE(gpkg->get_feature(1) == nullptr);
}

// this test is essentially the same as the above, however, the coordinates
// are stored in EPSG:3857. When read in, they should convert to EPSG:4326.
TEST_F(GeoPackage_Test, geopackage_projection_test)
Expand All @@ -84,4 +99,4 @@ TEST_F(GeoPackage_Test, geopackage_projection_test)
EXPECT_NEAR(point.get<1>(), 0.5, 0.0001);

ASSERT_TRUE(third == nullptr);
}
}

0 comments on commit ddffb9a

Please sign in to comment.