Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 6be56ff

Browse files
committed
[render] allow passing URLs to mbgl-render
1 parent dc1bda4 commit 6be56ff

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

bin/render.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <mbgl/gl/offscreen_view.hpp>
88
#include <mbgl/util/default_thread_pool.hpp>
99
#include <mbgl/storage/default_file_source.hpp>
10+
#include <mbgl/util/url.hpp>
1011

1112
#pragma GCC diagnostic push
1213
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
@@ -65,8 +66,6 @@ int main(int argc, char *argv[]) {
6566
exit(1);
6667
}
6768

68-
std::string style = mbgl::util::read_file(style_path);
69-
7069
using namespace mbgl;
7170

7271
util::RunLoop loop;
@@ -90,7 +89,12 @@ int main(int argc, char *argv[]) {
9089
ThreadPool threadPool(4);
9190
Map map(backend, mbgl::Size { width, height }, pixelRatio, fileSource, threadPool, MapMode::Still);
9291

93-
map.setStyleJSON(style);
92+
if (util::isURL(style_path)) {
93+
map.setStyleURL(style_path);
94+
} else {
95+
map.setStyleJSON(mbgl::util::read_file(style_path));
96+
}
97+
9498
map.setClasses(classes);
9599

96100
map.setLatLngZoom({ lat, lon }, zoom);

0 commit comments

Comments
 (0)