mirror of
https://github.com/felt/tippecanoe.git
synced 2026-11-24 17:31:19 +01:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20eb9c8dae | ||
|
|
523ca55243 | ||
|
|
605640e138 | ||
|
|
5bd46e7ed5 |
+15
-2
@@ -1,8 +1,21 @@
|
||||
* Take feature ordering into account when dropping points in the low zooms
|
||||
# 2.26.1
|
||||
|
||||
* Avoid crashing if there is a polygon ring with only one point
|
||||
|
||||
# 2.26.0
|
||||
|
||||
* Fix bugs in --no-simplification-of-shared-nodes
|
||||
* Updated dockerfile (jtmiclat)
|
||||
* Set build options to use C++-17 (james2432)
|
||||
* Use std::fpclassify instead of plain fpclassify (james)
|
||||
* Fix pmtiles warnings (bdon)
|
||||
|
||||
# 2.25.0
|
||||
|
||||
* Add `--include`/`-y` option to tile-join
|
||||
|
||||
# 2.24.0
|
||||
|
||||
>>>>>>> main
|
||||
* Add --cluster-maxzoom option to limit zoom levels that receive clustering
|
||||
* Add `point_count_abbreviated` attribute to clustered features, for consistency with supercluster
|
||||
* Makefile changes to support FreeBSD
|
||||
|
||||
+12
-11
@@ -1,19 +1,20 @@
|
||||
# Start from ubuntu
|
||||
FROM ubuntu:16.04
|
||||
FROM ubuntu:22.04 AS tippacanoe-builder
|
||||
|
||||
# Update repos and install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get -y upgrade \
|
||||
&& apt-get -y install build-essential libsqlite3-dev zlib1g-dev
|
||||
|
||||
# Create a directory and copy in all files
|
||||
RUN mkdir -p /tmp/tippecanoe-src
|
||||
WORKDIR /tmp/tippecanoe-src
|
||||
COPY . /tmp/tippecanoe-src
|
||||
WORKDIR /tmp/tippecanoe-src
|
||||
|
||||
# Build tippecanoe
|
||||
RUN make \
|
||||
&& make install
|
||||
RUN make
|
||||
|
||||
# Run the tests
|
||||
CMD make test
|
||||
|
||||
# Using multistage build reduces the docker image size by alot by only copying the needed binaries
|
||||
FROM ubuntu:22.04
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install libsqlite3-dev zlib1g-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=tippacanoe-builder /tmp/tippecanoe-src/tippecanoe* /usr/local/bin/
|
||||
COPY --from=tippacanoe-builder /tmp/tippecanoe-src/tile-join /usr/local/bin/
|
||||
WORKDIR /app
|
||||
|
||||
@@ -784,8 +784,9 @@ The options are:
|
||||
|
||||
### Filtering features and feature attributes
|
||||
|
||||
* `-x` *key* or `--exclude=`*key*: Remove attributes of type *key* from the output. You can use this to remove the field you are matching against if you no longer need it after joining, or to remove any other attributes you don't want.
|
||||
* `-x` *key* or `--exclude=`*key*: Remove attributes named *key* from the output. You can use this to remove the field you are matching against if you no longer need it after joining, or to remove any other attributes you don't want. You can use multiple `-x` options to remove multiple attributes.
|
||||
* `-X` or `--exclude-all`: Remove all attributes from the output.
|
||||
* `-y` *key* or `--include=`*key*: Remove all attributes except for those named *key* from the output. You can use multiple `-y` options to retain multiple attributes.
|
||||
* `-i` or `--if-matched`: Only include features that matched the CSV.
|
||||
* `-j` *filter* or `--feature-filter`=*filter*: Check features against a per-layer filter (as defined in the [Mapbox GL Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/#other-filter)) and only include those that match. Any features in layers that have no filter specified will be passed through. Filters for the layer `"*"` apply to all layers.
|
||||
* `-J` *filter-file* or `--feature-filter-file`=*filter-file*: Like `-j`, but read the filter from a file.
|
||||
|
||||
@@ -933,6 +933,8 @@ drawvec simplify_lines(drawvec &geom, int z, int detail, bool mark_tile_bounds,
|
||||
geom[i].necessary = 1;
|
||||
} else if (geom[i].op == VT_LINETO) {
|
||||
geom[i].necessary = 0;
|
||||
// if this is actually the endpoint, not an intermediate point,
|
||||
// it will be marked as necessary below
|
||||
} else {
|
||||
geom[i].necessary = 1;
|
||||
}
|
||||
@@ -1047,6 +1049,16 @@ drawvec fix_polygon(drawvec &geom) {
|
||||
}
|
||||
}
|
||||
|
||||
// A polygon ring must contain at least three points
|
||||
// (and really should contain four). If this one does
|
||||
// not have enough, avoid a division by zero trying to
|
||||
// calculate the centroid below.
|
||||
if (j - i < 3) {
|
||||
i = j - 1;
|
||||
outer = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Make a temporary copy of the ring.
|
||||
// Close it if it isn't closed.
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <map>
|
||||
#include <cmath>
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/param.h>
|
||||
@@ -3521,7 +3521,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
long long file_bbox[4] = {UINT_MAX, UINT_MAX, 0, 0};
|
||||
|
||||
long long file_bbox1[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0, 0}; // standard -180 to 180 world plane
|
||||
long long file_bbox1[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0, 0}; // standard -180 to 180 world plane
|
||||
long long file_bbox2[4] = {0x1FFFFFFFF, 0xFFFFFFFF, 0x100000000, 0}; // 0 to 360 world plane
|
||||
|
||||
auto input_ret = read_input(sources, name ? name : out_mbtiles ? out_mbtiles
|
||||
|
||||
+3
-1
@@ -992,10 +992,12 @@ The options are:
|
||||
.SS Filtering features and feature attributes
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-x\fR \fIkey\fP or \fB\fC\-\-exclude=\fR\fIkey\fP: Remove attributes of type \fIkey\fP from the output. You can use this to remove the field you are matching against if you no longer need it after joining, or to remove any other attributes you don't want.
|
||||
\fB\fC\-x\fR \fIkey\fP or \fB\fC\-\-exclude=\fR\fIkey\fP: Remove attributes named \fIkey\fP from the output. You can use this to remove the field you are matching against if you no longer need it after joining, or to remove any other attributes you don't want. You can use multiple \fB\fC\-x\fR options to remove multiple attributes.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-X\fR or \fB\fC\-\-exclude\-all\fR: Remove all attributes from the output.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-y\fR \fIkey\fP or \fB\fC\-\-include=\fR\fIkey\fP: Remove all attributes except for those named \fIkey\fP from the output. You can use multiple \fB\fC\-y\fR options to retain multiple attributes.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-i\fR or \fB\fC\-\-if\-matched\fR: Only include features that matched the CSV.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-j\fR \fIfilter\fP or \fB\fC\-\-feature\-filter\fR=\fIfilter\fP: Check features against a per\-layer filter (as defined in the Mapbox GL Style Specification \[la]https://docs.mapbox.com/mapbox-gl-js/style-spec/#other-filter\[ra]) and only include those that match. Any features in layers that have no filter specified will be passed through. Filters for the layer \fB\fC"*"\fR apply to all layers.
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ struct reader {
|
||||
|
||||
long long file_bbox[4] = {0, 0, 0, 0};
|
||||
|
||||
long long file_bbox1[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0, 0}; // standard -180 to 180 world plane
|
||||
long long file_bbox1[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0, 0}; // standard -180 to 180 world plane
|
||||
long long file_bbox2[4] = {0x1FFFFFFFF, 0xFFFFFFFF, 0x100000000, 0}; // 0 to 360 world plane
|
||||
|
||||
struct stat geomst {};
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{ "type": "Feature", "properties": { "LINEARID": "11074706697", "FULLNAME": "Fishers Pointe Blvd", "RTTYP": "M", "MTFCC": "S1400" }, "geometry": { "type": "LineString", "coordinates": [ [ -86.0174959, 39.951407 ], [ -86.0174409, 39.951459 ], [ -86.0173849, 39.951489 ], [ -86.0173059, 39.95151 ], [ -86.0172479, 39.951512 ], [ -86.0171679, 39.951503 ], [ -86.0171439, 39.951492 ], [ -86.0170519, 39.951437 ], [ -86.0170169, 39.951391 ], [ -86.0169949, 39.95133 ], [ -86.0169909, 39.951284 ], [ -86.0170079, 39.95123 ], [ -86.0170479, 39.951177 ], [ -86.0170959, 39.951141 ], [ -86.0171229, 39.95113 ] ] } }
|
||||
{ "type": "Feature", "properties": { "LINEARID": "11074705426", "FULLNAME": "Fountainview Ln", "RTTYP": "M", "MTFCC": "S1400" }, "geometry": { "type": "LineString", "coordinates": [ [ -86.0174659, 39.954021 ], [ -86.0175089, 39.953939 ], [ -86.0175239, 39.953883 ], [ -86.0175299, 39.953807 ], [ -86.0175309, 39.953668 ], [ -86.0175259, 39.953265 ], [ -86.0175179, 39.953216 ], [ -86.0175009, 39.953166 ], [ -86.0174579, 39.953088 ], [ -86.0174149, 39.95304 ], [ -86.0173559, 39.952988 ], [ -86.0172939, 39.952953 ], [ -86.0170609, 39.952854 ], [ -86.0166669, 39.952699 ], [ -86.0165839, 39.952646 ], [ -86.0165439, 39.952598 ], [ -86.0165239, 39.952538 ], [ -86.0165139, 39.952467 ], [ -86.0165269, 39.952399 ], [ -86.0165629, 39.952339 ], [ -86.0171439, 39.951492 ] ] } }
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "-86.017531,39.951130,-86.016514,39.954021",
|
||||
"bounds": "-86.017531,39.951130,-86.016514,39.954021",
|
||||
"center": "-86.017531,39.954021,11",
|
||||
"description": "tests/intersection/out/-Z11_-z11_--extra-detail_13_--no-simplification-of-shared-nodes.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/intersection/out/-Z11_-z11_--extra-detail_13_--no-simplification-of-shared-nodes.json.check.mbtiles -Z11 -z11 --extra-detail 13 --no-simplification-of-shared-nodes tests/intersection/in.json",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":11,\"maxzoom\":11,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":2,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":2,\"type\":\"string\",\"values\":[\"Fishers Pointe Blvd\",\"Fountainview Ln\"]},{\"attribute\":\"LINEARID\",\"count\":2,\"type\":\"string\",\"values\":[\"11074705426\",\"11074706697\"]},{\"attribute\":\"MTFCC\",\"count\":1,\"type\":\"string\",\"values\":[\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":1,\"type\":\"string\",\"values\":[\"M\"]}]}]}}",
|
||||
"maxzoom": "11",
|
||||
"minzoom": "11",
|
||||
"name": "tests/intersection/out/-Z11_-z11_--extra-detail_13_--no-simplification-of-shared-nodes.json.check.mbtiles",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 534, "y": 775 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 8192 }, "features": [
|
||||
{ "type": "Feature", "properties": { "LINEARID": "11074705426", "FULLNAME": "Fountainview Ln", "RTTYP": "M", "MTFCC": "S1400" }, "geometry": { "type": "LineString", "coordinates": [ [ -86.017456, 39.954014 ], [ -86.017520, 39.953668 ], [ -86.017520, 39.953257 ], [ -86.017456, 39.953093 ], [ -86.017284, 39.952961 ], [ -86.016576, 39.952648 ], [ -86.016512, 39.952468 ], [ -86.017134, 39.951497 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "LINEARID": "11074706697", "FULLNAME": "Fishers Pointe Blvd", "RTTYP": "M", "MTFCC": "S1400" }, "geometry": { "type": "LineString", "coordinates": [ [ -86.017499, 39.951415 ], [ -86.017306, 39.951513 ], [ -86.017134, 39.951497 ], [ -86.017027, 39.951398 ], [ -86.016984, 39.951283 ], [ -86.017113, 39.951135 ] ] } }
|
||||
] }
|
||||
] }
|
||||
] }
|
||||
File diff suppressed because it is too large
Load Diff
+20
-13
@@ -76,7 +76,7 @@ void aprintf(std::string *buf, const char *format, ...) {
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::string, layermap_entry> &layermap, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping, std::set<std::string> &exclude, std::set<std::string> &keep_layers, std::set<std::string> &remove_layers, int ifmatched, mvt_tile &outtile, json_object *filter) {
|
||||
void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::string, layermap_entry> &layermap, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping, std::set<std::string> &exclude, std::set<std::string> &include, std::set<std::string> &keep_layers, std::set<std::string> &remove_layers, int ifmatched, mvt_tile &outtile, json_object *filter) {
|
||||
mvt_tile tile;
|
||||
int features_added = 0;
|
||||
bool was_compressed;
|
||||
@@ -225,7 +225,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!exclude_all && exclude.count(std::string(key)) == 0 && exclude_attributes.count(std::string(key)) == 0) {
|
||||
if (include.count(std::string(key)) || (!exclude_all && exclude.count(std::string(key)) == 0 && exclude_attributes.count(std::string(key)) == 0)) {
|
||||
type_and_string tas;
|
||||
tas.type = type;
|
||||
tas.string = value;
|
||||
@@ -258,7 +258,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
|
||||
|
||||
const char *sjoinkey = joinkey.c_str();
|
||||
|
||||
if (!exclude_all && exclude.count(joinkey) == 0 && exclude_attributes.count(joinkey) == 0 && attr_type != mvt_null) {
|
||||
if (include.count(joinkey) || (!exclude_all && exclude.count(joinkey) == 0 && exclude_attributes.count(joinkey) == 0 && attr_type != mvt_null)) {
|
||||
mvt_value outval;
|
||||
if (attr_type == mvt_string) {
|
||||
outval.type = mvt_string;
|
||||
@@ -512,6 +512,7 @@ struct arg {
|
||||
std::vector<std::string> *header = NULL;
|
||||
std::map<std::string, std::vector<std::string>> *mapping = NULL;
|
||||
std::set<std::string> *exclude = NULL;
|
||||
std::set<std::string> *include = NULL;
|
||||
std::set<std::string> *keep_layers = NULL;
|
||||
std::set<std::string> *remove_layers = NULL;
|
||||
int ifmatched = 0;
|
||||
@@ -525,7 +526,7 @@ void *join_worker(void *v) {
|
||||
mvt_tile tile;
|
||||
|
||||
for (size_t i = 0; i < ai->second.size(); i++) {
|
||||
handle(ai->second[i], ai->first.z, ai->first.x, ai->first.y, *(a->layermap), *(a->header), *(a->mapping), *(a->exclude), *(a->keep_layers), *(a->remove_layers), a->ifmatched, tile, a->filter);
|
||||
handle(ai->second[i], ai->first.z, ai->first.x, ai->first.y, *(a->layermap), *(a->header), *(a->mapping), *(a->exclude), *(a->include), *(a->keep_layers), *(a->remove_layers), a->ifmatched, tile, a->filter);
|
||||
}
|
||||
|
||||
ai->second.clear();
|
||||
@@ -560,7 +561,7 @@ void *join_worker(void *v) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void handle_tasks(std::map<zxy, std::vector<std::string>> &tasks, std::vector<std::map<std::string, layermap_entry>> &layermaps, sqlite3 *outdb, const char *outdir, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping, std::set<std::string> &exclude, int ifmatched, std::set<std::string> &keep_layers, std::set<std::string> &remove_layers, json_object *filter) {
|
||||
void handle_tasks(std::map<zxy, std::vector<std::string>> &tasks, std::vector<std::map<std::string, layermap_entry>> &layermaps, sqlite3 *outdb, const char *outdir, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping, std::set<std::string> &exclude, std::set<std::string> &include, int ifmatched, std::set<std::string> &keep_layers, std::set<std::string> &remove_layers, json_object *filter) {
|
||||
pthread_t pthreads[CPUS];
|
||||
std::vector<arg> args;
|
||||
|
||||
@@ -571,6 +572,7 @@ void handle_tasks(std::map<zxy, std::vector<std::string>> &tasks, std::vector<st
|
||||
args[i].header = &header;
|
||||
args[i].mapping = &mapping;
|
||||
args[i].exclude = &exclude;
|
||||
args[i].include = &include;
|
||||
args[i].keep_layers = &keep_layers;
|
||||
args[i].remove_layers = &remove_layers;
|
||||
args[i].ifmatched = ifmatched;
|
||||
@@ -706,7 +708,7 @@ void handle_vector_layers(json_object *vector_layers, std::map<std::string, laye
|
||||
}
|
||||
}
|
||||
|
||||
void decode(struct reader *readers, std::map<std::string, layermap_entry> &layermap, sqlite3 *outdb, const char *outdir, struct stats *st, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping, std::set<std::string> &exclude, int ifmatched, std::string &attribution, std::string &description, std::set<std::string> &keep_layers, std::set<std::string> &remove_layers, std::string &name, json_object *filter, std::map<std::string, std::string> &attribute_descriptions, std::string &generator_options, std::vector<strategy> *strategies) {
|
||||
void decode(struct reader *readers, std::map<std::string, layermap_entry> &layermap, sqlite3 *outdb, const char *outdir, struct stats *st, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping, std::set<std::string> &exclude, std::set<std::string> &include, int ifmatched, std::string &attribution, std::string &description, std::set<std::string> &keep_layers, std::set<std::string> &remove_layers, std::string &name, json_object *filter, std::map<std::string, std::string> &attribute_descriptions, std::string &generator_options, std::vector<strategy> *strategies) {
|
||||
std::vector<std::map<std::string, layermap_entry>> layermaps;
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
layermaps.push_back(std::map<std::string, layermap_entry>());
|
||||
@@ -761,7 +763,7 @@ void decode(struct reader *readers, std::map<std::string, layermap_entry> &layer
|
||||
|
||||
if (readers == NULL || readers->zoom != r->zoom || readers->x != r->x || readers->y != r->y) {
|
||||
if (tasks.size() > 100 * CPUS) {
|
||||
handle_tasks(tasks, layermaps, outdb, outdir, header, mapping, exclude, ifmatched, keep_layers, remove_layers, filter);
|
||||
handle_tasks(tasks, layermaps, outdb, outdir, header, mapping, exclude, include, ifmatched, keep_layers, remove_layers, filter);
|
||||
tasks.clear();
|
||||
}
|
||||
}
|
||||
@@ -827,7 +829,7 @@ void decode(struct reader *readers, std::map<std::string, layermap_entry> &layer
|
||||
st->minlat2 = min(minlat, st->minlat2);
|
||||
st->maxlat2 = max(maxlat, st->maxlat2);
|
||||
|
||||
handle_tasks(tasks, layermaps, outdb, outdir, header, mapping, exclude, ifmatched, keep_layers, remove_layers, filter);
|
||||
handle_tasks(tasks, layermaps, outdb, outdir, header, mapping, exclude, include, ifmatched, keep_layers, remove_layers, filter);
|
||||
layermap = merge_layermaps(layermaps);
|
||||
|
||||
struct reader *next;
|
||||
@@ -974,7 +976,7 @@ void decode(struct reader *readers, std::map<std::string, layermap_entry> &layer
|
||||
}
|
||||
|
||||
void usage(char **argv) {
|
||||
fprintf(stderr, "Usage: %s [-f] [-i] [-pk] [-pC] [-c joins.csv] [-X] [-x exclude ...] [-r inputfile.txt ] -o new.mbtiles source.mbtiles ...\n", argv[0]);
|
||||
fprintf(stderr, "Usage: %s [-f] [-i] [-pk] [-pC] [-c joins.csv] [-X] [-x exclude ...] [-y include ...] [-r inputfile.txt ] -o new.mbtiles source.mbtiles ...\n", argv[0]);
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
|
||||
@@ -1004,6 +1006,7 @@ int main(int argc, char **argv) {
|
||||
std::map<std::string, std::vector<std::string>> mapping;
|
||||
|
||||
std::set<std::string> exclude;
|
||||
std::set<std::string> include;
|
||||
std::set<std::string> keep_layers;
|
||||
std::set<std::string> remove_layers;
|
||||
|
||||
@@ -1021,6 +1024,7 @@ int main(int argc, char **argv) {
|
||||
{"csv", required_argument, 0, 'c'},
|
||||
{"exclude", required_argument, 0, 'x'},
|
||||
{"exclude-all", no_argument, 0, 'X'},
|
||||
{"include", required_argument, 0, 'y'},
|
||||
{"layer", required_argument, 0, 'l'},
|
||||
{"exclude-layer", required_argument, 0, 'L'},
|
||||
{"quiet", no_argument, 0, 'q'},
|
||||
@@ -1142,6 +1146,11 @@ int main(int argc, char **argv) {
|
||||
exclude_all = true;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
exclude_all = true;
|
||||
include.insert(std::string(optarg));
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
keep_layers.insert(std::string(optarg));
|
||||
break;
|
||||
@@ -1169,7 +1178,7 @@ int main(int argc, char **argv) {
|
||||
std::string sa;
|
||||
filearg = 1;
|
||||
while (getline(read_file, sa)) {
|
||||
char* c = const_cast<char*>(sa.c_str());
|
||||
char *c = const_cast<char *>(sa.c_str());
|
||||
reader *r = begin_reading(c);
|
||||
struct reader **rr;
|
||||
for (rr = &readers; *rr != NULL; rr = &((*rr)->next)) {
|
||||
@@ -1182,7 +1191,6 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
read_file.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case 'q':
|
||||
@@ -1253,7 +1261,6 @@ int main(int argc, char **argv) {
|
||||
std::string description;
|
||||
std::string name;
|
||||
|
||||
|
||||
if (filearg == 0) {
|
||||
for (i = optind; i < argc; i++) {
|
||||
reader *r = begin_reading(argv[i]);
|
||||
@@ -1274,7 +1281,7 @@ int main(int argc, char **argv) {
|
||||
std::string generator_options;
|
||||
std::vector<strategy> strategies;
|
||||
|
||||
decode(readers, layermap, outdb, out_dir, &st, header, mapping, exclude, ifmatched, attribution, description, keep_layers, remove_layers, name, filter, attribute_descriptions, generator_options, &strategies);
|
||||
decode(readers, layermap, outdb, out_dir, &st, header, mapping, exclude, include, ifmatched, attribution, description, keep_layers, remove_layers, name, filter, attribute_descriptions, generator_options, &strategies);
|
||||
|
||||
if (set_attribution.size() != 0) {
|
||||
attribution = set_attribution;
|
||||
|
||||
@@ -323,14 +323,6 @@ struct ordercmp {
|
||||
}
|
||||
}
|
||||
|
||||
if (prevent[P_INPUT_ORDER]) {
|
||||
if (a.original_seq < b.original_seq) {
|
||||
return true;
|
||||
} else if (a.original_seq > b.original_seq) {
|
||||
return false;
|
||||
} // else they are equal, so continue to the index
|
||||
}
|
||||
|
||||
if (a.index < b.index) {
|
||||
return true;
|
||||
}
|
||||
@@ -482,37 +474,6 @@ struct partial {
|
||||
long long clustered = 0;
|
||||
std::set<std::string> need_tilestats;
|
||||
std::map<std::string, accum_state> attribute_accum_state;
|
||||
|
||||
partial(serial_feature &sf, int z_, int tx_, int ty_, int line_detail_, int maxzoom_, double simplification_) {
|
||||
geoms.clear();
|
||||
geoms.push_back(sf.geometry);
|
||||
|
||||
layer = sf.layer;
|
||||
t = sf.t;
|
||||
segment = sf.segment;
|
||||
original_seq = sf.seq;
|
||||
keys = sf.keys;
|
||||
values = sf.values;
|
||||
full_keys = sf.full_keys;
|
||||
full_values = sf.full_values;
|
||||
id = sf.id;
|
||||
has_id = sf.has_id;
|
||||
index = sf.index;
|
||||
label_point = sf.label_point;
|
||||
extent = sf.extent;
|
||||
|
||||
z = z_;
|
||||
tx = tx_;
|
||||
ty = ty_;
|
||||
line_detail = line_detail_;
|
||||
extra_detail = line_detail_;
|
||||
maxzoom = maxzoom_;
|
||||
simplification = simplification_;
|
||||
|
||||
coalesced = false;
|
||||
renamed = -1;
|
||||
clustered = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct partial_arg {
|
||||
@@ -522,105 +483,6 @@ struct partial_arg {
|
||||
drawvec *shared_nodes;
|
||||
};
|
||||
|
||||
// THIS IS RIDICULOUS to have three almost-identical representations for features. FIX FIX FIX
|
||||
|
||||
static mvt_value find_attribute_value(const serial_feature *c1, std::string key, const char *stringpool, long long pool_off[]) {
|
||||
if (key == ORDER_BY_SIZE) {
|
||||
mvt_value v;
|
||||
v.type = mvt_double;
|
||||
v.numeric_value.double_value = c1->extent;
|
||||
return v;
|
||||
}
|
||||
|
||||
const std::vector<long long> &keys1 = c1->keys;
|
||||
const std::vector<long long> &values1 = c1->values;
|
||||
const char *stringpool1 = stringpool + pool_off[c1->segment];
|
||||
|
||||
for (size_t i = 0; i < keys1.size(); i++) {
|
||||
mvt_value key1 = retrieve_string(keys1[i], stringpool1, NULL);
|
||||
if (key == key1.string_value) {
|
||||
return retrieve_string(values1[i], stringpool1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < c1->full_keys.size(); i++) {
|
||||
if (c1->full_keys[i] == key) {
|
||||
return stringified_to_mvt_value(c1->full_values[i].type, c1->full_values[i].s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
mvt_value v;
|
||||
v.type = mvt_null;
|
||||
v.numeric_value.null_value = 0;
|
||||
return v;
|
||||
}
|
||||
|
||||
static mvt_value find_attribute_value(const partial *c1, std::string key, const char *stringpool, long long pool_off[]) {
|
||||
if (key == ORDER_BY_SIZE) {
|
||||
mvt_value v;
|
||||
v.type = mvt_double;
|
||||
v.numeric_value.double_value = c1->extent;
|
||||
return v;
|
||||
}
|
||||
|
||||
const std::vector<long long> &keys1 = c1->keys;
|
||||
const std::vector<long long> &values1 = c1->values;
|
||||
const char *stringpool1 = stringpool + pool_off[c1->segment];
|
||||
|
||||
for (size_t i = 0; i < keys1.size(); i++) {
|
||||
mvt_value key1 = retrieve_string(keys1[i], stringpool1, NULL);
|
||||
if (key == key1.string_value) {
|
||||
return retrieve_string(values1[i], stringpool1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < c1->full_keys.size(); i++) {
|
||||
if (c1->full_keys[i] == key) {
|
||||
return stringified_to_mvt_value(c1->full_values[i].type, c1->full_values[i].s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
mvt_value v;
|
||||
v.type = mvt_null;
|
||||
v.numeric_value.null_value = 0;
|
||||
return v;
|
||||
}
|
||||
|
||||
static bool order_partials(const char *stringpool, long long pool_off[], const serial_feature &a, const partial &b) {
|
||||
for (size_t i = 0; i < order_by.size(); i++) {
|
||||
mvt_value v1 = coerce_double(find_attribute_value(&a, order_by[i].name, stringpool, pool_off));
|
||||
mvt_value v2 = coerce_double(find_attribute_value(&b, order_by[i].name, stringpool, pool_off));
|
||||
|
||||
if (order_by[i].descending) {
|
||||
if (v2 < v1) {
|
||||
return true;
|
||||
} else if (v1 < v2) {
|
||||
return false;
|
||||
} // else they are equal, so continue to the next attribute
|
||||
} else {
|
||||
if (v1 < v2) {
|
||||
return true;
|
||||
} else if (v2 < v1) {
|
||||
return false;
|
||||
} // else they are equal, so continue to the next attribute
|
||||
}
|
||||
}
|
||||
|
||||
if (prevent[P_INPUT_ORDER]) {
|
||||
if (a.seq < b.original_seq) {
|
||||
return true;
|
||||
} else if (a.seq > b.original_seq) {
|
||||
return false;
|
||||
} // else they are equal, so continue to the index
|
||||
}
|
||||
|
||||
if (a.index < b.index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; // greater than or equal
|
||||
}
|
||||
|
||||
drawvec revive_polygon(drawvec &geom, double area, int z, int detail) {
|
||||
// From area in world coordinates to area in tile coordinates
|
||||
long long divisor = 1LL << (32 - detail - z);
|
||||
@@ -692,7 +554,11 @@ double simplify_partial(partial *p, drawvec &shared_nodes) {
|
||||
// Only matters if simplification is set higher than the tiny polygon size.
|
||||
// Tiny polygons that are part of a tiny multipolygon will still get simplified.
|
||||
if (!p->reduced) {
|
||||
if (t == VT_LINE) {
|
||||
// These aren't necessarily actually no-ops until we scale down.
|
||||
// Don't do it if we are trying to preserve intersections, because
|
||||
// it might wipe out the intersection and spoil the matching even though
|
||||
// it would leave something else within the same tile pixel.
|
||||
if (t == VT_LINE && !prevent[P_SIMPLIFY_SHARED_NODES]) {
|
||||
// continues to deduplicate to line_detail even if we have extra detail
|
||||
geom = remove_noop(geom, t, 32 - z - line_detail);
|
||||
}
|
||||
@@ -2204,15 +2070,6 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
|
||||
if (sf.dropped) {
|
||||
if (find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
|
||||
// would it have been better to drop this other feature instead?
|
||||
|
||||
if (order_by.size() > 0) {
|
||||
if (order_partials(stringpool, pool_off, sf, partials[which_partial])) {
|
||||
partials[which_partial] = partial(sf, z, tx, ty, line_detail, maxzoom, simplification);
|
||||
// XXX preserve_attributes
|
||||
}
|
||||
}
|
||||
|
||||
preserve_attributes(arg->attribute_accum, sf, stringpool, pool_off, partials[which_partial]);
|
||||
strategy->dropped_by_rate++;
|
||||
continue;
|
||||
@@ -2359,10 +2216,33 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
}
|
||||
}
|
||||
|
||||
partial p(sf, z, tx, ty, line_detail, maxzoom, simplification);
|
||||
|
||||
partial p;
|
||||
p.geoms.push_back(sf.geometry);
|
||||
p.layer = sf.layer;
|
||||
p.t = sf.t;
|
||||
p.segment = sf.segment;
|
||||
p.original_seq = sf.seq;
|
||||
p.reduced = reduced;
|
||||
p.coalesced = false;
|
||||
p.z = z;
|
||||
p.tx = tx;
|
||||
p.ty = ty;
|
||||
p.line_detail = line_detail;
|
||||
p.extra_detail = line_detail;
|
||||
p.maxzoom = maxzoom;
|
||||
p.keys = sf.keys;
|
||||
p.values = sf.values;
|
||||
p.full_keys = sf.full_keys;
|
||||
p.full_values = sf.full_values;
|
||||
p.spacing = spacing;
|
||||
p.simplification = simplification;
|
||||
p.id = sf.id;
|
||||
p.has_id = sf.has_id;
|
||||
p.index = sf.index;
|
||||
p.label_point = sf.label_point;
|
||||
p.renamed = -1;
|
||||
p.extent = sf.extent;
|
||||
p.clustered = 0;
|
||||
|
||||
if (line_detail == detail && extra_detail >= 0 && z == maxzoom) {
|
||||
p.extra_detail = extra_detail;
|
||||
@@ -2377,7 +2257,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
partials.push_back(p);
|
||||
|
||||
unsimplified_geometry_size += sf.geometry.size() * sizeof(draw);
|
||||
if (unsimplified_geometry_size > 10 * 1024 * 1024 && !additional[A_DETECT_SHARED_BORDERS]) {
|
||||
if (unsimplified_geometry_size > 10 * 1024 * 1024 && !additional[A_DETECT_SHARED_BORDERS] && !prevent[P_SIMPLIFY_SHARED_NODES]) {
|
||||
drawvec dv;
|
||||
|
||||
for (; simplified_geometry_through < partials.size(); simplified_geometry_through++) {
|
||||
@@ -2408,7 +2288,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
just_shared_nodes.push_back(shared_nodes[i]);
|
||||
|
||||
draw d = shared_nodes[i];
|
||||
i++;
|
||||
i++; // consume the first, point at the duplicate
|
||||
while (i + 1 < shared_nodes.size() && shared_nodes[i + 1] == d) {
|
||||
i++;
|
||||
}
|
||||
@@ -2425,7 +2305,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
std::string layername = (*layer_unmaps)[p.segment][p.layer];
|
||||
serial_val sv, sv2, sv3, sv4;
|
||||
long long point_count = p.clustered + 1;
|
||||
char abbrev[17]; // to_string(LLONG_MAX).length() / 1000 + 1;
|
||||
char abbrev[17]; // to_string(LLONG_MAX).length() / 1000 + 1;
|
||||
|
||||
p.full_keys.push_back("clustered");
|
||||
sv.type = mvt_bool;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v2.24.0"
|
||||
#define VERSION "v2.26.1"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user