In this article, we will see how we can get address location from latitude and longitude in Angular14+ by using the Reverse Geocoding technique.

What is Reverse Geocoding?

Reverse geocoding is the process to convert the latitude and longitude coordinates to a readable address.

How to Get address location from latitude and longitude in Angular14+

Generate map componenent 

ng g c map
 getAddress(lat: number, lng: number): Promise {
    return new Promise((resolve, reject) => {
      this.http
        .get(
          `https://maps.googleapis.com/maps/api/geocode/json?latlng=${lat},${lng}&key=${environment.googleMapsApiKey}`
        )
        .pipe(
          map((geoData) => {
            if (!geoData || !geoData.results || geoData.results.length === 0)
              throw null;
            return geoData.results[0];
          })
        )
        .subscribe(
          (data) => {
            resolve(data);
          },
          (e) => {
            reject(e);
          }
        );
    });
  }

and now use this function as below:

this.getAddress(23.01997577399075, 73.07245691797758);

Topics covered:

Found this article helpful?

TutsCoder tutorials are free and ad-light — supported by readers like you. Buy me a coffee (or two ☕☕) as a token of appreciation and help keep Angular & Node.js content coming!

One-time. No subscription. 100% optional. 🙏 Every coffee counts!

Leave a Comment

Your email will not be published. Spam-free zone. ✌️

Available for Projects

Need Help With Your
Angular or Node.js Project?

7+ years of MEAN Stack experience. I build scalable Angular 21 apps, Node.js APIs, and SaaS products — delivered on time, every time.

7+ Years MEAN Stack Angular 21 + Nx Expert 20+ Projects Delivered Remote / Freelance