Open MrFarhan opened 1 year ago
Is there any one?
The same issue is happening to me, however, it is not related to react-native-geocoding, as Google Place API doesn't return a postal code if it does not recognize an address as a real one
For example, if you pass latitude and longitude of any plain surface (which might be any playground, park, or any empty place) which is near any house, society, or building in this scenario, you will not get postal code, but if you move a bit and pass longitude and latitude of a building or house number which has possibly street number and house number, you will get postal code.
Try to pass a lat and lng of a valid address
Another workaround is you can do something like
const latitude = centralLatitude + (Math.random() - 0.5) * offset;
const longitude = centralLongitude + (Math.random() - 0.5) * offset;
Example for offset 0.01
To get a postal code, you can call APIs with random lat, lng (which should be close to your central lat, lng)
Make sure to use the least value in order to get nearby lat lng.
Is there a way to get proper and in separated fields from address, i am using
react-native-geocoding
to get address from lat and lng but the issue is i am not getting proper address means zip is missing some times and sometimes other fields.I am using following code to extract details from this npm, do we have any better approach to extract data ?
I need following fields from this npm by providing lat and long:
Note: I tried the famous places in my country but it doesn't return complete result.