如何在谷歌地图中的两个坐标之间创建线?

时间:2015-04-30 06:52:50

标签: angularjs cordova ionic-framework ionic

我需要在当前位置和目的地之间画线,我手边都有坐标,我怎么能用离子?

$scope.init = function() {
        var mysrclat=completedtasks['locationLatitude'];
        var mysrclong=completedtasks['locationLongitude'];

        var myLatlng = new google.maps.LatLng(mysrclat,mysrclong);
        var mapOptions = {
            center: myLatlng,
            zoom: 16,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById("map"),
            mapOptions);

        //Marker + infowindow + angularjs compiled ng-click
        var contentString = "<div><a ng-click='clickTest()'>Click me!</a></div>";
        var compiled = $compile(contentString)($scope);

        var infowindow = new google.maps.InfoWindow({
            content: compiled[0]
        });

        var marker = new google.maps.Marker({
            position: myLatlng,
            map: map,
            title: '(Ayers Rock)'
        });

        google.maps.event.addListener(marker, 'click', function() {
            infowindow.open(map,marker);
        });

        $scope.map = map;
    };

目前我使用它来显示当前目的地位置,我需要在当前位置和目的地位置之间画一条线

0 个答案:

没有答案