2015-07-10 09:05:48 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Artem Pavlenko
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "catch.hpp"
|
|
|
|
|
|
|
|
#include <mapnik/map.hpp>
|
|
|
|
#include <mapnik/datasource.hpp>
|
|
|
|
#include <mapnik/datasource_cache.hpp>
|
|
|
|
#include <mapnik/geometry.hpp>
|
2015-10-19 11:23:43 +00:00
|
|
|
#include <mapnik/geometry_type.hpp>
|
2015-07-10 19:34:18 +00:00
|
|
|
#include <mapnik/util/fs.hpp>
|
2015-10-19 15:58:32 +00:00
|
|
|
#include <cstdlib>
|
2015-10-19 11:23:43 +00:00
|
|
|
|
2015-10-21 05:56:03 +00:00
|
|
|
#include <boost/filesystem/operations.hpp>
|
2015-10-21 06:17:44 +00:00
|
|
|
#include <boost/optional/optional_io.hpp>
|
2015-10-21 05:56:03 +00:00
|
|
|
|
2015-10-19 11:23:43 +00:00
|
|
|
namespace detail {
|
|
|
|
|
2015-10-21 06:17:44 +00:00
|
|
|
std::pair<mapnik::datasource_ptr,mapnik::feature_ptr> fetch_first_feature(std::string const& filename, bool cache_features)
|
2015-10-19 11:23:43 +00:00
|
|
|
{
|
|
|
|
mapnik::parameters params;
|
|
|
|
params["type"] = "geojson";
|
|
|
|
params["file"] = filename;
|
|
|
|
params["cache-features"] = cache_features;
|
|
|
|
auto ds = mapnik::datasource_cache::instance().create(params);
|
|
|
|
auto fields = ds->get_descriptor().get_descriptors();
|
|
|
|
mapnik::query query(ds->envelope());
|
|
|
|
for (auto const& field : fields)
|
|
|
|
{
|
|
|
|
query.add_property_name(field.get_name());
|
|
|
|
}
|
|
|
|
auto features = ds->features(query);
|
|
|
|
auto feature = features->next();
|
2015-10-21 06:17:44 +00:00
|
|
|
return std::make_pair(ds,feature);
|
2015-10-19 11:23:43 +00:00
|
|
|
}
|
|
|
|
|
2015-10-19 15:58:32 +00:00
|
|
|
int create_disk_index(std::string const& filename, bool silent)
|
|
|
|
{
|
2015-10-21 00:22:52 +00:00
|
|
|
std::string cmd;
|
|
|
|
if (std::getenv("DYLD_LIBRARY_PATH") != nullptr)
|
|
|
|
{
|
|
|
|
cmd += std::string("export DYLD_LIBRARY_PATH=") + std::getenv("DYLD_LIBRARY_PATH") + " && ";
|
|
|
|
}
|
|
|
|
cmd += "mapnik-index " + filename;
|
2015-10-19 15:58:32 +00:00
|
|
|
if (silent)
|
|
|
|
{
|
|
|
|
#ifndef _WINDOWS
|
|
|
|
cmd += " 2>/dev/null";
|
|
|
|
#else
|
|
|
|
cmd += "2> nul";
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return std::system(cmd.c_str());
|
|
|
|
}
|
|
|
|
|
2015-10-19 11:23:43 +00:00
|
|
|
}
|
|
|
|
|
2015-07-10 09:05:48 +00:00
|
|
|
TEST_CASE("geojson") {
|
|
|
|
|
2015-07-10 19:34:18 +00:00
|
|
|
std::string geojson_plugin("./plugins/input/geojson.input");
|
|
|
|
if (mapnik::util::exists(geojson_plugin))
|
2015-07-10 09:05:48 +00:00
|
|
|
{
|
2015-10-19 11:23:43 +00:00
|
|
|
SECTION("GeoJSON Point")
|
|
|
|
{
|
2015-10-20 10:22:42 +00:00
|
|
|
for (auto cache_features : {true, false})
|
2015-10-19 11:23:43 +00:00
|
|
|
{
|
2015-10-21 06:17:44 +00:00
|
|
|
auto result = detail::fetch_first_feature("./test/data/json/point.json", cache_features);
|
|
|
|
auto feature = result.second;
|
|
|
|
auto ds = result.first;
|
|
|
|
CHECK(ds->get_geometry_type() == mapnik::datasource_geometry_t::Point);
|
2015-10-19 11:23:43 +00:00
|
|
|
auto const& geometry = feature->get_geometry();
|
|
|
|
REQUIRE(mapnik::geometry::geometry_type(geometry) == mapnik::geometry::Point);
|
|
|
|
auto const& pt = mapnik::util::get<mapnik::geometry::point<double> >(geometry);
|
|
|
|
REQUIRE(pt.x == 100);
|
|
|
|
REQUIRE(pt.y == 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("GeoJSON LineString")
|
|
|
|
{
|
2015-10-20 10:22:42 +00:00
|
|
|
for (auto cache_features : {true, false})
|
2015-10-19 11:23:43 +00:00
|
|
|
{
|
2015-10-21 06:17:44 +00:00
|
|
|
auto result = detail::fetch_first_feature("./test/data/json/linestring.json", cache_features);
|
|
|
|
auto feature = result.second;
|
|
|
|
auto ds = result.first;
|
|
|
|
CHECK(ds->get_geometry_type() == mapnik::datasource_geometry_t::LineString);
|
2015-10-19 11:23:43 +00:00
|
|
|
auto const& geometry = feature->get_geometry();
|
|
|
|
REQUIRE(mapnik::geometry::geometry_type(geometry) == mapnik::geometry::LineString);
|
|
|
|
auto const& line = mapnik::util::get<mapnik::geometry::line_string<double> >(geometry);
|
|
|
|
REQUIRE(line.size() == 2);
|
|
|
|
REQUIRE(mapnik::geometry::envelope(line) == mapnik::box2d<double>(100,0,101,1));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("GeoJSON Polygon")
|
|
|
|
{
|
2015-10-20 10:22:42 +00:00
|
|
|
for (auto cache_features : {true, false})
|
2015-10-19 11:23:43 +00:00
|
|
|
{
|
2015-10-21 06:17:44 +00:00
|
|
|
auto result = detail::fetch_first_feature("./test/data/json/polygon.json", cache_features);
|
|
|
|
auto feature = result.second;
|
|
|
|
auto ds = result.first;
|
|
|
|
CHECK(ds->get_geometry_type() == mapnik::datasource_geometry_t::Polygon);
|
2015-10-19 11:23:43 +00:00
|
|
|
auto const& geometry = feature->get_geometry();
|
|
|
|
REQUIRE(mapnik::geometry::geometry_type(geometry) == mapnik::geometry::Polygon);
|
|
|
|
auto const& poly = mapnik::util::get<mapnik::geometry::polygon<double> >(geometry);
|
|
|
|
REQUIRE(poly.num_rings() == 2);
|
|
|
|
REQUIRE(poly.exterior_ring.size() == 5);
|
|
|
|
REQUIRE(poly.interior_rings.size() == 1);
|
|
|
|
REQUIRE(poly.interior_rings[0].size() == 5);
|
|
|
|
REQUIRE(mapnik::geometry::envelope(poly) == mapnik::box2d<double>(100,0,101,1));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("GeoJSON MultiPoint")
|
|
|
|
{
|
2015-10-20 10:22:42 +00:00
|
|
|
for (auto cache_features : {true, false})
|
2015-10-19 11:23:43 +00:00
|
|
|
{
|
2015-10-21 06:17:44 +00:00
|
|
|
auto result = detail::fetch_first_feature("./test/data/json/multipoint.json", cache_features);
|
|
|
|
auto feature = result.second;
|
|
|
|
auto ds = result.first;
|
|
|
|
CHECK(ds->get_geometry_type() == mapnik::datasource_geometry_t::Point);
|
2015-10-19 11:23:43 +00:00
|
|
|
auto const& geometry = feature->get_geometry();
|
|
|
|
REQUIRE(mapnik::geometry::geometry_type(geometry) == mapnik::geometry::MultiPoint);
|
|
|
|
auto const& multi_pt = mapnik::util::get<mapnik::geometry::multi_point<double> >(geometry);
|
|
|
|
REQUIRE(multi_pt.size() == 2);
|
|
|
|
REQUIRE(mapnik::geometry::envelope(multi_pt) == mapnik::box2d<double>(100,0,101,1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("GeoJSON MultiLineString")
|
|
|
|
{
|
2015-10-20 10:22:42 +00:00
|
|
|
for (auto cache_features : {true, false})
|
2015-10-19 11:23:43 +00:00
|
|
|
{
|
2015-10-21 06:17:44 +00:00
|
|
|
auto result = detail::fetch_first_feature("./test/data/json/multilinestring.json", cache_features);
|
|
|
|
auto feature = result.second;
|
|
|
|
auto ds = result.first;
|
|
|
|
CHECK(ds->get_geometry_type() == mapnik::datasource_geometry_t::LineString);
|
2015-10-19 11:23:43 +00:00
|
|
|
auto const& geometry = feature->get_geometry();
|
|
|
|
REQUIRE(mapnik::geometry::geometry_type(geometry) == mapnik::geometry::MultiLineString);
|
|
|
|
auto const& multi_line = mapnik::util::get<mapnik::geometry::multi_line_string<double> >(geometry);
|
|
|
|
REQUIRE(multi_line.size() == 2);
|
|
|
|
REQUIRE(multi_line[0].size() == 2);
|
|
|
|
REQUIRE(multi_line[1].size() == 2);
|
|
|
|
REQUIRE(mapnik::geometry::envelope(multi_line) == mapnik::box2d<double>(100,0,103,3));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("GeoJSON MultiPolygon")
|
|
|
|
{
|
2015-10-20 10:22:42 +00:00
|
|
|
for (auto cache_features : {true, false})
|
2015-10-19 11:23:43 +00:00
|
|
|
{
|
2015-10-21 06:17:44 +00:00
|
|
|
auto result = detail::fetch_first_feature("./test/data/json/multipolygon.json", cache_features);
|
|
|
|
auto feature = result.second;
|
|
|
|
auto ds = result.first;
|
|
|
|
CHECK(ds->get_geometry_type() == mapnik::datasource_geometry_t::Polygon);
|
2015-10-19 11:23:43 +00:00
|
|
|
// test
|
|
|
|
auto const& geometry = feature->get_geometry();
|
|
|
|
REQUIRE(mapnik::geometry::geometry_type(geometry) == mapnik::geometry::MultiPolygon);
|
|
|
|
auto const& multi_poly = mapnik::util::get<mapnik::geometry::multi_polygon<double> >(geometry);
|
|
|
|
REQUIRE(multi_poly.size() == 2);
|
|
|
|
REQUIRE(multi_poly[0].num_rings() == 1);
|
|
|
|
REQUIRE(multi_poly[1].num_rings() == 2);
|
|
|
|
REQUIRE(mapnik::geometry::envelope(multi_poly) == mapnik::box2d<double>(100,0,103,3));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("GeoJSON GeometryCollection")
|
|
|
|
{
|
2015-10-21 05:56:03 +00:00
|
|
|
std::string filename("./test/data/json/geometrycollection.json");
|
|
|
|
for (auto create_index : { true, false })
|
2015-10-19 11:23:43 +00:00
|
|
|
{
|
2015-10-21 05:56:03 +00:00
|
|
|
if (create_index)
|
|
|
|
{
|
|
|
|
int ret = detail::create_disk_index(filename, true);
|
|
|
|
int ret_posix = (ret >> 8) & 0x000000ff;
|
|
|
|
INFO(ret);
|
|
|
|
INFO(ret_posix);
|
|
|
|
// index will not exist because this is not a featurecollection
|
|
|
|
CHECK(!mapnik::util::exists(filename + ".index"));
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto cache_features : {true, false})
|
|
|
|
{
|
2015-10-21 06:17:44 +00:00
|
|
|
auto result = detail::fetch_first_feature(filename, cache_features);
|
|
|
|
auto feature = result.second;
|
|
|
|
auto ds = result.first;
|
|
|
|
CHECK(ds->get_geometry_type() == mapnik::datasource_geometry_t::Collection);
|
2015-10-21 05:56:03 +00:00
|
|
|
// test
|
|
|
|
auto const& geometry = feature->get_geometry();
|
|
|
|
REQUIRE(mapnik::geometry::geometry_type(geometry) == mapnik::geometry::GeometryCollection);
|
|
|
|
auto const& collection = mapnik::util::get<mapnik::geometry::geometry_collection<double> >(geometry);
|
|
|
|
REQUIRE(collection.size() == 2);
|
|
|
|
REQUIRE(mapnik::geometry::geometry_type(collection[0]) == mapnik::geometry::Point);
|
|
|
|
REQUIRE(mapnik::geometry::geometry_type(collection[1]) == mapnik::geometry::LineString);
|
|
|
|
REQUIRE(mapnik::geometry::envelope(collection) == mapnik::box2d<double>(100,0,102,1));
|
|
|
|
}
|
2015-10-19 11:23:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-20 11:04:32 +00:00
|
|
|
SECTION("GeoJSON Feature")
|
|
|
|
{
|
|
|
|
// Create datasource
|
|
|
|
mapnik::parameters params;
|
|
|
|
params["type"] = "geojson";
|
2015-10-21 05:56:03 +00:00
|
|
|
std::string filename("./test/data/json/feature.json");
|
|
|
|
params["file"] = filename;
|
|
|
|
for (auto create_index : { true, false })
|
2015-10-20 11:04:32 +00:00
|
|
|
{
|
2015-10-21 05:56:03 +00:00
|
|
|
if (create_index)
|
|
|
|
{
|
|
|
|
int ret = detail::create_disk_index(filename, true);
|
|
|
|
int ret_posix = (ret >> 8) & 0x000000ff;
|
|
|
|
INFO(ret);
|
|
|
|
INFO(ret_posix);
|
|
|
|
// index will not exist because this is not a featurecollection
|
|
|
|
CHECK(!mapnik::util::exists(filename + ".index"));
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto cache_features : {true, false})
|
2015-10-20 11:04:32 +00:00
|
|
|
{
|
2015-10-21 05:56:03 +00:00
|
|
|
params["cache-features"] = cache_features;
|
|
|
|
auto ds = mapnik::datasource_cache::instance().create(params);
|
|
|
|
REQUIRE(bool(ds));
|
|
|
|
auto fields = ds->get_descriptor().get_descriptors();
|
|
|
|
mapnik::query query(ds->envelope());
|
|
|
|
for (auto const& field : fields)
|
|
|
|
{
|
|
|
|
query.add_property_name(field.get_name());
|
|
|
|
}
|
|
|
|
auto features = ds->features(query);
|
|
|
|
REQUIRE(features != nullptr);
|
|
|
|
auto feature = features->next();
|
|
|
|
REQUIRE(feature != nullptr);
|
2015-10-20 11:04:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-20 10:46:39 +00:00
|
|
|
SECTION("GeoJSON FeatureCollection")
|
2015-10-19 15:58:32 +00:00
|
|
|
{
|
|
|
|
std::string filename("./test/data/json/featurecollection.json");
|
2015-10-20 10:46:39 +00:00
|
|
|
|
2015-10-21 05:56:03 +00:00
|
|
|
// cleanup in the case of a failed previous run
|
|
|
|
if (mapnik::util::exists(filename + ".index"))
|
|
|
|
{
|
|
|
|
boost::filesystem::remove(filename + ".index");
|
|
|
|
}
|
|
|
|
|
2015-10-20 10:46:39 +00:00
|
|
|
for (auto create_index : { true, false })
|
2015-10-19 15:58:32 +00:00
|
|
|
{
|
2015-10-20 10:46:39 +00:00
|
|
|
if (create_index)
|
|
|
|
{
|
2015-10-20 19:23:05 +00:00
|
|
|
int ret = detail::create_disk_index(filename, true);
|
2015-10-20 22:18:12 +00:00
|
|
|
int ret_posix = (ret >> 8) & 0x000000ff;
|
2015-10-20 19:23:05 +00:00
|
|
|
INFO(ret);
|
2015-10-20 22:18:12 +00:00
|
|
|
INFO(ret_posix);
|
2015-10-20 19:19:06 +00:00
|
|
|
CHECK(mapnik::util::exists(filename + ".index"));
|
2015-10-20 10:46:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mapnik::parameters params;
|
|
|
|
params["type"] = "geojson";
|
|
|
|
params["file"] = filename;
|
|
|
|
|
|
|
|
for (auto cache_features : {true, false})
|
2015-10-19 15:58:32 +00:00
|
|
|
{
|
2015-10-20 10:46:39 +00:00
|
|
|
params["cache_features"] = cache_features;
|
|
|
|
|
2015-10-19 15:58:32 +00:00
|
|
|
auto ds = mapnik::datasource_cache::instance().create(params);
|
|
|
|
auto fields = ds->get_descriptor().get_descriptors();
|
|
|
|
mapnik::query query(ds->envelope());
|
|
|
|
for (auto const& field : fields)
|
|
|
|
{
|
|
|
|
query.add_property_name(field.get_name());
|
|
|
|
}
|
|
|
|
auto features = ds->features(query);
|
|
|
|
auto bounding_box = ds->envelope();
|
|
|
|
mapnik::box2d<double> bbox;
|
2015-10-20 10:46:39 +00:00
|
|
|
mapnik::value_integer count = 0;
|
2015-10-19 15:58:32 +00:00
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
auto feature = features->next();
|
|
|
|
if (!feature) break;
|
|
|
|
if (!bbox.valid()) bbox = feature->envelope();
|
|
|
|
else bbox.expand_to_include(feature->envelope());
|
|
|
|
++count;
|
2015-10-20 10:46:39 +00:00
|
|
|
REQUIRE(feature->id() == count);
|
2015-10-19 15:58:32 +00:00
|
|
|
}
|
|
|
|
REQUIRE(count == 3);
|
|
|
|
REQUIRE(bounding_box == bbox);
|
2015-10-20 10:46:39 +00:00
|
|
|
}
|
|
|
|
if (mapnik::util::exists(filename + ".index"))
|
|
|
|
{
|
2015-10-19 15:58:32 +00:00
|
|
|
CHECK(mapnik::util::remove(filename + ".index"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-20 11:04:32 +00:00
|
|
|
SECTION("GeoJSON extra properties")
|
2015-07-17 15:43:04 +00:00
|
|
|
{
|
|
|
|
// Create datasource
|
|
|
|
mapnik::parameters params;
|
|
|
|
params["type"] = "geojson";
|
2015-10-21 05:56:03 +00:00
|
|
|
std::string filename("./test/data/json/feature_collection_extra_properties.json");
|
|
|
|
params["file"] = filename;
|
|
|
|
|
|
|
|
// cleanup in the case of a failed previous run
|
|
|
|
if (mapnik::util::exists(filename + ".index"))
|
|
|
|
{
|
|
|
|
boost::filesystem::remove(filename + ".index");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto create_index : { true, false })
|
2015-07-17 15:43:04 +00:00
|
|
|
{
|
2015-10-21 05:56:03 +00:00
|
|
|
if (create_index)
|
|
|
|
{
|
|
|
|
int ret = detail::create_disk_index(filename, true);
|
|
|
|
int ret_posix = (ret >> 8) & 0x000000ff;
|
|
|
|
INFO(ret);
|
|
|
|
INFO(ret_posix);
|
|
|
|
CHECK(mapnik::util::exists(filename + ".index"));
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto cache_features : {true, false})
|
|
|
|
{
|
|
|
|
params["cache-features"] = cache_features;
|
|
|
|
auto ds = mapnik::datasource_cache::instance().create(params);
|
|
|
|
REQUIRE(bool(ds));
|
|
|
|
auto fields = ds->get_descriptor().get_descriptors();
|
|
|
|
mapnik::query query(ds->envelope());
|
|
|
|
for (auto const& field : fields)
|
|
|
|
{
|
|
|
|
query.add_property_name(field.get_name());
|
|
|
|
}
|
|
|
|
auto features = ds->features(query);
|
|
|
|
REQUIRE(features != nullptr);
|
|
|
|
auto feature = features->next();
|
|
|
|
REQUIRE(feature != nullptr);
|
|
|
|
REQUIRE(feature->envelope() == mapnik::box2d<double>(123,456,123,456));
|
|
|
|
}
|
|
|
|
|
|
|
|
// cleanup
|
|
|
|
if (create_index && mapnik::util::exists(filename + ".index"))
|
2015-10-20 11:04:32 +00:00
|
|
|
{
|
2015-10-21 05:56:03 +00:00
|
|
|
boost::filesystem::remove(filename + ".index");
|
2015-10-20 11:04:32 +00:00
|
|
|
}
|
2015-10-21 05:56:03 +00:00
|
|
|
|
2015-07-17 15:43:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-20 11:04:32 +00:00
|
|
|
SECTION("GeoJSON ensure input fully consumed and throw exception otherwise")
|
2015-07-17 15:43:04 +00:00
|
|
|
{
|
|
|
|
mapnik::parameters params;
|
|
|
|
params["type"] = "geojson";
|
2015-10-21 05:56:03 +00:00
|
|
|
std::string filename("./test/data/json/points-malformed.geojson");
|
|
|
|
params["file"] = filename; // mismatched parentheses
|
|
|
|
|
|
|
|
// cleanup in the case of a failed previous run
|
|
|
|
if (mapnik::util::exists(filename + ".index"))
|
|
|
|
{
|
|
|
|
boost::filesystem::remove(filename + ".index");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto create_index : { true, false })
|
2015-07-17 15:43:04 +00:00
|
|
|
{
|
2015-10-21 05:56:03 +00:00
|
|
|
if (create_index)
|
|
|
|
{
|
|
|
|
CHECK(!mapnik::util::exists(filename + ".index"));
|
|
|
|
int ret = detail::create_disk_index(filename, true);
|
|
|
|
int ret_posix = (ret >> 8) & 0x000000ff;
|
|
|
|
INFO(ret);
|
|
|
|
INFO(ret_posix);
|
|
|
|
CHECK(mapnik::util::exists(filename + ".index"));
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto cache_features : {true, false})
|
|
|
|
{
|
|
|
|
std::stringstream msg;
|
|
|
|
msg << "testcase: create index " << create_index << " cache-features " << cache_features;
|
|
|
|
params["cache-features"] = cache_features;
|
|
|
|
INFO(msg.str());
|
|
|
|
CHECK_THROWS(mapnik::datasource_cache::instance().create(params));
|
|
|
|
}
|
|
|
|
|
|
|
|
// cleanup
|
|
|
|
if (create_index && mapnik::util::exists(filename + ".index"))
|
|
|
|
{
|
|
|
|
boost::filesystem::remove(filename + ".index");
|
|
|
|
}
|
2015-07-17 15:43:04 +00:00
|
|
|
}
|
2015-10-14 10:41:14 +00:00
|
|
|
}
|
2015-07-10 19:34:18 +00:00
|
|
|
}
|
2015-07-10 09:05:48 +00:00
|
|
|
}
|