From eb49b5776a2c94ef82e1c33866753a6f6a0bc742 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Tue, 9 Mar 2021 15:02:11 +0000 Subject: [PATCH] Fix BBOX in geographic WGS84 (epsg:4326) calc logic --- demo/viewer/mapwidget.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/demo/viewer/mapwidget.cpp b/demo/viewer/mapwidget.cpp index de4523059..a9eb166f5 100644 --- a/demo/viewer/mapwidget.cpp +++ b/demo/viewer/mapwidget.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -592,8 +592,12 @@ void MapWidget::updateMap() double y0 = ext.miny(); double x1 = ext.maxx(); double y1 = ext.maxy(); - prj.inverse(x0,y0); - prj.inverse(x1,y1); + double z = 0; + std::string dest_srs = {"epsg:4326"}; + mapnik::proj_transform proj_tr(map_->srs(), dest_srs); + + proj_tr.forward(x0, y0, z); + proj_tr.forward(x1, y1, z); std::cout << "BBOX (WGS84): " << x0 << "," << y0 << "," << x1 << "," << y1 << "\n"; update(); // emit signal to interested widgets