diff options
author | Young Hahn <young@mapbox.com> | 2016-07-06 17:29:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-06 17:29:34 -0400 |
commit | 71a3b1d0db170cfc1786be88c3e7b286c50dece9 (patch) | |
tree | 1d51cc28946dc990f8f613795417cb76ea8c00df /src/mbgl/style/sources | |
parent | 903d609b40b6d0f4873f7bb46d96f4a06d7b17d6 (diff) | |
download | qtlocation-mapboxgl-71a3b1d0db170cfc1786be88c3e7b286c50dece9.tar.gz |
[core] geometry@0.8.0 / geojsonvt@6.0.0 (#5514)
* [core] geometry.hpp 0.8.0
* geojsonvt @ 6.0.0
* Update platform deps, build scripts
* Perf optimizations/cleanup
* Rebase in geometry@080
* D.R.Y. etc
* Ensure fill annotation geometries have closed rings.
* Optimizations
* Update to geojsonvt @ 6.1.0 for clean handoff between geojson parsing and geojsonvt
* Apply close multi/poly geoms for line annotations as well
Diffstat (limited to 'src/mbgl/style/sources')
-rw-r--r-- | src/mbgl/style/sources/geojson_source_impl.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp index b9744d193a..d71df28378 100644 --- a/src/mbgl/style/sources/geojson_source_impl.cpp +++ b/src/mbgl/style/sources/geojson_source_impl.cpp @@ -6,6 +6,8 @@ #include <mbgl/platform/log.hpp> #include <mbgl/util/rapidjson.hpp> +#include <mapbox/geojson.hpp> +#include <mapbox/geojson/rapidjson.hpp> #include <mapbox/geojsonvt.hpp> #include <mapbox/geojsonvt/convert.hpp> @@ -18,6 +20,7 @@ using namespace mapbox::geojsonvt; namespace mbgl { namespace style { namespace conversion { + template <> Result<GeoJSON> convertGeoJSON(const JSValue& value) { Options options; @@ -25,7 +28,8 @@ Result<GeoJSON> convertGeoJSON(const JSValue& value) { options.extent = util::EXTENT; try { - return GeoJSON { std::make_unique<GeoJSONVT>(Convert::convert(value, 0), options) }; + const auto geojson = mapbox::geojson::convert(value); + return GeoJSON { std::make_unique<GeoJSONVT>(geojson, options) }; } catch (const std::exception& ex) { return Error { ex.what() }; } @@ -82,7 +86,8 @@ void GeoJSONSource::Impl::load(FileSource& fileSource) { Log::Error(Event::ParseStyle, "Failed to parse GeoJSON data: %s", geoJSON.error().message); // Create an empty GeoJSON VT object to make sure we're not infinitely waiting for // tiles to load. - urlOrGeoJSON = GeoJSON { std::make_unique<GeoJSONVT>(std::vector<ProjectedFeature>()) }; + mapbox::geojson::feature_collection features; + urlOrGeoJSON = GeoJSON { std::make_unique<GeoJSONVT>(features) }; } else { urlOrGeoJSON = std::move(*geoJSON); } |