GeJSON - allow empty FeatureCollections (#4035)
This commit is contained in:
parent
783437f16b
commit
0f73b8b795
2 changed files with 3 additions and 3 deletions
|
@ -274,7 +274,7 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mapnik::json::extract_bounding_boxes(itr, end, boxes);
|
mapnik::json::extract_bounding_boxes(itr, end, boxes);
|
||||||
if (itr != end || boxes.empty()) throw std::exception();
|
if (itr != end) throw std::exception();
|
||||||
// bulk insert initialise r-tree
|
// bulk insert initialise r-tree
|
||||||
tree_ = std::make_unique<spatial_index_type>(boxes);
|
tree_ = std::make_unique<spatial_index_type>(boxes);
|
||||||
// calculate total extent
|
// calculate total extent
|
||||||
|
@ -366,7 +366,7 @@ void geojson_datasource::parse_geojson(Iterator start, Iterator end)
|
||||||
{
|
{
|
||||||
boxes_type boxes;
|
boxes_type boxes;
|
||||||
mapnik::json::extract_bounding_boxes(itr, end, boxes);
|
mapnik::json::extract_bounding_boxes(itr, end, boxes);
|
||||||
if (itr != end || boxes.empty()) throw std::exception(); //ensure we've consumed all input and we extracted at least one bbox;
|
if (itr != end) throw std::exception(); //ensure we've consumed all input
|
||||||
for (auto const& item : boxes)
|
for (auto const& item : boxes)
|
||||||
{
|
{
|
||||||
auto const& geometry_index = std::get<1>(item);
|
auto const& geometry_index = std::get<1>(item);
|
||||||
|
|
|
@ -108,7 +108,7 @@ TEST_CASE("geojson") {
|
||||||
params["type"] = "geojson";
|
params["type"] = "geojson";
|
||||||
params["file"] = "./test/data/json/empty_featurecollection.json";
|
params["file"] = "./test/data/json/empty_featurecollection.json";
|
||||||
params["cache_features"] = cache_features;
|
params["cache_features"] = cache_features;
|
||||||
REQUIRE_THROWS(mapnik::datasource_cache::instance().create(params));
|
REQUIRE(mapnik::datasource_cache::instance().create(params));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue