Recently, I assigned a GIS problem set to my students and had them geocode addresses to obtain latitude and longitude coordinates using mqgeocode in Stata. The reason I had them use mqgeocode and not geocode3 is because the latter is no longer available through ssc. Does anybody know why? Somebody please tell me. What's the difference between the two? One difference between the two is that mqgeocode uses MapQuest API and geocode3 uses Google Geocoding API.
Anyway, after my students downloaded mqgeocode, I received several emails from students letting me know that they could not obtain coordinates no matter what format the addresses were in. See below:
What? No coords? Why not? With the help of the nice people over at www.wmatsuoka.com we dug a little deeper and saw that the API key in that program had probably hit its limit which is why it wasn't returning any coordinates.
A quick fix for that is to replace the two lines in that ado file with your personal API key. How do you get a MapQuest API key? Just sign up for one here. It's pretty quick and fairly easy. Then look for the lines "local osm_url1 =" and put in your own API key. I put in my API key in a local called `apikey' which was passed on to the following lines in that program. The following two lines correspond to lines 47 and 141 of the mqgeocode.ado file, respectively: local osm_url1 = "http://open.mapquestapi.com/geocoding/v1/reverse?key=`apikey'&location=" local osm_url1 = "http://open.mapquestapi.com/geocoding/v1/address?key=`apikey'&location=" I renamed that ado file and program as mqgeo2 and quickly got to geocoding:
And voilà! We now have latitude and longitude coordinates for our address which happens to be the California State Capitol building.
Ta da! This is what (old) MapQuest looks like (I miss Google already)
2 Comments
Hello! It's been too long. I'm sorry for the lack of content. I'll make up for it soon, I promise. Here's the Fitbit step comparison for February with Will. Unfortunately for me I didn't beat Will last month, but here's to hoping March changes that! My February daily step average was 12,169 with a total of 352,914 monthly steps. Will's February daily step average was 14,370 with a total of 416,748 monthly steps. We are both training for half marathons, so we ran about 9 or 10 miles on those two days with spikes. Yes! We both got above 30,000 steps on the same day. Will's new personal record is 30,912 while mine is a tiny bit higher at 31,975. Sorry, not sorry, Will. I missed goal 3 times last month. I was sick in the beginning of the month with an annoying cough due to running during a rainy day with crazy winds. That cough kept me from training for a good 2 weeks. Excuses, I know, but hey! it's true. Now that I've had my Fitbit for a little over a year, I can make annual comparisons. My February 2015 daily step average was: 10,471 with a monthly total of 293,196. In terms of totals, that's about 17% lower than this year (taking the extra day into account). Talk about healthier habits thanks to half-marathon training-- maybe I should keep this up and actually turn into a runner. Last year I missed goal 11 times and interestingly for both years I didn't meet goal on February 6th. This year it was due to being bedridden with a cold and last year it was due to commuting from San Diego to Glendale. I thought it was interesting how my total daily steps are almost exact. My half marathon is in just a few days. That should be a nice spike on next month's update. Wish me luck!
|
AuthorMy name is Belen, I like to play with data using Stata during work hours and in my free time. I like blogging about my Fitbit, Stata, and random musings. Archives
March 2018
Categories
All
|