-
-
Save springmeyer/1506872 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
produces (but try changing bbox): | |
``` | |
before: box2d(-180,-60,180,60) | |
after back: box2d(-20037508.34278924,-8399737.889818359,20037508.34278924,8399737.889818355) | |
after forward: box2d(-180,-60.00000000000001,180,59.99999999999999) | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mapnik/projection.hpp> | |
#include <mapnik/proj_transform.hpp> | |
/* | |
clang++ -o t trans.cpp `mapnik-config --cflags` -lmapnik;./t | |
*/ | |
int main() | |
{ | |
mapnik::projection merc = mapnik::projection("+init=epsg:3857 +over"); | |
mapnik::projection wgs84 = mapnik::projection("+init=epsg:4326 +over"); | |
mapnik::proj_transform transformer(merc, wgs84); | |
mapnik::box2d<double> bb(-180,-60,180,60); | |
std::clog << "before: " << bb << "\n"; | |
if (!transformer.backward(bb)) | |
std::clog << "proj backward failed!\n"; | |
std::clog << "after back: " << bb << "\n"; | |
if (!transformer.forward(bb)) | |
std::clog << "proj forward failed!\n"; | |
std::clog << "after forward: " << bb << "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment