Use Bing to geocode and Google maps api to display the map
I have an application which is currently using the google map API. I like the maps much better, and I feel like you have more options with google maps. The problem is, Google maps has been very inaccurate when I give it an address to map, while Bing has been 100% on so far. I also like Bings Birds Eye view, but that's not as important. My question is, can I use the Bing API to take the address that I give it, return a longitude and latitude and then give that to my existing Google map to plot the point. If so, how? I looked on Bing Maps, and I couldn't find a good way to geocode an address. Below is my current google开发者_运维技巧 maps code
var map;
var directionsPanel;
var directions;
function initialize() {
map = new GMap(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(41.1255275,-73.6964801), 15);
directionsPanel = document.getElementById("route");
directions = new GDirections(map, directionsPanel);
directions.load("from: ADDRESS 1 to: ADDRESS 2 ");
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
}
I want to replace ADDRESS 2 with the longitude and latitude which Bing gets
As Matt Phillips suggests, you should read the terms of service: http://www.microsoft.com/maps/product/terms.html
There is a restriction regarding combining different map services:
Restrictions on your use: We do have some restrictions on your use of the service. You may not:
...
- integrate the Bing Maps Platform or any of its content with any other mapping platform;
The Google terms of service are also quite strict and I'd imagine they'd have a similar restriction.
Looks like you should check out the Bing Maps API licensing to see if thats really the road you want to take. If it is then I would suggest looking at the api to see how you can do that.
You can use the Bing Locations API.
Here is an article on how to Find a Location by Address. You can then use the latitude and longitude to give to Google Maps.
AFAIK, the Bing Maps Ajax Control does not support Geocoding. You will need to use their web services: SOAP or JSON or XML.
精彩评论