如何在MapBox上加载自己的图块?

时间:2015-06-17 11:41:53

标签: android tiles mapbox

如何在MapBox上加载自己的图块?我正在使用setTileSource,但它似乎无法正常工作。

我的代码看起来像这样:

setContentView(R.layout.map);

mapview = (MapView) findViewById(R.id.mapview);
String tileServerBaseString = MyApp.myTileServerString();
tileServerBaseString = tileServerBaseString.replace("TYPE", "jpeg");
tileServerBaseString = tileServerBaseString.replace("Z", "{z}");
tileServerBaseString = tileServerBaseString.replace("X", "{x}");
tileServerBaseString = tileServerBaseString.replace("Y", "{y}");
IMapTileProviderCallback tileprovider = mapview.getTileProvider();
mapview.setTileSource(new WebSourceTileLayer("CustomTileLayer", tileServerBaseString));

并且视图如下所示:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">

<com.mapbox.mapboxsdk.views.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    mapbox:mapid="mapview"
    />

</LinearLayout>

不确定是什么问题,有什么建议吗?

0 个答案:

没有答案