diff --git a/vtm-android-example/AndroidManifest.xml b/vtm-android-example/AndroidManifest.xml
index 3c7e8dab..2f486cd0 100644
--- a/vtm-android-example/AndroidManifest.xml
+++ b/vtm-android-example/AndroidManifest.xml
@@ -41,6 +41,9 @@
+
diff --git a/vtm-android-example/src/org/oscim/android/test/MapboxMapActivity.java b/vtm-android-example/src/org/oscim/android/test/MapboxMapActivity.java
new file mode 100644
index 00000000..3f89684c
--- /dev/null
+++ b/vtm-android-example/src/org/oscim/android/test/MapboxMapActivity.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2016 devemux86
+ *
+ * This program is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with
+ * this program. If not, see .
+ */
+package org.oscim.android.test;
+
+import android.os.Bundle;
+
+import org.oscim.layers.tile.buildings.BuildingLayer;
+import org.oscim.layers.tile.vector.VectorTileLayer;
+import org.oscim.layers.tile.vector.labeling.LabelLayer;
+import org.oscim.theme.VtmThemes;
+import org.oscim.tiling.source.UrlTileSource;
+import org.oscim.tiling.source.mvt.MapboxTileSource;
+
+public class MapboxMapActivity extends MapActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ UrlTileSource tileSource = MapboxTileSource.builder()
+ .apiKey("vector-tiles-xxxxxxx") // Put a proper API key
+ .build();
+
+ VectorTileLayer l = mMap.setBaseMap(tileSource);
+ mMap.setTheme(VtmThemes.MAPZEN);
+
+ mMap.layers().add(new BuildingLayer(mMap, l));
+ mMap.layers().add(new LabelLayer(mMap, l));
+ }
+}
diff --git a/vtm-android-example/src/org/oscim/android/test/Samples.java b/vtm-android-example/src/org/oscim/android/test/Samples.java
index b0d64731..81762e9a 100644
--- a/vtm-android-example/src/org/oscim/android/test/Samples.java
+++ b/vtm-android-example/src/org/oscim/android/test/Samples.java
@@ -38,6 +38,7 @@ public class Samples extends Activity {
setContentView(R.layout.activity_samples);
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.samples);
linearLayout.addView(createButton(SimpleMapActivity.class));
+ linearLayout.addView(createButton(MapboxMapActivity.class));
linearLayout.addView(createButton(BitmapTileMapActivity.class));
linearLayout.addView(createButton(MapsforgeMapActivity.class));
linearLayout.addView(createButton(MarkerOverlayActivity.class));
diff --git a/vtm-playground/src/org/oscim/test/MapboxTest.java b/vtm-playground/src/org/oscim/test/MapboxTest.java
new file mode 100644
index 00000000..3a361322
--- /dev/null
+++ b/vtm-playground/src/org/oscim/test/MapboxTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2016 devemux86
+ *
+ * This program is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with
+ * this program. If not, see .
+ */
+package org.oscim.test;
+
+import org.oscim.gdx.GdxMapApp;
+import org.oscim.layers.tile.buildings.BuildingLayer;
+import org.oscim.layers.tile.vector.VectorTileLayer;
+import org.oscim.layers.tile.vector.labeling.LabelLayer;
+import org.oscim.theme.VtmThemes;
+import org.oscim.tiling.source.UrlTileSource;
+import org.oscim.tiling.source.mvt.MapboxTileSource;
+
+public class MapboxTest extends GdxMapApp {
+
+ @Override
+ public void createLayers() {
+ UrlTileSource tileSource = MapboxTileSource.builder()
+ .apiKey("vector-tiles-xxxxxxx") // Put a proper API key
+ .build();
+
+ VectorTileLayer l = mMap.setBaseMap(tileSource);
+ mMap.setTheme(VtmThemes.MAPZEN);
+
+ mMap.layers().add(new BuildingLayer(mMap, l));
+ mMap.layers().add(new LabelLayer(mMap, l));
+ }
+
+ public static void main(String[] args) {
+ GdxMapApp.init();
+ GdxMapApp.run(new MapboxTest());
+ }
+}
diff --git a/vtm/src/org/oscim/tiling/source/mvt/MapboxVectorTileSource.java b/vtm/src/org/oscim/tiling/source/mvt/MapboxTileSource.java
similarity index 56%
rename from vtm/src/org/oscim/tiling/source/mvt/MapboxVectorTileSource.java
rename to vtm/src/org/oscim/tiling/source/mvt/MapboxTileSource.java
index c322157e..13527e76 100644
--- a/vtm/src/org/oscim/tiling/source/mvt/MapboxVectorTileSource.java
+++ b/vtm/src/org/oscim/tiling/source/mvt/MapboxTileSource.java
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
+ * Copyright 2016 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -20,13 +21,37 @@ import org.oscim.tiling.ITileDataSource;
import org.oscim.tiling.source.UrlTileDataSource;
import org.oscim.tiling.source.UrlTileSource;
-public class MapboxVectorTileSource extends UrlTileSource {
- public MapboxVectorTileSource(String url, String tilePath) {
- super(url, tilePath);
- //Map opt = new HashMap();
- //opt.put("Accept-Encoding", "gzip");
- //opt.put("User-Agent", "curl/7.47.1");
- //setHttpRequestHeaders(opt);
+public class MapboxTileSource extends UrlTileSource {
+
+ private final static String DEFAULT_URL = "https://vector.mapzen.com/osm/all";
+ private final static String DEFAULT_PATH = "/{Z}/{X}/{Y}.mvt";
+
+ public static class Builder> extends UrlTileSource.Builder {
+
+ public Builder() {
+ super(DEFAULT_URL, DEFAULT_PATH, 1, 17);
+ }
+
+ public MapboxTileSource build() {
+ return new MapboxTileSource(this);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static Builder> builder() {
+ return new Builder();
+ }
+
+ protected MapboxTileSource(Builder> builder) {
+ super(builder);
+ }
+
+ public MapboxTileSource() {
+ this(builder());
+ }
+
+ public MapboxTileSource(String urlString) {
+ this(builder().url(urlString));
}
@Override
diff --git a/vtm/src/org/oscim/tiling/source/mvt/TileDecoder.java b/vtm/src/org/oscim/tiling/source/mvt/TileDecoder.java
index e6a27856..20f28bf4 100644
--- a/vtm/src/org/oscim/tiling/source/mvt/TileDecoder.java
+++ b/vtm/src/org/oscim/tiling/source/mvt/TileDecoder.java
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
+ * Copyright 2016 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -64,7 +65,7 @@ public class TileDecoder extends PbfDecoder {
private short[] mTmpTags = new short[1024];
private Tile mTile;
- private final String mLocale = "de";
+ private final String mLocale = "en";
private ITileDataSink mMapDataCallback;
private final static float REF_TILE_SIZE = 4096.0f;
@@ -166,7 +167,8 @@ public class TileDecoder extends PbfDecoder {
}
Tag layerTag = new Tag("layer", name);
- log.debug("add layer " + name);
+ if (debug)
+ log.debug("add layer " + name);
if (numFeatures == 0)
return true;