mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-22 18:12:40 +00:00
Round coordinates instead of truncating to avoid projection error
This commit is contained in:
parent
679189e5a2
commit
d8fe69a99e
@ -5,6 +5,7 @@
|
||||
#include <map>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <cmath>
|
||||
#include "mvt.hpp"
|
||||
#include "plugin.hpp"
|
||||
#include "projection.hpp"
|
||||
@ -150,8 +151,8 @@ mvt_layer parse_layer(int fd, unsigned z, unsigned x, unsigned y, mvt_layer cons
|
||||
// Scale and offset geometry from global to tile
|
||||
for (size_t i = 0; i < dv.size(); i++) {
|
||||
long long scale = 1LL << (32 - z);
|
||||
dv[i].x = (dv[i].x - scale * x) * olayer.extent / scale;
|
||||
dv[i].y = (dv[i].y - scale * y) * olayer.extent / scale;
|
||||
dv[i].x = std::round((dv[i].x - scale * x) * olayer.extent / (double) scale);
|
||||
dv[i].y = std::round((dv[i].y - scale * y) * olayer.extent / (double) scale);
|
||||
}
|
||||
|
||||
if (mb_geometry[t] == VT_POLYGON) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user