mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-04-13 13:53:11 +00:00
Fix the first place that was losing the node ID
This commit is contained in:
parent
bf57a725b0
commit
9ed6fecaf3
@ -197,6 +197,8 @@ int serialize_geojson_feature(struct serialization_state *sst, json_object *geom
|
||||
sf.feature_minzoom = 0; // Will be filled in during index merging
|
||||
sf.seq = *(sst->layer_seq);
|
||||
|
||||
checkgeom(sf.geometry, "serialize_geojson_feature");
|
||||
|
||||
if (tippecanoe_layername.size() != 0) {
|
||||
sf.layername = tippecanoe_layername;
|
||||
} else {
|
||||
|
12
geometry.cpp
12
geometry.cpp
@ -1277,3 +1277,15 @@ drawvec stairstep(drawvec &geom, int z, int detail) {
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void checkgeom(drawvec const &dv, std::string s) {
|
||||
#if 0
|
||||
for (size_t i = 0; i < dv.size(); i++) {
|
||||
if (dv[i].id == 0) {
|
||||
fprintf(stderr, "id lost: %s\n", s.c_str());
|
||||
abort();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
11
geometry.hpp
11
geometry.hpp
@ -31,6 +31,14 @@ struct draw {
|
||||
id(0) {
|
||||
}
|
||||
|
||||
draw(int nop, long long nx, long long ny, long long nid)
|
||||
: x(nx),
|
||||
op(nop),
|
||||
y(ny),
|
||||
necessary(0),
|
||||
id(nid) {
|
||||
}
|
||||
|
||||
draw()
|
||||
: x(0),
|
||||
op(0),
|
||||
@ -77,4 +85,7 @@ void check_polygon(drawvec &geom);
|
||||
double get_area(drawvec &geom, size_t i, size_t j);
|
||||
double get_mp_area(drawvec &geom);
|
||||
|
||||
void checkgeom(drawvec const &dv, std::string s);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -81,7 +81,8 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
|
||||
}
|
||||
|
||||
draw d(op, x, y);
|
||||
out.push_back(draw(op, x, y));
|
||||
d.id = 12345;
|
||||
out.push_back(d);
|
||||
} else {
|
||||
fprintf(stderr, "%s:%d: malformed point\n", fname, line);
|
||||
json_context(j);
|
||||
@ -101,6 +102,8 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
|
||||
|
||||
out.push_back(draw(VT_CLOSEPATH, 0, 0));
|
||||
}
|
||||
|
||||
checkgeom(out, "parse_geometry");
|
||||
}
|
||||
|
||||
void canonicalize(json_object *o) {
|
||||
|
@ -169,6 +169,8 @@ int deserialize_byte_io(FILE *f, signed char *n, long long *geompos) {
|
||||
}
|
||||
|
||||
static void write_geometry(drawvec const &dv, long long *fpos, FILE *out, const char *fname, long long wx, long long wy) {
|
||||
checkgeom(dv, "write_geometry");
|
||||
|
||||
for (size_t i = 0; i < dv.size(); i++) {
|
||||
if (dv[i].op == VT_MOVETO || dv[i].op == VT_LINETO) {
|
||||
serialize_byte(out, dv[i].op, fpos, fname);
|
||||
|
11
tile.cpp
11
tile.cpp
@ -292,7 +292,7 @@ void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, u
|
||||
|
||||
drawvec geom2;
|
||||
for (size_t i = 0; i < geom.size(); i++) {
|
||||
geom2.push_back(draw(geom[i].op, (geom[i].x + sx) >> geometry_scale, (geom[i].y + sy) >> geometry_scale));
|
||||
geom2.push_back(draw(geom[i].op, (geom[i].x + sx) >> geometry_scale, (geom[i].y + sy) >> geometry_scale, geom[i].id));
|
||||
}
|
||||
|
||||
for (xo = bbox2[0]; xo <= bbox2[2]; xo++) {
|
||||
@ -1254,6 +1254,8 @@ bool clip_to_tile(serial_feature &sf, int z, long long buffer) {
|
||||
}
|
||||
}
|
||||
|
||||
checkgeom(sf.geometry, "clip_to_tile1");
|
||||
|
||||
// Can't accept the quick check if guaranteeing no duplication, since the
|
||||
// overlap might have been in the buffer.
|
||||
if (quick != 1 || prevent[P_DUPLICATION]) {
|
||||
@ -1273,8 +1275,12 @@ bool clip_to_tile(serial_feature &sf, int z, long long buffer) {
|
||||
clipped = clip_point(sf.geometry, z, buffer);
|
||||
}
|
||||
|
||||
checkgeom(sf.geometry, "clip_to_tile2");
|
||||
|
||||
clipped = remove_noop(clipped, sf.t, 0);
|
||||
|
||||
checkgeom(clipped, "clip_to_tile3");
|
||||
|
||||
// Must clip at z0 even if we don't want clipping, to handle features
|
||||
// that are duplicated across the date line
|
||||
|
||||
@ -1304,6 +1310,7 @@ serial_feature next_feature(FILE *geoms, long long *geompos_in, char *metabase,
|
||||
if (sf.t < 0) {
|
||||
return sf;
|
||||
}
|
||||
checkgeom(sf.geometry, "next_feature");
|
||||
|
||||
double progress = floor(((((*geompos_in + *along - alongminus) / (double) todo) + (pass - (2 - passes))) / passes + z) / (maxzoom + 1) * 1000) / 10;
|
||||
if (progress >= *oprogress + 0.1) {
|
||||
@ -1746,6 +1753,8 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
break;
|
||||
}
|
||||
|
||||
checkgeom(sf.geometry, "write_tile");
|
||||
|
||||
if (sf.dropped) {
|
||||
if (find_partial(partials, sf, which_partial, layer_unmaps)) {
|
||||
preserve_attributes(arg->attribute_accum, attribute_accum_state, sf, stringpool, pool_off, partials[which_partial]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user