Google-maps – How to add a zip code search box to the Google Map that will only search the markers

google mapsgoogle-maps-api-3

I have created a map using the Google Maps API v3.

I have created a Fusion Table with a hundred locations (markers) or so and have that successfully pulling into my map.

Now I need to add a search box to this page that will allow the user to enter their zip code and have the map zoom in to that area, then only seeing the locations in that zip code or the nearest locations to that zip code. I would also like the location data to pull into a sidebar as seen with the now deprecated Local Search API.

I have read most (if not all) of the posts that seemed to be about this, but to no luck. I feel like this shouldn't be that difficult really, I mean Google does search primarily right? Yet adding a search bar to my custom map is such a difficult task.

Any help would be appreciated, I have a deadline of tomorrow. Thanks everyone, I love it here.

Ryan

Best Answer

You will need to geocode the zip code and use the results to center the map, then show the markers that fit the bounds of the map if they are not already shown.

See http://code.google.com/apis/maps/documentation/javascript/geocoding.html

There is an example with a search box.