Expo Location. Set language for reverse geocoding.
See original GitHub issueHi!
I am not sure if this is possible to specify the language for the returned results using your Location API… but looking at the code I have seen that the only option which can be passed is “useGoogleMaps”.
/**
* An object of options for forward and reverse geocoding.
*/
export declare type LocationGeocodingOptions = {
/**
* Whether to force using Google Maps API instead of the native implementation.
* Used by default only on Web platform. Requires providing an API key by `setGoogleApiKey`.
*/
useGoogleMaps?: boolean;
};
Fetching the Google Maps API, it is possible to do something like this:
fetch(
`https://maps.googleapis.com/maps/api/geocode/json?latlng=${coordinate.latitude},${coordinate.longitude}&key=${Constants.manifest.ios.config.googleMapsApiKey}&language=en`
)
But we will have to parse an array of objects by types
"address_components" : [
{
"long_name" : "5",
"short_name" : "5",
"types" : [ "street_number" ]
},
{
"long_name" : "Calle Fernández Caballero",
"short_name" : "Calle Fernández Caballero",
"types" : [ "route" ]
},
{
"long_name" : "Cieza",
"short_name" : "Cieza",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Murcia",
"short_name" : "MU",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Región de Murcia",
"short_name" : "Región de Murcia",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Spain",
"short_name" : "ES",
"types" : [ "country", "political" ]
},
{
"long_name" : "30530",
"short_name" : "30530",
"types" : [ "postal_code" ]
}
],
for getting an object like the one your api returns:
/**
* Type representing a result of `reverseGeocodeAsync`.
*/
export declare type LocationGeocodedAddress = {
city: string | null;
district: string | null;
street: string | null;
region: string | null;
subregion: string | null;
country: string | null;
postalCode: string | null;
name: string | null;
isoCountryCode: string | null;
timezone: string | null;
};
It would be good to have something like this:
Location.reverseGeocodeAsync(coordinate, { lang: "en" });
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Location - Expo Documentation
An object representing a location. Reverse geocode a location to postal address. Note: Geocoding is resource consuming and has to be used reasonably....
Read more >How to use google reverse geocoding with react native Expo?
You don't need a library for reverse geocoding from LatLon, you can just call Google Maps API directly like:
Read more >How to use Geolocation, Geocoding and Reverse ... - Enappd
In this post, you will learn how to implement Geolocation React native apps. We will also learn how to Convert Geocode in Location...
Read more >how to get address from lat long in react native ... - YouTube
how to get address from lat long in react native expo. get Current location address in React native. expo. location to reverse geocode...
Read more >react-native-geocoding - npm
A React Native module to transform a description of a location (i.e. ... set the language // Search by address Geocoder.from("Colosseum") ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Location.reverseGeocodeAsync(coordinate, { lang: “en” }); I am looking for an update to return the results in english.
Hello! Our GitHub issues are reserved for bug reports.
If you would like to request a feature, please post to https://expo.canny.io/feature-requests.