December, 2011 Archives

The word best is hopelessly subjective, so it’s nice to lean on a cold, impersonal algorithm like Flickr’s interestingness, a ranking derived from views, faves, and comments (the formula itself is of course subjective, but at least it’s applied uniformly).

My app for the best photos of 2011 does a separate search for each month, letting you pick how many photos to display for each month. For most of the links below I’m showing 12 per month, but you can easily edit the URL to change that, or use the Configuration Panel.

The fun comes in selecting how to narrow down which photos to review. You can select users: » Continue Reading…

If you want a simple way to translate written descriptions of places into latitudes and longitudes, the Google Geocoding API offers an easy solution. Up to now, I’d been allowing users to restrict searches geographically by entering a bounding box (the latitude and longitude of two corners) or the WOE codes (see Using “Where on Earth” Codes in Flickr).

The Trackr Panel includes an input labeled place. It accepts a textual description of a place, like a city, neighborhood, landmark, or ZIP code (try “Dupont Circle” or “National Mall”). That value is simply passed to the PHP program via the URL; it’s the PHP program that must now decipher the place.

You can handle web services with the simplexml_load_file function, which turns an XML file (the web service) into an object. The following code breaks this down thus, first building the web service’s URL, then seeing if it can get a valid XML response: » Continue Reading…

Using the Google Geocoding API

To demonstrate the power of the Google Maps JavaScript API, I wrote a program to manipulate geotagged Flickr photos on a map. The Trackr app makes photos appear in the order they were taken, in sync with an animated timeline.

It’s similar to the Mappr app (see A Better Way to Map Photos). Once Mappr’s photos auto-disperse from each other, its map is static until you hit a key to assign the photos to new positions. Trackr’s photos don’t move; instead, their appearance reflects the set’s timeline.

The program is entered via the Trackr Panel, where you configure it to select which photos to display and how to display the photos. The panel builds parameters for the URL for the PHP program, where the real work takes place. » Continue Reading…

The Mappr project used Google Maps JavaScript API V3 to create a dynamic map onto which Flickr’s geotagged photos could be added. (See A Better Way to Map Photos.) But just because you’re using the Google API doesn’t mean you’re limited to Google maps. They make it easy to include other maps, the best of which is from the OpenStreetMap Foundation.

The OpenStreetMap project offers geographical data free of use. They are created collaboratively, letting everyone post map data, much the way Wikipedia works. The two samples below aren’t substantially different, other than for the color of the water. Google is on the left; OpenStreetMap is on the right.

The google.maps.Map new constructor has a parameter called mapTypeId which lets you pick which options the user will see. The default choices are ROADMAP and SATELLITE. Google also offers HYBRID and TERRAIN. The following code will create a new object for mapTypeIds. » Continue Reading…

Previous projects combined geotagged Flickr photos with the Google static maps, but the data was presented side-by-side. To truly combine the data, I went from Static Maps API V2 to Google Maps JavaScript API V3. (ShowPix used static maps; see Using “Where on Earth” Codes in Flickr.)

The JavaScript maps are dynamic, multilayered elements that you can manipulate through the document object model (DOM). Of course, that increases their complexity, because now you have server-side code writing JavaScript to be executed on the client side.

Mappr is a small browser app that displays geotagged photos on a map. In order to keep the display free of controls, it has a separate control panel where you configure which photos to display, and how to display the photos. The Mappr Panel is the starting point for the app. » Continue Reading…

Many of the methods available in the Flickr API require an argument called “user_id,” for which you provide the user’s NSID. Flickr doesn’t seem to spell it out, but NSID typically means network services identification. Flickr users will often refer to it as the “at” number, since they all contain the @ symbol, like 77945684@N00.

When a user creates their Flickr account, the NSID (assigned by Flickr) appears in the web addresses for the photos and profile. But once a user picks a custom alias for their web addresses, it can be hard to find their NSID. An easy trick to finding it is by clicking on any user’s icon (including your own). There are also mini applications on the web that make it easy, such as Fusr and idGettr.

I created my own app, Flickr Findr, allowing you to discover the NSID given a user’s name, email, or alias. It works by sending the input to up to three Flickr API methods, stopping when an NSID is found. The first method is flickr.people.findByUsername, followed by flickr.people.findByEmail and then flickr.urls.lookupUser.

Finding a Flickr User’s ID

The previous version of the ShowPix app used a bounding box to look for geotagged photos (see Searching Time & Place by Interestingness on Flickr). But if you want to search within a political boundary, most of the time a rectangle won’t be a good fit. The Flickr API offers two solutions, both in the flickr.photos.search method: woe_id (where-on-Earth identifier) and place_id.

The place ID codes are used only within Flickr, while WOE ID codes are supported by Yahoo! Geo Technologies. (Flickr was founded in 2004, and bought by Yahoo in 2005.) So, I’m going to play with WOE ID codes since they can be reused by applications other than Flickr. Yahoo has a Key Concepts page that explains how WOE IDs work.

The app now accepts WOE IDs in place of the bounding box, which significantly shortens the URL. But first you need to find the WOE ID to use in the call. One place to start is Flickr’s Geo API Explorer, which starts off with the parent (or should I say, mother) of all other places, the Earth itself, which unsurprisingly has a code of 1. » Continue Reading…

The “Diary” project showed a map for each day of a user’s activities (see Creating a Geographic Diary via Flickr). How about if we try to discover who else was taking photos at the same place and time?

I wrote a small app called ShowPix to show the most interesting geotagged photos on Flickr for a given time and place, using Flickr’s “interestingness” metric. It works like this:

mvjantzen.com/flickr/showpix.php?mindate=2011-12-17 00:00:00&maxdate=2011-12-17 23:59:59&minlat=38.791867&minlon=-77.119775&maxlat=38.995482&maxlon=-76.909318

It’s a long URL, but fairly straightforward. The mindate and maxdate parameters assign the date and time range, while minlat, maxlat, minlon and maxlon assign the latitude and longitude. In this example I picked a 24-hour period on December 17, 2011 (the date of Santarchy), and the bounding box for the District of Columbia. Because D.C. isn’t rectangular, it also includes parts of Virginia and Maryland. » Continue Reading…

Yoga ShopFormer spa now Tranquil Space Labs (1632 17th St): Crafty Use of Yoga Studio Tranquil Space Labs plans to provide a new home for off-the-mat and off-the-wall ideas.

Bethesda Bagels now open in former Johnny Rockets (1718 Connecticut Ave).

Deli coming to 1317 Connecticut Ave next summer: DGS Delicatessen to Open in Dupont Circle.

Irish Whiskey Public House coming to 1807 19th St: Irish Whiskey Set to Open in Dupont in Early January.

That was Fast – Cosi Reopens in Dupont (1350 Connecticut Ave).

Rubble in the CongoState Department To Republic Of Congo: Rip Up Embassy Driveway; Embassy complied: Neighborhood concrete problems get fixed, Fixing Up Embassy, Congo Republic Raises Hackles in Capital.

Dupont Circle resident fined $2,000: DC Resident Fined Thousands For Not Recycling Cat Litter. » Continue Reading…

Dupont Circle Roundup: Dec 22, 2011

December 2011 brought the return of Santarchy to the city, bringing the magic of Christmas to participants and onlookers alike. Hundreds of people dressed as Santa Clause converged on the National Mall for an afternoon of merriment.

Christmas Memories
» Continue Reading…