Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48983

How move only point A in Google Maps Ionic 3

$
0
0

I would like move only point A in map, how to make?

I am using watchPosition and DirectionService

To example, I generically created some locations, to simulate a user moving

arrayLatLng = [
    { lat: -1.377174, lng: -48.434815 },
    { lat: -1.376952, lng: -48.434979 },
    { lat: -1.376740, lng: -48.435148 },
    { lat: -1.376506, lng: -48.435301 },
    { lat: -1.376271, lng: -48.435518 },
    { lat: -1.376280, lng: -48.435509 },
    { lat: 1.376197, lng: -48.435553 },
    { lat: -1.376054, lng: -48.435635 },
    { lat: -1.375997, lng: -48.435669 },
]

And I created a loop method

 testeRealtime() {
    for(let i = 0; i < this.arrayLatLng.length; i++) {
        setTimeout(() => {
            let origin = { lat: this.arrayLatLng[i].lat, lng: this.arrayLatLng[i].lng };
            this.startRouteNavigation(origin);
        }, i * 7000);
    }
}

And I have the routing method to create routes

startRouteNavigation(origin){        
    this.directionsDisplay.setMap(this.map);
    this.directionsService.route({
        origin: origin,
        destination: { lat: -1.375997, lng: -48.435669 },  // Latitude e Longitude do imóvel ou corretor, 
        travelMode: google.maps.TravelMode['DRIVING'],
    }, (res, status) => {
        if(status == google.maps.DirectionsStatus.OK){
            this.directionsDisplay.setDirections(res);         
        } else {
            console.warn(status);
        }            
    });
}

would like to create a route a getCurrentPosition and, continue with watchPosition following the direction, but this way create any routes

So, I would like to know the correct way

getWatchPosition() {
     let wat = this.google.maps.watchPsition....
     this.createRoute()....
}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>