Switch from Bing map to Google map [closed]
Want to improve this question? Update the question so it can be开发者_运维百科 answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this questionI am developing an application using Bing map on Silverlight. Recently, I've been asked how much time I need to switch to or support Google Maps, too.
I know Mapstraction could be a way to do it. But how difficult/time consuming this migration could be? I didn't find any testimonial on this.
Is there any alternative? Ideally, the application should support both maps.
Later Edit: Of course, the solution should be cross platform and cross browser :)
I would say there are two main areas the you need to consider - technical, and legal.
Technical
From a technical point-of-view, the Bing Maps Silverlight control is Silverlight-based (obviously!), whereas the Google Maps API is Javascript-based. Both Silverlight and Javascript are executed in the browser on the client-side but, after that, that's pretty much where the similarities end!
- Silverlight applications are generally written in C#, using a tool such as Visual Studio, and compiled before deployment.Javascript, in contrast is written in plain text and generally not compiled.
- Javascript is supported by all modern web browsers, including smartphone browsers (iOS, Android, Blackberry), whereas Silverlight applications require the client to have the Silverlight plugin installed.
- The main advantage of Silverlight is that it is capable of providing a better UX, with smoother scaling and panning, faster rendering, and is capable of displaying a greater amount of data on the map (e.g. Google Maps javascript control will generally become sluggish after a couple of hundred pushpins, whereas the Bing Maps SL control can display several thousand before slowdown is noticed.)
The technologies are totally different, so if you do decide to create a Google Maps javascript version as well as a Bing Maps SL version, expect to have to completely recode and maintain two separate versions of your application. Mapstraction won't help, because that only deals with javascript mapping providers. (You could of course use the Bing Maps v7 Javascript control, but you'd have to recode to use that as well).
Legal
As for the legal side of things, I suggest you consult the terms of use for both Google and Bing, which you can access at http://code.google.com/apis/maps/terms.html and http://www.microsoft.com/maps/product/terms.html , respectively. I'm not a lawyer, but I'd draw your attention to the following sections:
From Google terms of use:
10.1.1. General Restrictions. (a) No Access to Maps API(s) except through the Service. You must not access or use the Maps API(s) or any Content through any technology or means other than those provided in the Service, or through other explicitly authorized means Google may designate. For example, you must not access map tiles or imagery through interfaces or channels (including undocumented Google interfaces) other than the Maps API(s).
-- This would seem to expressly prohibit the sort of use that ColinE suggested, which involves hitting Google's tile servers directly from Bing Maps SL.
10.2a) No “Wrapping.” You must not create or offer a “wrapper” for the Service, unless you obtain Google’s written consent to do so. For example, you are not permitted to: (i) use or provide any part of the Service or Content (such as map imagery, geocoding, directions, places, or terrain data) in an API that you offer to others; or (ii) create a Maps API Implementation that reimplements or duplicates Google Maps.
-- This would suggest to me that, unless they have obtained express permission to do so (which they might have done, I don't know), the Mapstraction library itself breaches Google's terms of use, since it provides a wrapper layer over Google's API.
And, from Bing's terms of use:
2i.) You may not... integrate the Bing Maps Platform or any of its content with any other mapping platform;
-- It's unclear exactly what the definition of "integration" is, but I'd certainly say that any application that exposes elements of both Google Maps and Bing Maps in the same interface is integrated, and therefore breaches Bing's terms of use as well as Google's.
So, if you really want both Google- and Bing- based maps, you're going to have to create and maintain two separate versions.
The Silverlight Bing Maps control supports the concept of layers, where each layer is described by a TileSource:
<map:Map Name="map"
CopyrightVisibility="Collapsed" LogoVisibility="Collapsed" ScaleVisibility="Collapsed"
ZoomLevel="2"
CredentialsProvider="-- YOUR API KEY GOES HERE!!! ---">
<map:Map.Mode>
<mapCore:MercatorMode/>
</map:Map.Mode>
<map:MapTileLayer>
<map:MapTileLayer.TileSources>
<local:GoogleTile/>
</map:MapTileLayer.TileSources>
</map:MapTileLayer>
</map:Map>
A TileSource is a simple class which details the URL format for the source images. For example, the following TileSource can be used to render the GoogleSky maps in a Bing Maps control:
public class GoogleTile : Microsoft.Phone.Controls.Maps.TileSource
{
public GoogleTile()
{
UriFormat = @"http://mw1.google.com/mw-planetary/sky/skytiles_v1/{0}_{1}_{2}.jpg";
}
public override Uri GetUri(int x, int y, int zoomLevel)
{
if (zoomLevel > 0)
{
var Url = string.Format(UriFormat, x, y, zoomLevel);
return new Uri(Url);
}
return null;
}
}
See the following blog post:
http://www.scottlogic.co.uk/blog/colin/2011/02/google-sky-on-windows-phone-7/
So, it is very easy to supply differemt sources for your map.
精彩评论