2

Here is a link to the same question.

I would however like to have this question answered using Google Geocode. Can someone please provide me with the code to do the following, using Meteor and Blaze.

  1. Enter zip code and return array of zip codes within 10 kilometers of that zip code.
  2. Search collection users for fields profile.zipcode and display users matching zip codes in the array.

Thank you very much!

user3323307
  • 243
  • 4
  • 13
  • 1
    https://www.freemaptools.com/find-zip-codes-inside-radius.htm I want something very similar, except the radius is static. Full script can be found on the page. I just need to understand it. Any help appreciated. Thank you. – user3323307 Jun 26 '17 at 20:43

1 Answers1

0

The Geocoder gets you the location from the text string, now you have to pass this location information to your places functionality. I have wrapped the google places code inside a function and call it from geocoder.

var address = '12 Crest View Ct';

geocoder.geocode({'address': address},
    function(results, status) {
        if(status == google.maps.GeocoderStatus.OK){
        loc = results[0].geometry.location;

            var bounds = new google.maps.LatLngBounds();
            document.write(bounds.extend(results[0].geometry.location));
            map.fitBounds(bounds);
            new google.maps.Marker({
                position:results[0].geometry.location,
                map: map
            });
        place(loc); //here is the function call
        }

    }
);
Gurpreet Singh
  • 367
  • 2
  • 6