[core] fix reparsing overscaled geojson tiles

fix #3838
This commit is contained in:
Ansis Brammanis
2016-03-30 12:20:55 -07:00
parent 8e9e779f2f
commit b6a181097c
10 changed files with 16 additions and 16 deletions

2
.mason

Submodule .mason updated: e93ea69408...1894e99a12

View File

@@ -26,7 +26,7 @@
],
"devDependencies": {
"aws-sdk": "^2.2.21",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#4e47d234da96c87356c508575cda5e6aa0065751",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#fc3f2302bfc50ac5c779d4685d3353ee4a388eb1",
"node-gyp": "^3.2.1",
"request": "^2.67.0",
"tape": "^4.2.2"

View File

@@ -8,7 +8,7 @@ LIBUV_VERSION=1.7.5
ZLIB_VERSION=system
NUNICODE_VERSION=1.6
LIBZIP_VERSION=0.11.2
GEOJSONVT_VERSION=4.0.0
GEOJSONVT_VERSION=4.1.0
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2
JNI_HPP_VERSION=2.0.0

View File

@@ -4,7 +4,7 @@ BOOST_VERSION=1.59.0
SQLITE_VERSION=system
LIBUV_VERSION=1.7.5
ZLIB_VERSION=system
GEOJSONVT_VERSION=4.0.0
GEOJSONVT_VERSION=4.1.0
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2
GTEST_VERSION=1.7.0

View File

@@ -10,7 +10,7 @@ SQLITE_VERSION=3.9.1
LIBUV_VERSION=1.7.5
ZLIB_VERSION=system
NUNICODE_VERSION=1.6
GEOJSONVT_VERSION=4.0.0
GEOJSONVT_VERSION=4.1.0
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2
GTEST_VERSION=1.7.0

View File

@@ -8,7 +8,7 @@ SQLITE_VERSION=3.9.1
LIBUV_VERSION=1.7.5
ZLIB_VERSION=system
NUNICODE_VERSION=1.6
GEOJSONVT_VERSION=4.0.0
GEOJSONVT_VERSION=4.1.0
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2
GTEST_VERSION=1.7.0

View File

@@ -114,7 +114,7 @@ void ShapeAnnotationImpl::updateTile(const TileID& tileID, AnnotationTile& tile)
shapeTiler = std::make_unique<mapbox::geojsonvt::GeoJSONVT>(features, options);
}
const auto& shapeTile = shapeTiler->getTile(tileID.z, tileID.x, tileID.y);
const auto& shapeTile = shapeTiler->getTile(tileID.sourceZ, tileID.x, tileID.y);
if (!shapeTile)
return;

View File

@@ -127,7 +127,7 @@ void Source::load(FileSource& fileSource) {
info = std::move(newInfo);
} else if (type == SourceType::GeoJSON) {
info = std::make_unique<SourceInfo>();
std::unique_ptr<SourceInfo> newInfo = std::make_unique<SourceInfo>();
rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> d;
d.Parse<0>(res.data->c_str());
@@ -141,6 +141,9 @@ void Source::load(FileSource& fileSource) {
geojsonvt = StyleParser::parseGeoJSON(d);
reloadTiles = true;
newInfo->maxZoom = geojsonvt->options.maxZoom;
info = std::move(newInfo);
}
if (reloadTiles) {
@@ -352,9 +355,7 @@ bool Source::update(const StyleUpdateParameters& parameters) {
int32_t maxCoveringZoom = util::clamp<int32_t>(zoom + 1, info->minZoom, info->maxZoom);
if (zoom >= info->minZoom) {
const bool reparseOverscaled =
type == SourceType::Vector ||
type == SourceType::Annotations;
const bool reparseOverscaled = type != SourceType::Raster;
const auto actualZ = zoom;
if (zoom > info->maxZoom) {

View File

@@ -203,6 +203,8 @@ void StyleParser::parseSources(const JSValue& value) {
break;
case SourceType::GeoJSON:
info = std::make_unique<SourceInfo>();
// We should probably split this up to have URLs in the url property, and actual data
// in the data property. Until then, we're going to detect the content based on the
// object type.
@@ -213,8 +215,8 @@ void StyleParser::parseSources(const JSValue& value) {
url = { dataVal.GetString(), dataVal.GetStringLength() };
} else if (dataVal.IsObject()) {
// We need to parse dataVal as a GeoJSON object
// TODO: parse GeoJSON data
geojsonvt = parseGeoJSON(dataVal);
info->maxZoom = geojsonvt->options.maxZoom;
} else {
Log::Error(Event::ParseStyle, "GeoJSON data must be a URL or an object");
continue;
@@ -224,9 +226,6 @@ void StyleParser::parseSources(const JSValue& value) {
continue;
}
// We always assume the default configuration for GeoJSON sources.
info = std::make_unique<SourceInfo>();
break;
default:

View File

@@ -119,7 +119,7 @@ void GeoJSONTileMonitor::setGeoJSONVT(mapbox::geojsonvt::GeoJSONVT* vt) {
void GeoJSONTileMonitor::update() {
if (geojsonvt) {
auto tile = convertTile(geojsonvt->getTile(tileID.z, tileID.x, tileID.y));
auto tile = convertTile(geojsonvt->getTile(tileID.sourceZ, tileID.x, tileID.y));
callback(nullptr, std::move(tile), {}, {});
}
}