在Google Map API中检索公交线路或地铁上的详细信息

文森特·弗洛里奥(Vincent Floriot)

我正在寻找类似此网站的内容:WEBSITE GMAPS

目前,我可以得到500米左右的所有东西,例如,如果是公共汽车站或其他东西,但我无法找回公交线路。

var mapControl = $scope.map.control.getGMap();
        service = new google.maps.places.PlacesService(mapControl);
        var transitLayer = new google.maps.TransitLayer();
        transitLayer.setMap(mapControl);
        var directionsService = new google.maps.DirectionsService();

        service.search(request, callback);

        function callback(results, status) {
            if (status == google.maps.places.PlacesServiceStatus.OK) {
                $scope.placesTransit = [];
                $scope.timeTotal = [];
                angular.forEach(results, function(result, key) {
                    var timeTotal;
                    directionsService.route(
                    {
                        origin: new google.maps.LatLng($scope.map.center.latitude, $scope.map.center.longitude),
                        destination: result.geometry.location,
                        travelMode: google.maps.DirectionsTravelMode.WALKING,
                        unitSystem: google.maps.UnitSystem.METRIC
                    }, function (response, status)
                    {
                        if (status == google.maps.DirectionsStatus.OK)
                        {

                            result.timeTotal = response.routes[0].legs[0].duration.text;
                            if (result.types[0] === "subway_station") {
                                result.typeTransport = "Métro";
                            }
                            console.log(result);
                            $scope.placesTransit.push(result);
                        }
                    });
                });
            }
        }

如果有人可以帮助我该怎么做:显然我可以在此页面上检索此信息,但是使用Google MAP API v3并没有获得此信息。任何想法 ?谢谢

烈火凤凰

是的,Google在哪里可以获取有关公共交通的信息。

首先,您需要检查您的城市是否受支持:

然后,如果支持,您可以在此处获取更多信息:

要以编程方式访问它,可以使用以下两个API:

我会选择第二个。

考虑到这一点,如果您要检查的公司已注册,您将能够轻松访问其所有公交路线(甚至更多)。

但是,如果未列出公司,则表示他们在您看到的地图上编码了路径,并且您必须使用叠加层进行相同的操作:

希望能帮助到你!

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何在Google Map中显示有关分支的详细信息?

来自分类Dev

Google Map Engine API中的信息窗口

来自分类Dev

Google Map API错误

来自分类Dev

Google Map Maker API?

来自分类Dev

tableView中的Google Map

来自分类Dev

Google Map中的警告

来自分类Dev

如何在响应式Google Map旁边添加联系人详细信息

来自分类Dev

显示google map方向详细信息时滚动div问题

来自分类Dev

如何在响应式Google Map旁边添加联系人详细信息

来自分类Dev

检索城市的位置Google Map API

来自分类Dev

iPhone上的Google Map异常

来自分类Dev

在Google搜索详细信息之后从json检索信息

来自分类Dev

在 JPQL 查询中应用新的 map() 函数以检索带有列详细信息的结果

来自分类Dev

显示Google Map onclick事件-Google Map API

来自分类Dev

Google Map是否需要API?

来自分类Dev

Google Map javascript API密钥

来自分类Dev

Google Map是否需要API?

来自分类Dev

分组集群Google Map API

来自分类Dev

Google Map API如何工作?

来自分类Dev

Google Map API-Infowindow显示Google Place API信息

来自分类Dev

Google Map API-Infowindow显示Google Place API信息

来自分类Dev

无法在Android的Google Map活动中显示Google Map

来自分类Dev

Google Map在iOS中闪烁

来自分类Dev

Android中的Google Map Directions

来自分类Dev

在Fragment中呼叫Google Map

来自分类Dev

Google Map中的方向链接

来自分类Dev

在IOS中从Google Map Place API提取要求信息

来自分类Dev

Google Fit:API仅获取数据源的详细信息,而不获取nodejs中卡路里的详细信息

来自分类Dev

从Google检索用户详细信息-应该很简单吧?