Fix buffering of query box - it was shrinking in the Y axis, rather than growing.

This commit is contained in:
Daniel Patterson
2016-11-04 16:57:12 -06:00
parent 4c6d6aeaa7
commit af7960a796
3 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ const constexpr std::uint32_t VARIANT_TYPE_BOOL = 7;
// Vector tiles are 4096 virtual pixels on each side
const constexpr double EXTENT = 4096.0;
const constexpr double BUFFER = 512.0;
const constexpr double BUFFER = 128.0;
}
}
}
+10 -5
View File
@@ -140,14 +140,19 @@ inline FloatCoordinate toWGS84(const FloatCoordinate &mercator_coordinate)
}
// Converts a WMS tile coordinate (z,x,y) into a wgs bounding box
inline void xyzToWGS84(
const int x, const int y, const int z, double &minx, double &miny, double &maxx, double &maxy,
int mercator_buffer = 0)
inline void xyzToWGS84(const int x,
const int y,
const int z,
double &minx,
double &miny,
double &maxx,
double &maxy,
int mercator_buffer = 0)
{
minx = x * TILE_SIZE - mercator_buffer;
miny = (y + 1.0) * TILE_SIZE - mercator_buffer;
miny = (y + 1.0) * TILE_SIZE + mercator_buffer;
maxx = (x + 1.0) * TILE_SIZE + mercator_buffer;
maxy = y * TILE_SIZE + mercator_buffer;
maxy = y * TILE_SIZE - mercator_buffer;
// 2^z * TILE_SIZE
const double shift = (1u << static_cast<unsigned>(z)) * TILE_SIZE;
pixelToDegree(shift, minx, miny);