Code Examples and Mapping Slides from Class 10, plus assignment 8

Code Examples are here. Lecture slides are here.

For more on maps and mapping:

For homework, following example code in xmldemo.pde, use the flickr api’s photo.search method to get information on photos posted in a certain group, or taken at a certain location. You can use a place_id, a group_id, a tag keyword, or a WOEID as a parameter in your function call. You will need to have a flickr account, and get an API key in order to use the API.

You can get a group ID using this handy tool.

Flickr has a places_id function that will return place_ids when given a place name (you can use the explorer interface to search for a particular place_id by typing the place name in the box, for example “Bennington” and then look in the xml that the explorer returns for the place id you want. For Bennington, the explore returns several, but the id I am looking for is “g4IJssKbAppRLV1U”, which I can now use as a parameter when I call photo.search in my Processing program).

You can also use WOEIDs (also known as Where On Earth IDs) to specify a place. Here’s a tool that helps you find them.

What to do with the photos when you get them? The sample program takes only the first photo and displays it. But you could save information on all the photos in an array, and display all the photos. You could get average pixel color information from all the photos and use it somehow in your program– for example, to display a generic “photo” created from all the pixel data of all the photos . If you searched for photos by tag or group, you could save and storeĀ  the photos’s unique IDs, and then make another call to flickr to get the location (lat and long) where the photo was taken, by making a second call to the api, using the photos.geo.getLocation function. There are endless possibilities! Look around the API and see what you can think of. It’s OK if you run into problems, we’ll troubleshoot and go over the process in class on Wednesday (the plan day, we’ll start at 9). Feel free to email me with problems. I will be around on Sunday for extra help, and available all day next Wednesday for meetings.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>