Aaron Straup Cope > Net-Flickr-Geo-0.65 > Net::Flickr::Geo::ModestMaps

Download:
Net-Flickr-Geo-0.65.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.65   Source   Latest Release: Net-Flickr-Geo-0.72

NAME ^

Net::Flickr::Geo::ModestMaps - tools for working with geotagged Flickr photos and Modest Maps

SYNOPSIS ^

 my %opts = ();
 getopts('c:s:', \%opts);

 #
 # Defaults
 #

 my $cfg = Config::Simple->new($opts{'c'});

 #
 # Atkinson dithering is hawt but takes a really long
 # time...
 #

 $cfg->param("modestmaps.filter", "atkinson");
 $cfg->param("modestmaps.timeout", (45 * 60));

 #
 # Let's say all but one of your photos are in the center of
 # Paris and the last one is at the airport. If you try to render
 # a 'poster style' (that is all the tiles for the bounding box
 # containing those points at street level) map you will make 
 # your computer cry...
 #

 $cfg->param("pinwin.skip_photos", [506934069]);

 #
 # I CAN HAS MAPZ?
 #

 my $fl = Net::Flickr::Geo::ModestMaps->new($cfg);
 $fl->log()->add(Log::Dispatch::Screen->new('name' => 'scr', min_level => 'info'));

 my $map_data = $fl->mk_poster_map_for_photoset($opts{'s'});

 #
 # returns stuff like :
 #
 # {
 #  'url' => 'http://127.0.0.1:9999/?provider=YAHOO_AERIAL&marker=yadda yadda yadda',
 #  'image-height' => '8528',
 #  'marker-484080715' => '5076,5606,4919,5072,500,375',
 #  'marker-506435771' => '5256,4768,5099,542,500,375',
 #  'path' => '/tmp/dkl0o7uxjY.jpg',
 #  'image-width' => '6656',
 # }
 #

 my $results = $fl->upload_poster_map($map_data->{'path'});

 #
 # returns stuff like :
 #
 # [
 #   ['/tmp/GGsf4552h.jpg', '99999992'],
 #   ['/tmp/kosfGgsfdh.jpg', '99999254'],
 #   ['/tmp/h354jF590.jpg', '999984643'],
 #   [ and so on... ] 
 # ];
 #

DESCRIPTION ^

Tools for working with geotagged Flickr photos and the Modest Maps ws-pinwin HTTP service.

OPTIONS ^

Options are passed to Net::Flickr::Backup using a Config::Simple object or a valid Config::Simple config file. Options are grouped by "block".

flickr

pinwin

modestmaps

PACKAGE METHODS ^

__PACKAGE__->new($cfg)

Returns a Net::Flickr::Geo object.

OBJECT METHODS ^

$obj->mk_pinwin_map_for_photo($photo_id)

Fetch a map using the Modest Maps ws-pinwin API for a geotagged Flickr photo and place a "pinwin" style thumbnail of the photo over the map's marker.

Returns an array of arrays (kind of pointless really, but at least consistent).

The first element of the (second-level) array will be the path to the newly created map image. If uploads are enabled the newly created Flickr photo ID will be passed as the second element.

$obj->mk_pinwin_maps_for_photoset($photoset_id)

For each geotagged photo in a set, fetch a map using the Modest Maps ws-pinwin API for a geotagged Flickr photo and place a "pinwin" style thumbnail of the photo over the map's marker.

If uploads are enabled then each map for a given photo will be added such that it appears before the photo it references.

Returns an array of arrays.

The first element of each (second-level) array reference will be the path to the newly created map image. If uploads are enabled the newly created Flickr photo ID will be passed as the second element.

$obj->mk_poster_map_for_photoset($set_id)

For each geotagged photo in a set, plot the latitude and longitude and create a bounding box for the collection. Then fetch a map for that box using the Modest Maps ws-pinwin API for a geotagged Flickr photo and place a "pinwin" style thumbnail for each photo in the set.

Automatic uploads are not available for this method since the resultant images will almost always be too big.

Returns a hash reference containing the URL that was used to request the map image, the path to the data that was sent back as well as all of the Modest Maps specific headers sent back.

$obj->upload_poster_map($poster_map)

Take a file created by the mk_poster_map_for_photoset and chop it up in "postcard-sized" pieces and upload each to Flickr.

Returns an array of arrays.

The first element of the (second-level) array will be the path to the newly created map image. If uploads are enabled the newly created Flickr photo ID will be passed as the second element.

$obj->crop_poster_map($poster_map)

Take a file created by the mk_poster_map_for_photoset and chop it up in "postcard-sized" pieces.

The height and width of each piece are defined by the pinwin.crop_width and pinwin.crop_height config options.

Any image whose cropping creates a file smaller than either dimension will be padded with extra (white) space.

Returns a list of files.

VERSION ^

0.65

DATE ^

$Date: 2008/03/17 15:59:13 $

AUTHOR ^

Aaron Straup Cope <ascope@cpan.org>

EXAMPLES ^

http://flickr.com/photos/straup/tags/modestmaps/

REQUIREMENTS ^

Modest Maps 1.0 or higher.

http://modestmaps.mapstraction.com/

NOTES ^

All uploads to Flickr are marked with a content-type of "other".

SEE ALSO ^

Net::Flickr::Geo

http://modestmaps.com/

http://mike.teczno.com/notes/oakland-crime-maps/IX.html

BUGS ^

Sure, why not.

Please report all bugs via http://rt.cpan.org

LICENSE ^

Copyright (c) 2007-2008 Aaron Straup Cope. All Rights Reserved.

This is free software. You may redistribute it and/or modify it under the same terms as Perl itself.