mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 16:35:40 +02:00
* Add an option to retain N times as many points as usual at each zoom * Tests for point multipler with specified and guessed maxzooms * Work in progress on inverse spatial ordering * Fix inverse spatial feature order * --reorder was depending on a feature index that wasn't being preserved * Separate ordering by feature_minzoom from ordering inverse-spatially * Add a test for the inverse spatial ordering * Store the basezoom/droprate/multiplier decisions in tileset metadata * Progress on adding filters to tippecanoe-overzoom * Type promotion for comparison * Look up the attribute value for ordering * Add test of thinning and ordering features * Plumb tippecanoe_decisions metadata through pmtiles * Be careful not to put infinities in JSON * Fix accidental dropping in what is meant to preserve sparse points * Start distinguishing true, false, and null in expressions * Most of the type conversions * Add boolean conversions * Literals and conjunctions * Add filtering to tippecanoe-overzoom * Add a test of filtering in overzoom * Fix boolean conjunctions * Handle the combination of cluster size and filtering * Rework dot dropping to reconcile density threshold and multiplier * Revert "Rework dot dropping to reconcile density threshold and multiplier" This reverts commitf253a66382. * Retain points by multiplier within each tile, not in global probability * Test that intends to verify that the multiplier is reversible * Get the test to detect the discrepancy * Mark the start of multiplier clusters with a magic attribute * Add string-contains * Add in and ni operators * Revert "Look up the attribute value for ordering" This reverts commit56bc73e49a. * Revert "Type promotion for comparison" This reverts commit6f3256f5af. * Make number formatting in tippecanoe_decisions consistent * Revert "Add a test for the inverse spatial ordering" This reverts commitc8047de9ab. * Revert "Separate ordering by feature_minzoom from ordering inverse-spatially" This reverts commit35b19a223c. * Revert "Fix inverse spatial feature order" This reverts commit5978ecdb44. * Revert "Work in progress on inverse spatial ordering" This reverts commitfdf230f632. * Somehow missed the tests associated with that last revert * Round-robin assign attributes to partials from across the multiplier * Count the multiplier separately in each layer * Fix distribution of accumulated attribute across multiplier features * Update changelog, version, and docs * Add "is null" and "isnt null" expressions * Update interpretation of FSL expressions to pass the tests * Test to assert that polygons are unaffected by the multiplier * Clean up and comment * Remove accidental unused case
92 lines
2.8 KiB
C++
92 lines
2.8 KiB
C++
#ifndef MBTILES_HPP
|
|
#define MBTILES_HPP
|
|
|
|
#include <math.h>
|
|
#include <map>
|
|
#include "mvt.hpp"
|
|
|
|
extern size_t max_tilestats_attributes;
|
|
extern size_t max_tilestats_sample_values;
|
|
extern size_t max_tilestats_values;
|
|
|
|
struct type_and_string {
|
|
int type = 0;
|
|
std::string string = "";
|
|
|
|
bool operator<(const type_and_string &o) const;
|
|
bool operator!=(const type_and_string &o) const;
|
|
};
|
|
|
|
struct type_and_string_stats {
|
|
std::vector<type_and_string> sample_values = std::vector<type_and_string>(); // sorted
|
|
double min = INFINITY;
|
|
double max = -INFINITY;
|
|
int type = 0;
|
|
};
|
|
|
|
struct layermap_entry {
|
|
size_t id = 0;
|
|
std::map<std::string, type_and_string_stats> file_keys{};
|
|
int minzoom = 0;
|
|
int maxzoom = 0;
|
|
std::string description = "";
|
|
|
|
size_t points = 0;
|
|
size_t lines = 0;
|
|
size_t polygons = 0;
|
|
size_t retain = 0; // keep for tilestats, even if no features directly here
|
|
|
|
layermap_entry(size_t _id) {
|
|
id = _id;
|
|
}
|
|
};
|
|
|
|
struct metadata {
|
|
std::string name;
|
|
std::string description;
|
|
int version;
|
|
std::string type;
|
|
std::string format;
|
|
|
|
int minzoom;
|
|
int maxzoom;
|
|
|
|
double minlat, minlon, maxlat, maxlon;
|
|
double minlat2, minlon2, maxlat2, maxlon2; // antimeridian-aware
|
|
|
|
double center_lon, center_lat;
|
|
int center_z;
|
|
|
|
std::string attribution; // not written if empty
|
|
|
|
std::string generator;
|
|
std::string generator_options;
|
|
|
|
std::string strategies_json; // not written if empty
|
|
|
|
std::string vector_layers_json;
|
|
std::string tilestats_json;
|
|
std::string decisions_json;
|
|
};
|
|
|
|
#include "tile.hpp"
|
|
|
|
sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable);
|
|
|
|
void mbtiles_write_tile(sqlite3 *outdb, int z, int tx, int ty, const char *data, int size);
|
|
void mbtiles_erase_zoom(sqlite3 *outdb, int z);
|
|
|
|
metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double minlat2, double minlon2, double maxlat2, double maxlon2, double midlat, double midlon, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description, bool do_tilestats, std::map<std::string, std::string> const &attribute_descriptions, std::string const &program, std::string const &commandline, std::vector<strategy> const &strategies, int basezoom, double droprate, int retain_points_multiplier);
|
|
void mbtiles_write_metadata(sqlite3 *db, const metadata &m, bool forcetable);
|
|
|
|
void mbtiles_close(sqlite3 *outdb, const char *pgm);
|
|
|
|
std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::string, layermap_entry> > const &maps);
|
|
std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::string, layermap_entry> > const &maps, bool trunc);
|
|
|
|
void add_to_file_keys(std::map<std::string, type_and_string_stats> &file_keys, std::string const &layername, type_and_string const &val);
|
|
|
|
unsigned long long fnv1a(std::string const &s);
|
|
|
|
#endif
|