Do you wish you could discover local farmers markets as you visited new places? Here’s a web app that makes it easy: the Market Mapper application. It uses data from the U.S. Department of Agriculture of all farmers markets in the U.S.A.
The program uses your current location to display the closest farmers markets. You can also type a place in the “location” field. As you pan the map, hit “find markets” to look for more locations.
Hovering over a marker will display the name and address of the market. Most markets will also show a list of what they sell, as well as their schedule.
If your market is missing or has outdated information, go to usdadirectoryupdate.com to manage your market’s data.
Developing the Application
I got the idea for the application at a recent DC Web API User Group meetup, where a speaker from the U.S. Department of Agriculture discussed their new farmers markets API. You can access the data on their own site at farmersmarkets.usda.gov.
It seems to always return 19 items.
I wish they had a method for finding everything inside a bounding box, like
And a way to page through results would be awesome, or at least show more than 19 markets. And there are no ways to further filter the results. It would be nice to query for markets that are open at a given date and time.
The response includes only the name of each market and the ID number. In order to place them on a map you need to make an additional call for every single market, using the ID code. The USDA could make this much more efficient by including the coordinates in the response of the main list.
Getting full details uses the following API call:
It returns only four bits of information: the address, a link to map on Google, a description of the products offered, and the schedule. I wish the results were more atomic. In order to get the latitude and longitude, I have to parse the google link. And it’s hard to do calculations on the schedule when it’s just a big string of text. We could provide a lot more functionality if the API offered more control.
But this is a good start for a government agency. I’m guessing this is the definitive list of farmers markets in the country. Try out the Market Mapper and see what you can discover.