Merge pull request #3319 from mapnik/ST_MakeEnvelope

use `ST_MakeEnvelope` (ref #3317)
This commit is contained in:
Artem Pavlenko 2019-08-12 08:27:50 +01:00 committed by GitHub
commit b504a86696
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 30 deletions

View file

@ -598,21 +598,10 @@ std::string pgraster_datasource::sql_bbox(box2d<double> const& env) const
{
std::ostringstream b;
b.precision(16);
if (srid_ > 0)
{
b << "ST_SetSRID(";
}
b << "'BOX(";
b << env.minx() << " " << env.miny() << ",";
b << env.maxx() << " " << env.maxy() << ")'::box2d";
if (srid_ > 0)
{
b << ", " << srid_ << ")";
}
b << "ST_MakeEnvelope(";
b << env.minx() << "," << env.miny() << ",";
b << env.maxx() << "," << env.maxy() << ",";
b << std::max(srid_, 0) << ")";
return b.str();
}

View file

@ -508,21 +508,10 @@ std::string postgis_datasource::sql_bbox(box2d<double> const& env) const
{
std::ostringstream b;
b.precision(16);
if (srid_ > 0)
{
b << "ST_SetSRID(";
}
b << "'BOX3D(";
b << env.minx() << " " << env.miny() << ",";
b << env.maxx() << " " << env.maxy() << ")'::box3d";
if (srid_ > 0)
{
b << ", " << srid_ << ")";
}
b << "ST_MakeEnvelope(";
b << env.minx() << "," << env.miny() << ",";
b << env.maxx() << "," << env.maxy() << ",";
b << std::max(srid_, 0) << ")";
return b.str();
}