 Welcome back. I'm Dan. And I'm Nathan. And we're here today to talk about getting latitudes and longitudes from the Google Maps API. We're here in Scranton but we don't know exactly where we are so let's go find out. So the first thing we're going to want to do is import the trusty old OS module. We'll be using that to access an environmental variable that we stored in our operating system from the terminal. In a previous video we showed you how to do that so if you missed that one be sure to check it out. This variable is the API key that's actually going to allow us access to Google's API. So we'll store it in a variable called API key and we'll use the OS.EnvironDictionary to access the API key key as it works. So we'll store that as a variable. The next thing we're going to want to do is actually import the module Google Maps. This is where all the magic happens. This pulls out all the search results from a given search when we send it to Google Maps API specifically. If you don't have this installed it's as simple as a pip install Google Maps from your command line and you'll have it. From here we're going to start up a client. This is going to be what's actually going to connect to Google's servers and give us results. So we're going to do Google Maps GM equals Google Maps.Client and pass in key equals our API key variable. So run that. We've instantiated that object. We're going to call this next variable GeocodeResult because that's exactly what we're going to be doing is Geocoding. So we're going to go GM.Geocode with parentheses of our search. And for us right now what's going to do going to be Scranton. And then if you do complex searches you get more than one result because we only carry about the first result. We're going to just do a zero inside of brackets to get rid of the list. And then from there we can print it just to see what it looks like. And lo and behold it gives us a lot of details. And sure enough it did find us in Scranton in the US and it gave us a bunch of other details. What we're going to do is pull this out key by key because this is actually a dictionary. So just to make it a little more readable we're going to start off with printing just the keys at the top level. So if we go GeocodeResult.keys parentheses that'll give us the keys at the upper level. The one that we care about right now is just geometry because geometry is basically contains all the bounds of the area that's going to be showing you as well as the center point which is the address that we care about. And from here we've got to remove the keys. Oh part. And that'll give us the next sub thing which is just the geometry portions but that's still too much information that we want. Inside here we can see easier which keys we want. And for us we want the location because that gives us the latitude longitude of the center of this boundary. Which is the closest point to what's important to us right now. So from here we can just do this all in one line do GeocodeResults. And then in brackets for the first layer do geometry. And then in other brackets we're going to do location and sure enough this will hopefully give us a latitude longitude. So there we have it that's a pretty simple way to get the lat long. In one of the upcoming videos we'll show you how to loop through all those cities that that that Craigslist has a presence in. We'll get all the lat longs for those cities and eventually plot it on a map with the prices of all our iPhones that we searched up till next time. Thanks for joining us be sure to hit subscribe and we'll see you next time.