summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-03-27 13:55:19 -0700
committerChris Loer <chris.loer@mapbox.com>2018-03-27 15:26:38 -0700
commit3c18610d1f98ffa6dfc2d0057ef5278ac2ec9d65 (patch)
tree809a2bb9624f1c272a528ebcbf5bfb1dda2ba06a /bin
parent7f18b0bbb293b4dcf4cbc365ec0c7f705f33306b (diff)
downloadqtlocation-mapboxgl-3c18610d1f98ffa6dfc2d0057ef5278ac2ec9d65.tar.gz
[core] Add 'apiBaseURL' argument to mbgl-offline util.
Diffstat (limited to 'bin')
-rw-r--r--bin/offline.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/offline.cpp b/bin/offline.cpp
index 5b403a6416..65396a88fb 100644
--- a/bin/offline.cpp
+++ b/bin/offline.cpp
@@ -21,6 +21,7 @@ int main(int argc, char *argv[]) {
args::ValueFlag<std::string> tokenValue(argumentParser, "key", "Mapbox access token", {'t', "token"});
args::ValueFlag<std::string> styleValue(argumentParser, "URL", "Map stylesheet", {'s', "style"});
args::ValueFlag<std::string> outputValue(argumentParser, "file", "Output database file name", {'o', "output"});
+ args::ValueFlag<std::string> apiBaseValue(argumentParser, "URL", "API Base URL", {'a', "apiBaseURL"});
args::ValueFlag<double> northValue(argumentParser, "degrees", "North latitude", {"north"});
args::ValueFlag<double> westValue(argumentParser, "degrees", "West longitude", {"west"});
@@ -60,6 +61,8 @@ int main(int argc, char *argv[]) {
const char* tokenEnv = getenv("MAPBOX_ACCESS_TOKEN");
const std::string token = tokenValue ? args::get(tokenValue) : (tokenEnv ? tokenEnv : std::string());
+
+ const std::string apiBaseURL = apiBaseValue ? args::get(apiBaseValue) : mbgl::util::API_BASE_URL;
using namespace mbgl;
@@ -68,6 +71,7 @@ int main(int argc, char *argv[]) {
std::unique_ptr<OfflineRegion> region;
fileSource.setAccessToken(token);
+ fileSource.setAPIBaseURL(apiBaseURL);
LatLngBounds boundingBox = LatLngBounds::hull(LatLng(north, west), LatLng(south, east));
OfflineTilePyramidRegionDefinition definition(style, boundingBox, minZoom, maxZoom, pixelRatio);