I want to know if possible get the country code or the country from a location (logitude and latitude), using the angular2-google-maps library.
private setCurrentPosition() {
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition((position) => {
this.latitude = position.coords.latitude;
this.longitude = position.coords.longitude;
this.zoom = 12;
});
}
}
You have to reverse geocode to get that kind of information
map.service.ts
map.component.ts
There may be better ways but this is how I got mine working.