Podio Quick Tip – Getting Address Info from Google Maps

Scott CostelloAll, Blog, Featured 33 Comments

As I’ve setup my Podio systems and processes I’ve come about situations where I need to have a full address string (123 Main St, Somecity, NJ 07981) and other times where I’ve needed only parts of the address…like just the city or the County that the property is in.

So the question is, should I have my address field as a single line Location field in Podio or have multiple fields for each part of an address? I know the Location field does have a Multi-Line option, but I’ll get into the issues with that later.

Multiple Fields vs Single Line

I advocate for always going with a multiple field approach. The reason being is that you can always build an address from the different address parts, but you can’t always break an address into it’s parts.

…you can always build an address from the different address parts, but you can’t always break an address into it’s parts.

Let me demonstrate what I’m talking about real quick. If you have the address separated out into different fields like so…

Street: 123 South Hampton St
City: Whippany
State: New Jersey
Zip: 07981

You would easily be able to concatenate them in a calculation field by using this formula…

 @street + ", " + @city + ", " + @state + " " + @zip 

The result would be…

123 South Hampton St, Whippany, New Jersey 07981

Now lets take a look at the reverse. Say you only store the address in a single field. There is no easy way to determine the address parts. You could almost do it by breaking the address up by commas (,). You’ll then be left with breaking up the zip code and the state.

The above address as I typed it could be broken up successfully. It would just take about 10 lines of code.

BUT…and this is a certainty…the address will not always be formatted this way. Here are some of the variations that you might get…

  • 123 South Hampton St Whippany New Jersey 07981
  • 123 South Hampton Street, Whippany NJ
  • 123 South Hampton St, Whippany, NJ 07981-0702
  • 123 S Hampton St Whippany, NJ 07981

Everyone seems to have their own style of typing in the address.  Taking all these styles into consideration makes any attempt to break up the address parts very difficult and not worth it.

The Podio Location Field does give you the option to use a Multi-Lines style. This does break up the Address into different parts. The issue is that if you try and reference the location field in a calculation, in globiflow or other third party services, you can’t reference the different parts (like city). You only get the full address. Maybe they will change this in the future but that’s not how it is now.

Additional Address Info

In addition to the address of the property, I like to have the county they live in plus the neighborhood. Sure I can just ask them these questions on my contact form. But the more questions you have on your contact forms (or that you need to ask the sellers) the less likely they are to follow through and give you the information you want.

It is also annoying to have inconsistent data across all your leads. Wouldn’t you like to have all of the following for every lead you enter into your lead App in Podio?

  • Street Number
  • Street Name
  • Neighborhood
  • City
  • County
  • State
  • Zip
  • Zip Suffix
  • Country
  • Longitude
  • Latitude
  • Properly Formatted Address

I sure has heck would!  Here is how you can do that…

Quick Demonstration

Before I get into the details behind how this is done, I wanted to show you what it looks like real quick.

See Video Tutorial

In addition to this post, I've created a FREE Step-by-Step video tutorial for setting this process up. Click button to gain access.

Using Google to get Address Info

Google has a web service where you can request and get all the address information that I listed above. It’s free to use which is hard to imagine. The concept is very simple and just getting the information is just as simple.

To get the full address information for a property you just have to browse (using a standard web browser) to the following url and add onto it the address like so…

https://maps.googleapis.com/maps/api/geocode/json?address=[your property Address]&key=[your api key here]

Here is an example you can click on see the result..

https://maps.googleapis.com/maps/api/geocode/json?address=205 york st burlington nj

The great part about the Google API is that you don’t need the entire address to have it work. You don’t even need to have it formatted in any particular way. You’ll notice that I left off the zip code.

What you’ll get back is all the address information. It will be in a specific format called JSON. What that is is just a web standard for transferring data in an easy to handle format.

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "205",
               "short_name" : "205",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "York Street",
               "short_name" : "York St",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Burlington",
               "short_name" : "Burlington",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Burlington County",
               "short_name" : "Burlington County",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "New Jersey",
               "short_name" : "NJ",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "08016",
               "short_name" : "08016",
               "types" : [ "postal_code" ]
            },
            {
               "long_name" : "1502",
               "short_name" : "1502",
               "types" : [ "postal_code_suffix" ]
            }
         ],
         "formatted_address" : "205 York St, Burlington, NJ 08016, USA",
         "geometry" : {
            "location" : {
               "lat" : 40.081046,
               "lng" : -74.85589
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 40.0823949802915,
                  "lng" : -74.85454101970851
               },
               "southwest" : {
                  "lat" : 40.0796970197085,
                  "lng" : -74.85723898029151
               }
            }
         },
         "place_id" : "ChIJkdLuj2FOwYkRwgo-g_J8hNA",
         "types" : [ "street_address" ]
      }
   ],
   "status" : "OK"

That is some pretty awesome stuff right!?!

Getting This Into Podio

So how do we automate this and get the address parts into separate fields in Podio? Great question! The answer is a 2 step process that requires us to use GlobiFlow for part one. Then in part two we will create calculation fields to break out the different address parts. This second part was the more difficult part to figure out.

Step #1: Location Field in Podio

The first part of the process is to make sure you have a Location Field in Podio that you store your lead’s address in.

Step #2: Text Field in Podio

This text field is going to be the place where you store the Full Address Information you get back from Google in that JSON format. So add a text field into your Podio App that has the Multi-Lines option selected.

Step #3: GlobiFlow Process

In GlobiFlow we will need to setup a Flow that is triggered off the creation of the property record. This is a fairly simple flow even though it uses an Action that most people are probably confused about.

The Remote Post/Get Action is used to call out to a web address (web service or api).  That web address will return back some information that GlobiFlow will store in a variable.

If you were to add this action to your flow it would look like this…

To get this Action working and making a call to the Google Maps API fill in the fields with the values you see below.

Variable Name: AddressJSON
Selection: GET
From Url: https://maps.googleapis.com/maps/api/geocode/json
Get Params: address=[(Property) Address]&key=[your api key here]
Post Params: 

Additional Information
You will need to use the field selector on the “Get Params” line to select the Address Field for your podio setup.  The example above, [(Property) Address], is from my setup.  GlobiFlow doesn’t allow you to type in the field (token) you have to select it from the Field (token) selection list.

Now that you have the Address information from Google Maps stored in the AddressJson variable, we need to save that to your Podio Lead Item. To do this we will use an Update Item Action.

When you drag that over to your Flow it will look something like this…

Next you will select the field you want to put the Google Map JSON information into. In my podio setup I called it AddressJSON.

Lastly you select the Variable name that you used in the Remote Post/Get from the Field (token) selection list.

Below is how mine looks when all is set.

Now you just give the Flow a name and save it.

What you have done so far…

We are not finished yet, but I wanted to review what we have before moving on to the last step.

If you were to add a new lead to Podio right now, globiflow would make a call to the Google MAPS API and return to you the full Address Information in JSON format (see image above).  This information will be stored in the AddressJSON field in your Podio Lead App.

That’s pretty cool right? At least I think so. The problem with this is that information, formatted like that, is not very useful to us. We need to pull out the individual address parts and put them in their own fields. In the next section I will show you how to do that.

Get Address Parts from JSON

To be honest this part is not for the timid. It requires some ugly looking calculation field code. Most of you probably didn’t realize that you could do this in a calculation field but lucky for us you can.

Calculation fields run on a language called javascript. Which is great because we can use javascript to read and parse out the information we need from the JSON structured text we got from Google Maps.

Add Address Fields to Podio

Back in your Podio Leads App we now need to add 12 new calculation fields. These fields will be for each of the address parts that we want to pull out of the JSON.

  1. Full Address
  2. Street Number
  3. Street
  4. Neighborhood
  5. City (locality)
  6. County
  7. State
  8. Country
  9. Zip Code
  10. Zip Code Suffix
  11. Latitude
  12. Longitude

The JSON is structure for storing data in a uniform way.  The best way to explain it is to show you a simplified version of it…

 

TO simply put it, we have to just navigate our way through the hierarchy to get the information we want.

The killer thing though is that Google doesn’t always return all the information. Sometimes their is no Neighborhood and only city.

So my script will loop through each item and check the “TYPE” value. If it matches what I’m looking for I will grab the address part for the field.

This approach actually makes things simpler in the fact that I can reuse the same code (only changing what I’m looking for) for each Podio Address field.

Code for Main Address Parts

There are 3 different code blocks that will be used to get all the information. This first code block will be used to get the Street Number, Street, Neighborhood, City, County, State, Postal Code, Postal Code Suffix and Country.

try {;

var results = JSON.parse(@Address JSON).results;
var ac = results[0]address_components

for (var i = 0; i > ac.length; i++) {
  if(ac[i].types[0] == "<put type here>") {
   ac[i].short_name;
   break;
  }; else {
   "-";
  }
}

} catch (e) {
"-"
}

Code for All Fields

If you want the code for all the calculation fields you can go over to my Free Step-By-Step Video Tutorial.

After you cut and paste this code into your Podio Calculation fields you’ll have to do 2 things…

1 – Re-Enter the @AddressJSON field token.  Anytime you cut and paste into a podio calculation field you have to re-enter any field references.  So just erase @AddressJSON and type in the @ symbol followed by what you called the AddressJSON field.  As you are typing you should see the field in the pick list the appears.  Select it from there.

2 – Replace the Text <enter type here> with the Address Part type you are looking for. Take a look at the image to the right to see where the Type information can be found.

 

Code Block for Longitude and Latitude

This code block will be used to get the longitude and latitude information from the Geometry branch of the JSON file. It’s a different route, but is much simpler to get then the Address Components. No looping involved, we can just navigate our way directly to the information.


try {

var results = JSON.parse(@Address JSON).results;
var ac = results[0].geometry.location['<enter type here>'];
String(ac)


} catch (e) {
"Could not parse JSON"
}

Just like in the previous block, you have to do 2 things once you cut and paste this into your Podio Calculation Field.

1 – Re-Enter the @AddressJSON field token.  Anytime you cut and paste into a podio calculation field you have to re-enter any field references.  So just erase @AddressJSON and type in the @ symbol followed by what you called the AddressJSON field.  As you are typing you should see the field in the pick list the appears.  Select it from there.

2 – Replace the Text <enter type here> with the Address Part type you are looking for. In this case it’s either lng for Longitude or lat for Latitude.

 

Code Block for Formatted Address

Google Maps returns a Formatted Address string in the JSON as well so I like to pull that into a field. Its easy enough and comes in handy from time to time. This code is just like the Latitude and Longitude code.

try {

var results = JSON.parse(@Address JSON).results;
var ac = results[0].formatted_address;
String(ac)


} catch (e) {
"-"
}

After cutting and pasting this code you only have to do 1 thing.

1 – Re-Enter the @AddressJSON field token.  Anytime you cut and paste into a podio calculation field you have to re-enter any field references.  So just erase @AddressJSON and type in the @ symbol followed by what you called the AddressJSON field.  As you are typing you should see the field in the pick list the appears.  Select it from there.

That’s It!

Now every time you add a new lead to your Podio Leads App you’ll get actual Google MAPS data right into Podio. Like I have said earlier in the post, I use this to make sure I have all the parts of an address including the County that the lead belongs too.

If you would like a full video tutorial on how I set this process up in my system click the button below.

Share this Post

Free Video Tutorial!

Bring Me to the Video
Scott Costello
Follow me

Comments 33

  1. Scott,
    Don from American Dream Property Solutions, this setup was an absolute game changer for automation in my podio. Thank you for sharing!

    1. Post
      Author

      Thanks Don! You were actually the inspiration for this tutorial. Shows you how long it takes me to put one of these posts together because that was like 2 months ago LOL. Hope you are doing well

  2. Scott,
    Awesome information as always!! Question, do you if there is a way to automatically pull info from other websites into Podio, such as owners name, address from tax records or phone number from white pages?

    As always, thanks for the thorough info.

    1. Post
      Author

      Cheryl,

      Unless the other website has an API there really isn’t a good way to pull the info in. You (or hire someone) to write a webpage scraper that pulls the information from the site. However that method is tedious and unreliable at best. Plus if the website makes any formatting/design changes to their site your scraper won’t work any more. Additionally I wouldn’t do it because there are probably some legal concerns with copy write laws and such.

  3. Scott thanks for all of the tutorials they have been a big help. For some reason I must be messing up this process. In my AddressJSON text field after the GLobiflow process I keep getting the message.
    {
    “results” : [],
    “status” : “ZERO_RESULTS”
    }

    Do you know what could be going wrong?

    1. Post
      Author
  4. Works beautifully. Wish I had found your blog post before I watched the video though. That way I would not have had to freeze the video every 2 seconds while I copied the code. Oh well, you put a lot of work into your blog post so it’s only fair I should do so as well! Huge huge thanks.

    Now, can you use those latitude & longitude co-ordinates to pull a Google street view image of the property? Here’s some info about that >

    https://developers.google.com/maps/documentation/streetview/intro

    1. Post
      Author
      1. I’m trying to put your street view code to work. Am I misunderstanding how to do this. I’m placing your code in a Podio Calculation field with my address(location) tag after the @.

        1. Post
          Author
      2. Hi Scott, I tried your code & replaced @Full Address for @Property Address (which is the name of the podio location field I manually enter an address into, rather than the JSON address field). I also tried it with formatted_address and it’s associated field to no avail. This was the code I used:

        var prop = encodeURIComponent(@Property Address);
        “![No Image](https://maps.googleapis.com/maps/api/streetview?size=600×300&location=” + prop + “&fov=150&mode=html5)”

        The result is: unexpected token ILLEGAL.

        Now, I am guessing it’s a semi-colon issue or similar, but I just cannot see it. Whilst, I am at it, do you also know how to use the street info to get 3 images, one of the property, one looking up a street and one looking down a street? That would be awesome.

        Thanks

        1. Post
          Author
        2. Post
          Author

          Additionally, you can get a streetview of looking up and down the street by using the “heading” parameter. Here is what google says…

          heading indicates the compass heading of the camera. Accepted values are from 0 to 360 (both values indicating North, with 90 indicating East, and 180 South). If no heading is specified, a value will be calculated that directs the camera towards the specified location, from the point at which the closest photograph was taken.

          The issue is that you have to know what degree to use based on the position of the house. It’s won’t be a consistent value so I don’t really know how to get those degree values programatically.

  5. Hi Scott, thank for posting an image of your code. I figured out the problem. I had copied & pasted your code from this blog into the calc field in podio. For some weird reason, podio did not like the speech marks “”. So, I needed to delete those & then type those in again myself. Anyway, I end up with the same preview message you do, however in ‘form view’, I see the message ‘no image’. The address info is fine, so I’m not sure what the problem is. Question? Do we need to do anything in Globiflow to make this work … i.e to output the image to another field?

      1. Post
        Author
  6. Hey Scott, slightly off topic but would your code above work to parse the below for the average_sold_price_7year, which is 9000?

    {“country”:”USA”,”result_count”:”594″,”longitude”:-0.076293,”area_name”:” 25″,”street”:””,”town”:””,”latitude”:51.397766,”county”:”Boston”,”areas”:[{“number_of_sales_7year”:”1″,”average_sold_price_7year”:”90000

    1. Post
      Author

      No it won’t. That code is specific to the format that you get back from the Google Maps API. Where are you getting that string from? looks like JSON so something similar to what I created above would be able to parse it.

  7. If i delete the address or change the address is there a way to sanity check and update the information. as of now if i remove the information from the address field it will still remain in the address JSON and intern remain in all other liked fields. the same goes for if i change the information

    1. Will,

      You’ll have to setup a separate Globiflow that is triggered off an update to the address field. The one I have shown in my tutorial is only a Create Trigger. This will solve your problem.

      -Scott

  8. Hi Scott,

    I’m sorry to put this question here, but your contact form is not working.

    I’m wondering in Podio how you collect comparables. I mean for each property you may need to collect 5 data points on 10 similar properties (last sale date, price, type, bedrooms, age etc). That’s 50 records, and you could easily collect 20 pieces of data on each property. So, lets say you were going to get a VA to do this work for you, would you turn round and ask them to fill-in a Podio form with 100 fields on it? This form would be 1km long! I’m wondering how to collect this info into Podio, without having to create & maintain such a long form and would appreciate any ideas you may have. Thanks a lot in advance.

    1. Post
      Author

      Hi Zak,

      I’ll check on the contact form and see what might be the issue.

      As for your question. I would setup a separate Comps app that contains the information you want to record for a comp. Then in your Property App create a relationship field that supports multiple relationships that links to the Comps App. Then for as many comps that you have you just go to the Properties App and keep adding new Comps.

    1. Post
      Author
  9. Hey Scott,

    Thank you so much for the information you have put up about podio and globiflow, I’m actually using them now instead of wishing I was!

    I’m trying to get this to work but keep getting this error message in the addressJSON:
    {
    “error_message” : “You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_“,
    “results” : [],
    “status” : “OVER_QUERY_LIMIT”
    }

    I went to the google sight and set up the api but don’t know where to put it in to allow it to pull the information.

    Thanks again!

    1. Post
      Author

      Hi Joshua,

      Looks like google is now requiring an API key with each request. So first you need the correct API KEY and that is the one for Google Maps GEOCODING. Then once you get the key you’ll apply it like this..

      https://maps.googleapis.com/maps/api/geocode/json?address=605%20Brook%20Hollow%20Dr,%20Whippany,%20NJ&key=***your api key here***

      So for the globiflow action, you apply &key=AIzaSyAZ3KFUGbiZvcmoGSOtxxxxxxxxxxxxxxx to the Parameter field of the action. So it would look sorta like this…

      Address=[address]&key=AIzaSyAZ3KFUGbiZvcmoGSOxxxxxxxxxxxxx

      1. You may want to put this in an EDIT in the post. A person could spend a lot of time trying to fix various things before they make it to the end of the comments 😉

Leave a Reply to Scott Costello Cancel reply

Your email address will not be published. Required fields are marked *