proj_transform test: use reference values from cs2cs tool

This commit is contained in:
Mickey Rose 2018-07-10 10:26:49 +02:00
parent 9a30fda852
commit 2a98fe0155

View file

@ -128,9 +128,20 @@ SECTION("Test proj antimeridian bbox")
mapnik::proj_transform prj_trans_fwd(prj_proj, prj_geog);
mapnik::proj_transform prj_trans_rev(prj_geog, prj_proj);
// bad = mapnik.Box2d(-177.31453250437079, -62.33374815225163, 178.02778363316355, -24.584597490955804)
const mapnik::box2d<double> better(-180.0, -62.33374815225163,
180.0, -24.584597490955804);
// reference values taken from proj4 command line tool:
// (non-corner points assume PROJ_ENVELOPE_POINTS == 20)
//
// cs2cs -Ef %.10f +init=epsg:2193 +to +init=epsg:4326 <<END
// 2105800 3087000 # left-most
// 1495200 3087000 # bottom-most
// 2105800 7173000 # right-most
// 3327000 7173000 # top-most
// END
//
// wrong = mapnik.Box2d(-177.3145325044, -62.3337481525,
// 178.0277836332, -24.5845974912)
const mapnik::box2d<double> better(-180.0, -62.3337481525,
180.0, -24.5845974912);
{
mapnik::box2d<double> ext(274000, 3087000, 3327000, 7173000);
@ -151,18 +162,17 @@ SECTION("Test proj antimeridian bbox")
CHECK(ext.maxy() == Approx(better.maxy()));
}
{
// checks for not being snapped (ie. not antimeridian)
mapnik::box2d<double> ext(274000, 3087000, 3327000, 7173000);
prj_trans_rev.backward(ext, PROJ_ENVELOPE_POINTS);
CHECK(ext.minx() == Approx(better.minx()));
CHECK(ext.miny() == Approx(better.miny()));
CHECK(ext.maxx() == Approx(better.maxx()));
CHECK(ext.maxy() == Approx(better.maxy()));
}
const mapnik::box2d<double> normal(148.766759749, -60.1222810238,
159.95484893, -24.9774643167);
// reference values taken from proj4 command line tool:
//
// cs2cs -Ef %.10f +init=epsg:2193 +to +init=epsg:4326 <<END
// 274000 3087000 # left-most
// 276000 3087000 # bottom-most
// 276000 7173000 # right-most
// 274000 7173000 # top-most
// END
//
const mapnik::box2d<double> normal(148.7667597489, -60.1222810241,
159.9548489296, -24.9771195155);
{
// checks for not being snapped (ie. not antimeridian)