mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-21 12:05:05 +00:00
Add an option to automatically assign ids to features
This commit is contained in:
parent
50b1eadf87
commit
6f295f29fc
@ -1,3 +1,7 @@
|
||||
## 1.30.3
|
||||
|
||||
* Add an option to automatically assign ids to features
|
||||
|
||||
## 1.30.2
|
||||
|
||||
* Don't guess a higher maxzoom than is allowed for manual selection
|
||||
|
@ -303,6 +303,7 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
|
||||
### Adding calculated attributes
|
||||
|
||||
* `-ag` or `--calculate-feature-density`: Add a new attribute, `tippecanoe_feature_density`, to each feature, to record how densely features are spaced in that area of the tile. You can use this attribute in the style to produce a glowing effect where points are densely packed. It can range from 0 in the sparsest areas to 255 in the densest.
|
||||
* `-ai` or `--generate-ids`: Add an `id` (a feature ID, not an attribute named `id`) to each feature that does not already have one. There is currently no guarantee that the `id` added will be stable between runs or that it will not conflict with manually-assigned feature IDs. Future versions of Tippecanoe may change the mechanism for allocating IDs.
|
||||
|
||||
### Trying to correct bad source geometry
|
||||
|
||||
|
1
main.cpp
1
main.cpp
@ -2573,6 +2573,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
{"Adding calculated attributes", 0, 0, 0},
|
||||
{"calculate-feature-density", no_argument, &additional[A_CALCULATE_FEATURE_DENSITY], 1},
|
||||
{"generate-ids", no_argument, &additional[A_GENERATE_IDS], 1},
|
||||
|
||||
{"Trying to correct bad source geometry", 0, 0, 0},
|
||||
{"detect-longitude-wraparound", no_argument, &additional[A_DETECT_WRAPAROUND], 1},
|
||||
|
@ -371,6 +371,8 @@ the line or polygon within one tile unit of its proper location. You can probabl
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-ag\fR or \fB\fC\-\-calculate\-feature\-density\fR: Add a new attribute, \fB\fCtippecanoe_feature_density\fR, to each feature, to record how densely features are spaced in that area of the tile. You can use this attribute in the style to produce a glowing effect where points are densely packed. It can range from 0 in the sparsest areas to 255 in the densest.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-ai\fR or \fB\fC\-\-generate\-ids\fR: Add an \fB\fCid\fR (a feature ID, not an attribute named \fB\fCid\fR) to each feature that does not already have one. There is currently no guarantee that the \fB\fCid\fR added will be stable between runs or that it will not conflict with manually\-assigned feature IDs. Future versions of Tippecanoe may change the mechanism for allocating IDs.
|
||||
.RE
|
||||
.SS Trying to correct bad source geometry
|
||||
.RS
|
||||
|
@ -22,6 +22,7 @@
|
||||
#define A_DETECT_WRAPAROUND ((int) 'w')
|
||||
#define A_EXTEND_ZOOMS ((int) 'e')
|
||||
#define A_CLUSTER_DENSEST_AS_NEEDED ((int) 'C')
|
||||
#define A_GENERATE_IDS ((int) 'i')
|
||||
|
||||
#define P_SIMPLIFY ((int) 's')
|
||||
#define P_SIMPLIFY_LOW ((int) 'S')
|
||||
|
@ -387,6 +387,13 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
sf.geometry = fix_polygon(sf.geometry);
|
||||
}
|
||||
|
||||
if (!sf.has_id) {
|
||||
if (additional[A_GENERATE_IDS]) {
|
||||
sf.has_id = true;
|
||||
sf.id = sf.seq + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (sst->want_dist) {
|
||||
std::vector<unsigned long long> locs;
|
||||
for (size_t i = 0; i < sf.geometry.size(); i++) {
|
||||
|
2218
tests/ne_110m_admin_0_countries/out/-z3_-ai.json
Normal file
2218
tests/ne_110m_admin_0_countries/out/-z3_-ai.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v1.30.2"
|
||||
#define VERSION "v1.30.3"
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user