From 6afdc89894bdcdafe98eff700c76d1572be4c3a5 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 5 Apr 2022 10:31:26 +0200 Subject: [PATCH 1/2] fix test for newer cairo --- test/unit/renderer/cairo_io.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/unit/renderer/cairo_io.cpp b/test/unit/renderer/cairo_io.cpp index c3b739404..4f95f0d49 100644 --- a/test/unit/renderer/cairo_io.cpp +++ b/test/unit/renderer/cairo_io.cpp @@ -12,6 +12,11 @@ MAPNIK_DISABLE_WARNING_POP #include #if defined(HAVE_CAIRO) +#include + +// 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 From 4f72043bcdead0122d10ad74171acf34909a9822 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Sun, 10 Apr 2022 11:55:04 +0200 Subject: [PATCH 2/2] src/proj_transform.cpp: improve error handling of proj_transform() - set proj log level to PJ_LOG_ERROR - let error message indicate whether proj_create_crs_to_crs or proj_normalize_for_visualization failed - output proj_context_errno_string when an error is thrown --- src/proj_transform.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/proj_transform.cpp b/src/proj_transform.cpp index 51ef2032c..b2f519c0f 100644 --- a/src/proj_transform.cpp +++ b/src/proj_transform.cpp @@ -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;