Android Google Maps talking to Google Maps Enterprise Data?

谁说我不能喝 提交于 2020-01-25 11:14:51

问题


Is it possible to switch the Android Google Maps code to utilize custom data provided by a Google Enterprise?

Details: Google provides an "enterprise" version of its maps service, where you can host your own data. See here: http://www.google.com/enterprise/earthmaps/earth_technical.html

But Android's Maps API has no way of using any alternative data sources other than what is freely available on the web. http://code.google.com/android/add-ons/google-apis/index.html

There are other tools like Open Street Maps or AndNav, but here, I need to use Google.


回答1:


There is no API for switching the MapView data source, and since it is not open source, there's no obvious way to change it.

You can, however, use WebView to embed a standard Web-based Google Maps that could, presumably, come from your "enterprise" edition.




回答2:


With the new V2 api on android you can set the tile source by providing a custom TileProvider. I am not familiar with the enterprise offerings, but this should be possible if the tiles are available via a url. The exact implementation will depend on how the tiles are accessed, but here some code to get started:

map.setMapType(GoogleMap.MAP_TYPE_NONE);

TileOverlayOptions options = new TileOverlayOptions();

options.tileProvider(new UrlTileProvider(256, 256) {
@Override
public URL getTileUrl(int x, int y, int z) {
    try {
        String f = "http://yourURL/%d/%d/%d.png";
        return new URL(String.format(f, z, x, y));
    }
    catch (MalformedURLException e) {
        return null;
    }
}

});

map.addTileProvider(options);



来源:https://stackoverflow.com/questions/5459962/android-google-maps-talking-to-google-maps-enterprise-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!