ionic-team / ionic-v1

The repo for Ionic 1.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
192 stars 187 forks source link

Got “Not Found” status from google-map directional service in ionic3? #399

Open kapilSoni101 opened 5 years ago

kapilSoni101 commented 5 years ago

Short description of the problem:

Hi to all, I have implemented the directional service in ionic3 but i got error "Not Found" every time.i am not able to show polyline between 2 distance.please check my below code what the wrong in my code?

What behavior are you expecting?

I have to draw the polyline between the two distance ?


    //loadRouteList function for set current lat and long
       loadRouteList() {
      //set the service...
      let directionsService = new google.maps.DirectionsService;
         this.directionsDisplay = new google.maps.DirectionsRenderer({
            polylineOptions: {
            strokeColor: '#40710C'
           }
      });

          this.directionsDisplay.setMap(this.map);  
          this.directionsDisplay.setPanel(this.directionsPanel.nativeElement);

          //hold the start and end point in the map...
           var start  = this.routeList[0].stop_name;
           var end    = this.routeList[this.routeList.length- 1].stop_name;

          directionsService.route({
              origin: start,
              destination: end,
              travelMode: google.maps.TravelMode['DRIVING']
          }, (res, status) => {

             if(status == google.maps.DirectionsStatus.OK){
                 this.directionsDisplay.setDirections(res);
              } else {
                 console.warn(status);
              }
          });
      }```

**Which Ionic Version?** 
Ionic 3.9

I have used below link to implement the directional serveice but not working in my case why get "Not found status every time"?