Convert longitude and latitude to angular direction 5

0

They are sending me the longitude and latitude of a device and I have to place it on a map that I do but I have to show the latitude, longitude and direction of the device next to the map, my question is how can I convert that latitude and longitude in one direction? for example "920 S Harwood St, Dallas, TX 75201, USA" I'm using angular google maps ( link )

    
asked by pepe 29.06.2018 в 17:54
source

1 answer

0

You must use the Geocoding API, and use the reverse geocoding options.

    const lat = 45.45121212;
    const long = 45.451564;
    const TU_LLAVE = 'TU_LLAVE';
    this.http.get<{status: string, results: any[]}>(
         'https://maps.googleapis.com/maps/api/geocode/json?latlng=${lat},${long}&key=${TU_LLAVE}',
          {responseType: 'json'}
        ).subscribe(e => {
          if (e.status === 'OK') {
            console.log(e.results[0].formatted_address);
          }
        });

You can review the API documentation . There is an example below.

    
answered by 02.07.2018 / 18:20
source