mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Fix coordinate rounding error in the prefilter
This commit is contained in:
+4
-2
@@ -16,6 +16,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
#include "main.hpp"
|
||||||
#include "mvt.hpp"
|
#include "mvt.hpp"
|
||||||
#include "mbtiles.hpp"
|
#include "mbtiles.hpp"
|
||||||
#include "projection.hpp"
|
#include "projection.hpp"
|
||||||
@@ -321,14 +322,15 @@ serial_feature parse_feature(json_pull *jp, unsigned z, unsigned x, unsigned y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Scale and offset geometry from global to tile
|
// Scale and offset geometry from global to tile
|
||||||
|
double scale = 1LL << geometry_scale;
|
||||||
for (size_t i = 0; i < dv.size(); i++) {
|
for (size_t i = 0; i < dv.size(); i++) {
|
||||||
unsigned sx = 0, sy = 0;
|
unsigned sx = 0, sy = 0;
|
||||||
if (z != 0) {
|
if (z != 0) {
|
||||||
sx = x << (32 - z);
|
sx = x << (32 - z);
|
||||||
sy = y << (32 - z);
|
sy = y << (32 - z);
|
||||||
}
|
}
|
||||||
dv[i].x -= sx;
|
dv[i].x = std::round(dv[i].x / scale) * scale - sx;
|
||||||
dv[i].y -= sy;
|
dv[i].y = std::round(dv[i].y / scale) * scale - sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dv.size() > 0) {
|
if (dv.size() > 0) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user