Merge branch 'master' of https://github.com/mapnik/mapnik into ci/vcpkg_2022-03-18

This commit is contained in:
Mathis Logemann 2022-04-11 15:24:45 +02:00
commit 8c9e61373e
2 changed files with 13 additions and 4 deletions

View file

@ -124,17 +124,20 @@ proj_transform::proj_transform(projection const& source, projection const& dest)
{
#ifdef MAPNIK_USE_PROJ
ctx_ = proj_context_create();
proj_log_level(ctx_, PJ_LOG_ERROR);
transform_ = proj_create_crs_to_crs(ctx_, source.params().c_str(), dest.params().c_str(), nullptr);
if (transform_ == nullptr)
{
throw std::runtime_error(std::string("Cannot initialize proj_transform for given projections: '") +
source.params() + "'->'" + dest.params() + "'");
throw std::runtime_error(std::string("Cannot initialize proj_transform (crs_to_crs) for given projections: '") +
source.params() + "'->'" + dest.params() +
"' because of " + std::string(proj_context_errno_string(ctx_, proj_context_errno(ctx_))));
}
PJ* transform_gis = proj_normalize_for_visualization(ctx_, transform_);
if (transform_gis == nullptr)
{
throw std::runtime_error(std::string("Cannot initialize proj_transform for given projections: '") +
source.params() + "'->'" + dest.params() + "'");
throw std::runtime_error(std::string("Cannot initialize proj_transform (normalize) for given projections: '") +
source.params() + "'->'" + dest.params() +
"' because of " + std::string(proj_context_errno_string(ctx_, proj_context_errno(ctx_))));
}
proj_destroy(transform_);
transform_ = transform_gis;

View file

@ -12,6 +12,11 @@ MAPNIK_DISABLE_WARNING_POP
#include <fstream>
#if defined(HAVE_CAIRO)
#include <cairo-version.h>
// see https://gitlab.freedesktop.org/cairo/cairo/-/issues/553
// TLDR: cairo has removed the writing of the svg version in cairo 1.17.6
#if (CAIRO_VERSION_MAJOR <= 1) && (CAIRO_VERSION_MINOR <= 17) && (CAIRO_VERSION_MICRO < 6)
TEST_CASE("cairo_io")
{
SECTION("save_to_cairo_file - SVG")
@ -33,3 +38,4 @@ TEST_CASE("cairo_io")
}
}
#endif
#endif