diff --git a/CHANGELOG.md b/CHANGELOG.md index b6f5ec49..12fd468f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# 2.81.1 + +* Fix the placement of `--convert-polygons-to-label-points` anchors, most + visibly in the buffer of the z0 tile. The anchor was stored as a packed + index of two unsigned 32-bit coordinates, so an anchor in the tile buffer + outside the [0, 2^32) plane was wrapped to the opposite edge of the world + instead of kept where it was, and an anchor at exactly (0, 0) was + indistinguishable from having no anchor at all. Store the anchor as a pair + of signed coordinates with a separate presence flag, and place it directly + when it falls within the tile plus its buffer rather than searching the + repeating checkerboard for a substitute. + # 2.81.0 * Add `--drop-by-attribute-as-needed=`*attribute* to drop the features with diff --git a/geometry.cpp b/geometry.cpp index 58d4f163..beb0639b 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -944,23 +944,33 @@ drawvec polygon_to_anchor(const drawvec &geom) { return drawvec(); } -drawvec checkerboard_anchors(drawvec const &geom, int tx, int ty, int z, unsigned long long label_point) { +drawvec checkerboard_anchors(drawvec const &geom, int tx, int ty, int z, long long wx, long long wy, int buffer) { drawvec out; - // anchor point in world coordinates - unsigned wx, wy; - decode_index(label_point, &wx, &wy); - // upper left of tile in world coordinates long long tx1 = 0, ty1 = 0; // lower right of tile in world coordinates; - long long tx2 = 1LL << 32; // , ty2 = 1LL << 32; + long long tx2 = 1LL << 32, ty2 = 1LL << 32; if (z != 0) { tx1 = (long long) tx << (32 - z); ty1 = (long long) ty << (32 - z); tx2 = (long long) (tx + 1) << (32 - z); - // ty2 = (long long) (ty + 1) << (32 - z); + ty2 = (long long) (ty + 1) << (32 - z); + } + + long long tx1_buffer = tx1 - (1LL << (32 - z)) * buffer / 256; + long long ty1_buffer = ty1 - (1LL << (32 - z)) * buffer / 256; + long long tx2_buffer = tx2 + (1LL << (32 - z)) * buffer / 256; + long long ty2_buffer = ty2 + (1LL << (32 - z)) * buffer / 256; + + // if the central label point is within this tile, always prefer that. + // none of the label repetition code below matters much any more, + // now that we truncate the tile pyramid once we have all the features + if (wx >= tx1_buffer && wx <= tx2_buffer && wy >= ty1_buffer && wy <= ty2_buffer) { + // offset to tile origin + out.push_back(draw(VT_MOVETO, wx - tx1, wy - ty1)); + return out; } // upper left of feature in world coordinates diff --git a/geometry.hpp b/geometry.hpp index 454cea61..d586582f 100644 --- a/geometry.hpp +++ b/geometry.hpp @@ -89,7 +89,7 @@ void check_polygon(drawvec &geom); double get_area(const drawvec &geom, size_t i, size_t j); double get_mp_area(drawvec &geom); drawvec polygon_to_anchor(const drawvec &geom); -drawvec checkerboard_anchors(drawvec const &geom, int tx, int ty, int z, unsigned long long label_point); +drawvec checkerboard_anchors(drawvec const &geom, int tx, int ty, int z, long long wx, long long wy, int buffer); drawvec simple_clip_poly(drawvec &geom, int z, int buffer, drawvec &shared_nodes, bool prevent_simplify_shared_nodes); drawvec simple_clip_poly(drawvec &geom, long long x1, long long y1, long long x2, long long y2, bool prevent_simplify_shared_nodes); diff --git a/serial.cpp b/serial.cpp index 73868194..d5cc1fa1 100644 --- a/serial.cpp +++ b/serial.cpp @@ -186,7 +186,7 @@ std::string serialize_feature(serial_feature *sf, long long wx, long long wy) { long long layer = 0; layer |= sf->layer << FLAG_LAYER; - layer |= (sf->label_point != 0) << FLAG_LABEL_POINT; + layer |= (sf->has_label_point) << FLAG_LABEL_POINT; layer |= (sf->index != 0) << FLAG_INDEX; layer |= (sf->extent != 0) << FLAG_EXTENT; layer |= sf->has_id << FLAG_ID; @@ -213,8 +213,9 @@ std::string serialize_feature(serial_feature *sf, long long wx, long long wy) { serialize_ulong_long(s, sf->index); serialize_ulong_long(s, sf->gap); } - if (sf->label_point != 0) { - serialize_ulong_long(s, sf->label_point); + if (sf->has_label_point) { + serialize_long_long(s, sf->label_point_x); + serialize_long_long(s, sf->label_point_y); } if (sf->extent != 0) { serialize_long_long(s, sf->extent); @@ -261,7 +262,9 @@ serial_feature deserialize_feature(std::string const &geoms, unsigned z, unsigne sf.index = 0; sf.gap = 0; - sf.label_point = 0; + sf.label_point_x = 0; + sf.label_point_y = 0; + sf.has_label_point = false; sf.extent = 0; sf.geometry = decode_geometry(&cp, z, tx, ty, sf.bbox, initial_x[sf.segment], initial_y[sf.segment]); @@ -271,7 +274,9 @@ serial_feature deserialize_feature(std::string const &geoms, unsigned z, unsigne deserialize_ulong_long(&cp, &sf.gap); } if (sf.layer & (1 << FLAG_LABEL_POINT)) { - deserialize_ulong_long(&cp, &sf.label_point); + sf.has_label_point = true; + deserialize_long_long(&cp, &sf.label_point_x); + deserialize_long_long(&cp, &sf.label_point_y); } if (sf.layer & (1 << FLAG_EXTENT)) { deserialize_long_long(&cp, &sf.extent); @@ -734,9 +739,9 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf, std:: if (sf.t == VT_POLYGON && additional[A_GENERATE_POLYGON_LABEL_POINTS]) { drawvec dv = polygon_to_anchor(scaled_geometry); if (dv.size() > 0) { - dv[0].x = SHIFT_LEFT(dv[0].x) & ((1LL << 32) - 1); - dv[0].y = SHIFT_LEFT(dv[0].y) & ((1LL << 32) - 1); - sf.label_point = encode_index(dv[0].x, dv[0].y); + sf.label_point_x = SHIFT_LEFT(dv[0].x); + sf.label_point_y = SHIFT_LEFT(dv[0].y); + sf.has_label_point = true; } } diff --git a/serial.hpp b/serial.hpp index a351f21d..c15cb813 100644 --- a/serial.hpp +++ b/serial.hpp @@ -119,9 +119,15 @@ struct serial_feature { drawvec geometry = drawvec(); unsigned long long index = 0; unsigned long long gap = 0; // filled in during z0. square of planar distance - unsigned long long label_point = 0; long long extent = 0; + // The anchor point for a polygon label, in world coordinates, + // which can legitimately be outside the [0, 2^32) plane, so a + // separate flag rather than a sentinel value marks its absence. + bool has_label_point = false; + long long label_point_x = 0; + long long label_point_y = 0; + // These fields are not directly serialized, but are used // to create the keys and values references into the string pool // during initial serialization diff --git a/tests/ne_110m_admin_0_countries/out/-z2_--convert-polygons-to-label-points.json b/tests/ne_110m_admin_0_countries/out/-z2_--convert-polygons-to-label-points.json index 505b7ade..546e928b 100644 --- a/tests/ne_110m_admin_0_countries/out/-z2_--convert-polygons-to-label-points.json +++ b/tests/ne_110m_admin_0_countries/out/-z2_--convert-polygons-to-label-points.json @@ -366,7 +366,7 @@ , { "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 2, "sovereignt": "Australia", "sov_a3": "AU1", "adm0_dif": 1, "level": 2, "type": "Country", "admin": "Australia", "adm0_a3": "AUS", "geou_dif": 0, "geounit": "Australia", "gu_a3": "AUS", "su_dif": 0, "subunit": "Australia", "su_a3": "AUS", "brk_diff": 0, "name": "Australia", "name_long": "Australia", "brk_a3": "AUS", "brk_name": "Australia", "abbrev": "Auz.", "postal": "AU", "formal_en": "Commonwealth of Australia", "name_sort": "Australia", "mapcolor7": 1, "mapcolor8": 2, "mapcolor9": 2, "mapcolor13": 7, "pop_est": 21262641, "gdp_md_est": 800200, "pop_year": -99, "lastcensus": 2006, "gdp_year": -99, "economy": "2. Developed region: nonG7", "income_grp": "1. High income: OECD", "wikipedia": -99, "iso_a2": "AU", "iso_a3": "AUS", "iso_n3": "036", "un_a3": "036", "wb_a2": "AU", "wb_a3": "AUS", "woe_id": -99, "adm0_a3_is": "AUS", "adm0_a3_us": "AUS", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Oceania", "region_un": "Oceania", "subregion": "Australia and New Zealand", "region_wb": "East Asia & Pacific", "name_len": 9, "long_len": 9, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Point", "coordinates": [ 134.472656, -26.037042 ] } } , -{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ -103.095703, -83.932990 ], [ 4.921875, -74.519889 ], [ 112.851562, -83.932990 ] ] } } +{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 4.921875, -81.710526 ], [ 112.851562, -68.911005 ] ] } } ] } ] } , @@ -390,7 +390,7 @@ , { "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 5, "sovereignt": "United Kingdom", "sov_a3": "GB1", "adm0_dif": 1, "level": 2, "type": "Dependency", "admin": "Falkland Islands", "adm0_a3": "FLK", "geou_dif": 0, "geounit": "Falkland Islands", "gu_a3": "FLK", "su_dif": 0, "subunit": "Falkland Islands", "su_a3": "FLK", "brk_diff": 1, "name": "Falkland Is.", "name_long": "Falkland Islands", "brk_a3": "B12", "brk_name": "Falkland Is.", "abbrev": "Flk. Is.", "postal": "FK", "formal_en": "Falkland Islands", "note_adm0": "U.K.", "note_brk": "Admin. by U.K.; Claimed by Argentina", "name_sort": "Falkland Islands", "name_alt": "Islas Malvinas", "mapcolor7": 6, "mapcolor8": 6, "mapcolor9": 6, "mapcolor13": 3, "pop_est": 3140, "gdp_md_est": 105.1, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "2. Developed region: nonG7", "income_grp": "1. High income: OECD", "wikipedia": -99, "iso_a2": "FK", "iso_a3": "FLK", "iso_n3": "238", "un_a3": "238", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "FLK", "adm0_a3_us": "FLK", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "South America", "region_un": "Americas", "subregion": "South America", "region_wb": "Latin America & Caribbean", "name_len": 12, "long_len": 16, "abbrev_len": 8, "tiny": -99, "homepart": -99 }, "geometry": { "type": "Point", "coordinates": [ -59.414062, -51.699800 ] } } , -{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ -103.139648, -83.937633 ], [ -49.130859, -80.305330 ] ] } } +{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ -103.139648, -81.704187 ], [ -49.130859, -84.818373 ] ] } } ] } ] } , @@ -550,7 +550,7 @@ , { "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 2, "sovereignt": "Australia", "sov_a3": "AU1", "adm0_dif": 1, "level": 2, "type": "Country", "admin": "Australia", "adm0_a3": "AUS", "geou_dif": 0, "geounit": "Australia", "gu_a3": "AUS", "su_dif": 0, "subunit": "Australia", "su_a3": "AUS", "brk_diff": 0, "name": "Australia", "name_long": "Australia", "brk_a3": "AUS", "brk_name": "Australia", "abbrev": "Auz.", "postal": "AU", "formal_en": "Commonwealth of Australia", "name_sort": "Australia", "mapcolor7": 1, "mapcolor8": 2, "mapcolor9": 2, "mapcolor13": 7, "pop_est": 21262641, "gdp_md_est": 800200, "pop_year": -99, "lastcensus": 2006, "gdp_year": -99, "economy": "2. Developed region: nonG7", "income_grp": "1. High income: OECD", "wikipedia": -99, "iso_a2": "AU", "iso_a3": "AUS", "iso_n3": "036", "un_a3": "036", "wb_a2": "AU", "wb_a3": "AUS", "woe_id": -99, "adm0_a3_is": "AUS", "adm0_a3_us": "AUS", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Oceania", "region_un": "Oceania", "subregion": "Australia and New Zealand", "region_wb": "East Asia & Pacific", "name_len": 9, "long_len": 9, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Point", "coordinates": [ 134.472656, -25.997550 ] } } , -{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 4.877930, -74.519889 ], [ 58.886719, -80.305330 ], [ 112.895508, -74.519889 ] ] } } +{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 4.877930, -81.704187 ], [ 58.886719, -76.750473 ], [ 112.895508, -68.926811 ], [ 166.860352, -84.818373 ] ] } } ] } ] } , @@ -778,7 +778,7 @@ , { "type": "FeatureCollection", "properties": { "zoom": 2, "x": 0, "y": 3 }, "features": [ { "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ -{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Point", "coordinates": [ -119.179688, -81.127169 ] } } +{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Point", "coordinates": [ -119.179688, -79.038437 ] } } ] } ] } , @@ -800,7 +800,7 @@ , { "type": "FeatureCollection", "properties": { "zoom": 2, "x": 1, "y": 3 }, "features": [ { "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ -{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Point", "coordinates": [ -57.150879, -84.830266 ] } } +{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Point", "coordinates": [ -57.150879, -83.606375 ] } } ] } ] } , @@ -914,7 +914,7 @@ , { "type": "FeatureCollection", "properties": { "zoom": 2, "x": 2, "y": 3 }, "features": [ { "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ -{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 4.877930, -81.127169 ], [ 66.906738, -74.816180 ] ] } } +{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 4.877930, -79.038437 ], [ 66.906738, -71.272595 ] ] } } ] } ] } , @@ -1146,7 +1146,7 @@ , { "type": "FeatureCollection", "properties": { "zoom": 2, "x": 3, "y": 3 }, "features": [ { "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ -{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Point", "coordinates": [ 128.935547, -81.127169 ] } } +{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 4, "sovereignt": "Antarctica", "sov_a3": "ATA", "adm0_dif": 0, "level": 2, "type": "Indeterminate", "admin": "Antarctica", "adm0_a3": "ATA", "geou_dif": 0, "geounit": "Antarctica", "gu_a3": "ATA", "su_dif": 0, "subunit": "Antarctica", "su_a3": "ATA", "brk_diff": 0, "name": "Antarctica", "name_long": "Antarctica", "brk_a3": "ATA", "brk_name": "Antarctica", "abbrev": "Ant.", "postal": "AQ", "note_brk": "Multiple claims held in abeyance", "name_sort": "Antarctica", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": -99, "pop_est": 3802, "gdp_md_est": 760.4, "pop_year": -99, "lastcensus": -99, "gdp_year": -99, "economy": "6. Developing region", "income_grp": "2. High income: nonOECD", "wikipedia": -99, "iso_a2": "AQ", "iso_a3": "ATA", "iso_n3": "010", "un_a3": "-099", "wb_a2": "-99", "wb_a3": "-99", "woe_id": -99, "adm0_a3_is": "ATA", "adm0_a3_us": "ATA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "Antarctica", "region_un": "Antarctica", "subregion": "Antarctica", "region_wb": "Antarctica", "name_len": 10, "long_len": 10, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Point", "coordinates": [ 128.935547, -79.038437 ] } } ] } ] } , diff --git a/tile.cpp b/tile.cpp index a80be63a..c74914ac 100644 --- a/tile.cpp +++ b/tile.cpp @@ -1910,7 +1910,11 @@ long long write_tile(decompressor *geoms, std::atomic *geompos_in, ch if (ngeom.size() == 0) { continue; } - sf.geometry = checkerboard_anchors(ngeom, tx, ty, z, sf.label_point); + if (sf.has_label_point) { + sf.geometry = checkerboard_anchors(ngeom, tx, ty, z, sf.label_point_x, sf.label_point_y, buffer); + } else { + sf.geometry.clear(); + } if (sf.geometry.size() == 0) { continue; } diff --git a/version.hpp b/version.hpp index 71b353ad..1364ab38 100644 --- a/version.hpp +++ b/version.hpp @@ -1,6 +1,6 @@ #ifndef VERSION_HPP #define VERSION_HPP -#define VERSION "v2.81.0" +#define VERSION "v2.81.1" #endif