mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Work in progress on binning features in overzoom (#258)
* Factoring out tilestats management from GeoJSON file reading * Move code around so overzoom can link against parse_layers * Read the file of bins * Plumb the bins through to overzoom() * Some zip code bins to test with * (Currently non-functional) test of binning * Starting to spell out the bin matching loop * Can't flatten points, so don't flatten bins either * More fleshing out bin traversal * Bounding box of tile-relative mvt geometry * Smallest enclosing tile from bbox * Most of the bin scan * Add point in polygon check. It crashes. * Find the matching bins * GDAL-style bounding boxes have eaten my brain * Make some features to bin into * Increment a count as features are found to be within the bins * Fix longitude wraparound in overzoom bins * Fix the tests * Push off attribute copying until after bin assignment * Carry sum of numeric attributes into the bins * Also add mean, min, and max * Add --calculate-feature-index since I keep needing it for testing * Add an option to accumulate sum/mean/max/min/count of all numeric attrs * Don't bake in tippecanoe:mean, since we redo it from sum and count * Forgot to update this test fixture after removing tiled mean * Update version and changelog
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
#include "text.hpp"
|
||||
#include "sort.hpp"
|
||||
#include "tile-cache.hpp"
|
||||
#include "mvt.hpp"
|
||||
#include "projection.hpp"
|
||||
#include "geometry.hpp"
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
@@ -124,3 +127,28 @@ TEST_CASE("Bit reversal", "bit reversal") {
|
||||
REQUIRE(bit_reverse(0x1234567812489BCF) == 0xF3D912481E6A2C48);
|
||||
REQUIRE(bit_reverse(0xF3D912481E6A2C48) == 0x1234567812489BCF);
|
||||
}
|
||||
|
||||
TEST_CASE("mvt_geometry bbox") {
|
||||
std::vector<mvt_geometry> geom;
|
||||
|
||||
geom.emplace_back(mvt_moveto, 128, 128);
|
||||
geom.emplace_back(mvt_lineto, 256, 256);
|
||||
|
||||
long long xmin, ymin, xmax, ymax;
|
||||
get_bbox(geom, &xmin, &ymin, &xmax, &ymax, 11, 327, 791, 9);
|
||||
|
||||
double lon, lat;
|
||||
tile2lonlat(xmin, ymin, 32, &lon, &lat);
|
||||
REQUIRE(std::to_string(lon) == "-122.475586");
|
||||
REQUIRE(std::to_string(lat) == "37.822802");
|
||||
|
||||
tile2lonlat(xmax, ymax, 32, &lon, &lat);
|
||||
REQUIRE(std::to_string(lon) == "-122.431641");
|
||||
REQUIRE(std::to_string(lat) == "37.788081");
|
||||
|
||||
unsigned long long start, end;
|
||||
get_quadkey_bounds(xmin, ymin, xmax, ymax, &start, &end);
|
||||
// 22 bits in common, for z11
|
||||
REQUIRE(start == 0x1c84fc0000000000);
|
||||
REQUIRE(end == 0x1c84ffffffffffff);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user