diff --git a/include/shared_data.h b/include/shared_data.h index 9fdcc524..ed8c9116 100644 --- a/include/shared_data.h +++ b/include/shared_data.h @@ -26,6 +26,7 @@ struct LayerDef { uint combinePolygonsBelow; bool sortZOrderAscending; uint featureLimit; + uint featureLimitBelow; std::string source; std::vector sourceColumns; bool allSourceColumns; @@ -47,7 +48,7 @@ class LayerDefinition { uint addLayer(std::string name, uint minzoom, uint maxzoom, uint simplifyBelow, double simplifyLevel, double simplifyLength, double simplifyRatio, uint filterBelow, double filterArea, uint combinePolygonsBelow, bool sortZOrderAscending, - uint featureLimit, + uint featureLimit, uint featureLimitBelow, const std::string &source, const std::vector &sourceColumns, bool allSourceColumns, diff --git a/src/shared_data.cpp b/src/shared_data.cpp index 5504ecfa..dfb6df81 100644 --- a/src/shared_data.cpp +++ b/src/shared_data.cpp @@ -20,7 +20,7 @@ SharedData::~SharedData() { } uint LayerDefinition::addLayer(string name, uint minzoom, uint maxzoom, uint simplifyBelow, double simplifyLevel, double simplifyLength, double simplifyRatio, uint filterBelow, double filterArea, uint combinePolygonsBelow, bool sortZOrderAscending, - uint featureLimit, + uint featureLimit, uint featureLimitBelow, const std::string &source, const std::vector &sourceColumns, bool allSourceColumns, @@ -30,7 +30,7 @@ uint LayerDefinition::addLayer(string name, uint minzoom, uint maxzoom, bool isWriteTo = !writeTo.empty(); LayerDef layer = { name, minzoom, maxzoom, simplifyBelow, simplifyLevel, simplifyLength, simplifyRatio, - filterBelow, filterArea, combinePolygonsBelow, sortZOrderAscending, featureLimit, + filterBelow, filterArea, combinePolygonsBelow, sortZOrderAscending, featureLimit, featureLimitBelow, source, sourceColumns, allSourceColumns, indexed, indexName, std::map(), isWriteTo }; layers.push_back(layer); @@ -205,6 +205,7 @@ void Config::readConfig(rapidjson::Document &jsonConfig, bool &hasClippingBox, B double filterArea = it->value.HasMember("filter_area" ) ? it->value["filter_area" ].GetDouble() : 0.5; int combinePolyBelow=it->value.HasMember("combine_polygons_below") ? it->value["combine_polygons_below"].GetInt() : 0; int featureLimit = it->value.HasMember("feature_limit" ) ? it->value["feature_limit" ].GetInt() : 0; + int featureLimitBelow= it->value.HasMember("feature_limit_below") ? it->value["feature_limit_below"].GetInt() : (maxZoom+1); bool sortZOrderAscending = it->value.HasMember("z_order_ascending") ? it->value["z_order_ascending"].GetBool() : (featureLimit==0); string source = it->value.HasMember("source") ? it->value["source"].GetString() : ""; vector sourceColumns; @@ -225,7 +226,7 @@ void Config::readConfig(rapidjson::Document &jsonConfig, bool &hasClippingBox, B layers.addLayer(layerName, minZoom, maxZoom, simplifyBelow, simplifyLevel, simplifyLength, simplifyRatio, - filterBelow, filterArea, combinePolyBelow, sortZOrderAscending, featureLimit, + filterBelow, filterArea, combinePolyBelow, sortZOrderAscending, featureLimit, featureLimitBelow, source, sourceColumns, allSourceColumns, indexed, indexName, writeTo); diff --git a/src/tile_worker.cpp b/src/tile_worker.cpp index df9fb36f..8d9db471 100644 --- a/src/tile_worker.cpp +++ b/src/tile_worker.cpp @@ -244,7 +244,7 @@ void ProcessLayer(SourceList const &sources, AttributeStore const &attributeStor // Loop through output objects auto ooListSameLayer = GetObjectsAtSubLayer(data[i], layerNum); auto end = ooListSameLayer.second; - if (ld.featureLimit > 0 && end-ooListSameLayer.first > ld.featureLimit) end = ooListSameLayer.first+ld.featureLimit; + if (ld.featureLimit>0 && end-ooListSameLayer.first>ld.featureLimit && zoom