[Solved] Google geocoding precision

Hi,

so I’ve been playing with the google maps geocoding api and I noticed that when I click on a building the returned street address isn’t right.

for example:
I clicked on all the building across my current location and the majority of the address returned the same, something like 5 out 7 buildings returned the same address.

when i click on my current location it may return the address of my actual location or the address of the building across the street.

I tried to duplicate what I was seeing on my project on the google maps app and I was able to duplicate it, if I really tried too…I zoomed in all the way on a building, and clicked on the corner of the property it may give me the next address over but if I click on the center of the building it will always return the right address.

I wonder if am doing something funny with my block, i looked through the google maps api dev documentation and stack overflow to see what other tests i could run but didn’t see much info…any suggestions would be greatly appreciated.

Thanks!!!

1 Like

ugh well, after walking around and looking at my JSON responses I think part of the issue was
the &result_type=street_address turns out that “street_address” will not necessarily match the actual building address, i made the mistake of assuming it always would.

So for now I will leave the result_type out of my expression. so far leaving that out has been correct every time on all my tests.

2 Likes

Thanks for the update! I like thisnidea you have. Could you share the working code?

really cool idea… :+1:

sure… let me clean my blockspace I have a lot of random things floating around :rofl:

but I simply was playing with the api’s “filter by type” to see what I could get

/intro#reverse-restricted

The following example filters the addresses returned to include only those with a location type of ROOFTOP and an address type of street_address.

https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452
&location_type=ROOFTOP&result_type=street_address&key=YOUR_API_KEY

here is an image that sort of helps understand what the different locations types can be (other APIs outthere offer more options)…after doing some digging I can understand how two

buildings can share the same “street_address” or at least their definition of it

2 Likes