问题
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