开发者

Android Google Maps talking to Google Maps Enterprise Data?

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 开发者_如何学Pythonyou 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.


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.


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);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜