How to reverse geocode latitude and longitude to find address


#1

Hi, friends

I’m wondering if anyone has written code to reverse geocode a latitude/longitude position and get its address.

My specific problem is for mapping integration where I need to show the address of a location selected on a map. For example, ‘221 Smith Street, Roller City, Alabama’.

I’m using the nativescript-google-maps-sdk plugin to handle the mapping, but I can’t find any way to reverse geocode coordinates to get an address.

Thanks


#2

Have you tried nativescript-geolocation?

For reverse geo you might just be able to do something like:

let url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=37.2,-110.9&key=" + apiKey;
        return this._http.get(url)
            .map(res => res.json())
            .catch(this.handleErrors);

#3

Thanks for the reply, Jeff.

Yes, I had a look at the nativescript-geolocation plugin but couldn’t see anything in it that suited.

Turns out I implemented a solution using maps.googleapis.com, very similar to your suggestion. It works quite well.

:wink:


#4

Hi mrjoe! Could you share some code where you implemented the reverse geocoding please ? i am looking into it since some weeks already but i have’nt found something useful yet. I am trying to implement it in one of my projects.


#5

@mrjoelhancock - Can I find your code somewhere public?

Thanks!


#6

As well please! Could really use the help.