Increasing number of photos displayed from Flickr

2735
6
07-01-2016 08:30 AM
AshleyPeters
Occasional Contributor III

I am currently pulling in the Flickr geofeed into my map, based on this sample: Flickr data as graphics on a map | ArcGIS API for JavaScript 3.17. It is working beautifully.

Right now, I only see 20 photos on my map. I have 65 geotagged photos in the feed (single user's photos) that I'm pulling. I also limit what I am pulling by using tags. The default number of photos to show looks to be 20, but I'm guessing there is a way I can increase that number. I haven't been able to find how to do that though. Has anyone else run into this and how did you resolve it?

Thanks in advance for your help!

0 Kudos
6 Replies
AshleyPeters
Occasional Contributor III

I'm continuing to try to resolve this issue. I think it will require me using the Flickr API. Has anyone else dealt with this?

0 Kudos
KellyHutchins
Esri Frequent Contributor

I think you are correct and you'll need to use the Flickr API in order to request additional photos although this thread suggests you may be able to use Yahoo Pipes to create an RSS Feed.

How to Display More Than 20 Photos in a Flickr RSS Feed

If you do decide to go the API route there's a code sample in the Esri Github repo for the Public Information Configurable App template that shows how to use the Flickr API.

public-information-map-template-js/FlickrLayer.js at master · Esri/public-information-map-template-j...

AshleyPeters
Occasional Contributor III

Kelly,

Thanks for the information. I've looked into Yahoo Pipes, and that is no longer an option. Yahoo did away with that in September 2015. I'll check out the template you mention that uses the Flickr API to see if that gets me any closer to a solution.

0 Kudos
AdrianWelsh
MVP Honored Contributor

Hi Ashley,

That is a fun application. I hadn't seen that before and I would be curious to know how to increase the number as well. Have you tried looking at different tags and such to see how much difference is made? I tried playing in the sandbox some and put in some of my geotagged photos and I was getting way way less than expected and it makes me wonder how flickr is handling it and how to change those variables.

Can you post the code you used for this?

I started poking around here: https://www.flickr.com/services/feeds/docs/photos_public/

and quickly got lost. I was able to change a few things but screwed more things than I wanted.

EDIT: Whoops, I started writing this and didn't post it for a long time. THEN, I saw Kelly's post. I would ignore what mine said and look into Kelly's suggestions

0 Kudos
AshleyPeters
Occasional Contributor III

Adrian,

I've tried a multitude of things at this point. The issue is that Flickr limits their feeds to the 20 most recently geotagged/tagged photos. It looks like you can increase the number from 20, but I really think it will require me using the Flickr API. The sample I mentioned previously I was able to pretty much drop straight into my code. Here's what that section looks like for me now:

//Add Flickr photos
mapMain.on("load", loadPhotos);
 
      function loadPhotos(){
  mapMain.graphics.setMinScale(1300000);
  mapMain.graphics.setMaxScale(20000);
        var flickrPhotos = esriRequest({
          url: "https://api.flickr.com/services/feeds/geo?&format=json",
          content:{
    id: "54972228@N03",
              //format:"json",
              //tagmode: "any",
          tags: "State Park"
          },
          callbackParamName: "jsoncallback"
        });
        flickrPhotos.then(addPhotos);
      }
      function addPhotos(data){
      var symbol = new PictureMarkerSymbol("images/flickr.png", 24, 24);
      var template = new PopupTemplate({
          title: "{title}",
          description:"{description}"
        });
        dojo.forEach(data.items, function(item){
          var loc = new Point(item.longitude, item.latitude);
          mapMain.graphics.add(new Graphic(loc, symbol, item, template));
        });
    }

I updated the code from the sample and added in the scale to control when the Flickr icons are visible. This works, but only shows 20 photos. I have 65 that need to be visible.

Hope this helps.

AdrianWelsh
MVP Honored Contributor

Ashley,

Thanks for sharing.

I know it isn't the same thing but you can add a much larger number of photos from Flickr to a story map, using an out-of-the-box template:

Using Flickr photos in the hosted map tour story map | ArcGIS Blog

I've done this a few times and it works really well.

0 Kudos