0

我们想在谷歌地图上显示我们的矢量瓦片,我们已经使用谷歌地图 SDK 的瓦片提供程序完成了 png 瓦片,但我们需要矢量瓦片 GeoJson。我找到了一些这样的解决方案

这里有这些代码:

public class GoogleMapsActivity extends FragmentActivity {

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu items for use in the action bar
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_main, menu);
    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    final Context context = this;

    return super.onOptionsItemSelected(item);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTheme(R.style.DarkTheme);

    if(SettingsActivity.mUnits){
        setContentView(R.layout.google_maps_tracker_metric);
    } else {
        setContentView(R.layout.google_maps_tracker);
    }
}

@Override
protected void onResume(){
    super.onResume();

    // Get both fragments shown on the same screen
    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

    GoogleMapsTracker fragment;
    fragment = GoogleMapsTracker.newInstance();

    GoogleMapsOGLES fragmentOGL;
    fragmentOGL = GoogleMapsOGLES.newInstance();

    fragmentTransaction.add(R.id.map, fragment);
    fragmentTransaction.add(R.id.gl, fragmentOGL);
    fragmentTransaction.commit();
}

@Override
protected void onPause(){
    super.onPause();
}

@Override
protected void onDestroy() { 
    super.onDestroy(); 
}

但这并不完整,并且有一些未提供的布局和类。有人这样做或可以帮助我吗?

4

1 回答 1

0

我相信 Google Maps Android API 还不支持矢量图块。在 Google 问题跟踪器中,您可以找到添加对矢量切片支持的功能请求(目前为 6 颗星):

https://issuetracker.google.com/issues/35830251

随时为功能请求加注星标以添加您的投票并订阅来自 Google 的通知。

于 2017-12-11T15:20:45.457 回答