I am using reverse Geocoding but its not giving me all the address for an apartment block it only gives me the address of the building how do I use reverse geocoding to give me the potential addresses and also how do I search with a postcode using google Geocode to the same get same potential addresses too in a building
function getAddressByPostal(postcode: any, country: any) {
axios({
method: 'get',
url: API.PostalUrl postcode '|country:' country '&key=' API.API_KEY,
}).then((res: any) => {
function getAddressByCoord(lat: number, lng: number) {
axios({
method: 'get',
url: API.GeocodingUrl lat ',' lng '&key=' API.API_KEY,
}).then((res: any) => {
CodePudding user response:
Addresses of apartments not always available on Google Maps or the Geocoding API. When you get one, you get only one (the closest one).
You can always search (address geocoding) for an apartment address, e.g. 60 29th St. Suite #217, San Francisco returns a result that includes address component subpremise: "217"
.
When addresses with such subpremise
address components are available, they are most often found in establishment
results (busineses). I just randomly clicked in the middle of New York City (40.726145,-73.996875) and got one with the address "623 Broadway #2f, New York" and address component subpremise: "2f"
.
Note that reverse geocoding is not intended to find multiple addresses nearby a location (what is there around here?); the functionality it provides is aimed at providing multiple approximate descriptions of the actual location (where am I?).