Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created December 21, 2011 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tmcw/1506281 to your computer and use it in GitHub Desktop.
Save tmcw/1506281 to your computer and use it in GitHub Desktop.
mapnik::projection const *_merc = new mapnik::projection("+init=epsg:3857");
mapnik::projection const *_wgs84 = new mapnik::projection("+init=epsg:4326");
mapnik::proj_transform const *transformer_ = new mapnik::proj_transform(*_merc, *_wgs84);
std::clog << "before reprojection:\n";
mapnik::coord2d c = bb.center();
std::clog << std::setw(10) << c.y << "," << c.x << "\n";
{
std::clog << "after reprojection:\n";
transformer_->backward(bb);
transformer_->forward(bb);
mapnik::coord2d c = bb.center();
std::clog << std::setw(10) << c.y << "," << c.x << "\n";
}
/*
produces output:
before reprojection:
85.0483,-179.967
after reprojection:
85.0442,-179.967
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment