谷歌地图API不会在不同的大洲绘制 [英] Google map API does not plot on different continents

查看:136
本文介绍了谷歌地图API不会在不同的大洲绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用谷歌地图API绘制在谷歌地图航点

I have used the google map API to plot a way point on google map

我提到的以下页面:

https://developers.google.com/maps/documentation/javascript/directions

在路线部分中使用航点,并修改它一下,以仅积3地图上的点。
下面是我的javascript code。

'Using Waypoints in Routes section' and modified it a bit so as to plot only 3 points on the map. The following is my javascript code.

var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;

function initialize() {
    directionsDisplay = new google.maps.DirectionsRenderer();
    var initialloc = new google.maps.LatLng(12.971599, 77.594563);
    var mapOptions = {
        zoom : 6,
        mapTypeId : google.maps.MapTypeId.ROADMAP,
        center : initialloc
    }
    map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
    directionsDisplay.setMap(map);
    calcRoute();

}

function calcRoute() {
    var lat = new Array();
    var lon = new Array();

    var start = new google.maps.LatLng(12.971599,77.594563);
    var mid = new google.maps.LatLng(12.971558,77.594552);
    var end = new google.maps.LatLng(12.971558,77.594552);

    var waypts = [];
    waypts.push( {
        location : mid,
        stopover : true
    });


    var request = {
        origin : start,
        destination : end,
        waypoints : waypts,
        optimizeWaypoints : true,
        travelMode : google.maps.DirectionsTravelMode.DRIVING
    };
    directionsService.route(
                    request,
                    function(response, status) {
                        if (status == google.maps.DirectionsStatus.OK) {
                            directionsDisplay.setDirections(response);
                            var route = response.routes[0];

                        }
                    });

}

这工作完全正常,如果3个位置是同一个国家内,也就是说他们有一个路线图。

which works perfectly fine if the 3 locations are within same country, ie they have a road map.

我的问题是如何绘制地图时的位置是在不同的大洲如印度和澳大利亚的?

My question is how to plot the map when the location are in different continents eg India and Australia?

任何人都可以请帮助。

先谢谢了。

推荐答案

问题是不是不同的大洲,但无论是路由引擎的数据库中有所有你的起点和终点之间的国家,包括汽车轮渡信息。你可以看到,同样发生在maps.google.com。 <一href=\"https://maps.google.com/maps?saddr=Bergev%C3%A4gen&daddr=MSH%203&hl=en&ie=UTF8&sll=28.304381,43.945313&sspn=142.933439,321.679688&geo$c$c=FXIfsQMd7K7DAA;FWK3NQEdchSnBA&mra=dme&mrsp=1&sz=2&t=m&z=2\"相对=nofollow>下面是从欧洲到印度的航线洲际的,但如果你尝试将B标记移到美国或加拿大,它没有得到一个途径,因为它不知道对面渡​​轮大西洋。
你可以看到在这是什么国家有被覆率S preadsheet

The problem is not about different continents, but whether the routing engine's database has information about all the countries between your start and endpoints, including car ferries. You can see that the same occurs in maps.google.com . Here's an intercontinental route from Europe to India, but if you try to move the B marker to the US or Canada, it doesn't get a route because it doesn't know a ferry across the Atlantic. You can see what countries have coverage in this spreadsheet.

这篇关于谷歌地图API不会在不同的大洲绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆