Re: Address Database & Google Maps

2393 0
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast

Hey all -
My client has a list of city addresses. When the public completes certain applications, their neighbors within 400 feet need to be notified. Is there a way to use Google maps to queue the addresses (in our dataset) within 400 feet? We’d like these addresses to then be linked in a postcard table.

Data we have available to us:

Full address


6 Replies 6

Hi @Jake_Lara1
There is a Map extension that will let you see all of your address’ on a map:

I am sure there is an API that you can call to get this too, but this does sound like a fun math problem if you want to try, might need some scripting.

Ahhhhh, location science. It’s the new thing. Welcome to the CyberLandr community, Jake!

Yes. Since measurements between points are required, you need to use a haversine algorithm. These can be easily coded in javascript (see below).

Here’s what you need…

  1. The source location of the subject property and its lat/lng.
  2. The dataset of target candidate properties that could be impacted by activities at the source location; this data set must include the lat/lng for every address.

Here’s what you do…

  1. Write a script extension that reads in all the target candidate properties.
  2. Iterate across that data set to compute the distance between your source location and each target property (the distance function takes lat/lng for both and returns the distance in KM which you will convert to feet).
  3. Update the distance computed into a new field for each target property.
  4. Create a view that includes only candidates that are <= 400 (feet).
  5. Plot a map using the extension based on the view.
function distance(lat1, lon1, lat2, lon2, unit) {
    if ((lat1 == lat2) && (lon1 == lon2)) {
        return 0;
    } else {
        var radlat1 = Math.PI * lat1/180;
        var radlat2 = Math.PI * lat2/180;
        var theta = lon1-lon2;
        var radtheta = Math.PI * theta/180;
        var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);
        if (dist > 1) {
            dist = 1;
        dist = Math.acos(dist);
        dist = dist * 180/Math.PI;
        dist = dist * 60 * 1.1515;
        if (unit=="K") { dist = dist * 1.609344 }
        if (unit=="N") { dist = dist * 0.8684 }
        return dist;

@Bill.French I had a feeling this was in your wheelhouse, which is why I stopped at calling it “a fun math problem” :slightly_smiling_face:

Indeed - has some fun elements to it. When you see the first map showing the desired outcome, that’s pretty exciting. And I suspect there are other ways to get this done using Make or Zapier, but I tend to go straight for the solution that has no dependencies or possible added costs.

GeoEncoding addresses can get pricey, but I have found that a slow cache trickle is how to get millions of address locations without paying a dime. In this project, you could avoid encoding the entire data set of addresses and instead use the zip code of the source location to identify all locations with the same zip, then encode only those, and you’re ready to perform the geometry computations. This would make it possible to limit the encoding calls perhaps enough to stay in Google’s free encoding tier on a daily basis.

In fact, the distance test itself has no business running across the entire data set because homes that are 400 ft from the source location are almost never likely to have neighbours in a different zip code.

Yep, this is exactly what I was thinking. How many address’ can there be within 400ft (then I remembered Condos and Apartments exist) but even in that scenario, ZIP should be plenty.

5 - Automation Enthusiast
5 - Automation Enthusiast

Wow @Bill.French thank you I will test this next week!