Questions to the data API

735 views
Skip to first unread message

Chillyskye

unread,
Sep 14, 2010, 4:56:26 AM9/14/10
to panora...@googlegroups.com
I tried asking these questions to questions (at) panoramio [dot] com but so far without result.

So pasting the mail here, in the hope that either Panoramio staff, or other users of the forum can answer some of the issues I have with the API.




Quote:
Hi Panoramio,

We are using the data API because we want to display the location data
long with the photos, and it seems to be the only way to do that.
I'm wondering however, why the data we receive sometimes seems a bit
odd, compared to what we expect to see.

In further details, what we do is calling your service with a URL like
the following:
http://www.panoramio.com/map/get_panoramas.php?set=full&from=0&to=19&minx=11.9125184726&miny=54.7610839535&maxx=11.9925184726&maxy=54.7660839535&size=square&callback=list_cb

As you can tell from the parts of the URL we are trying to get the
photos based on a given bounding box, and slicing the results up in
chunks of 20 and return them to our callback.

Reading the descriptions of the APIs it seems sorting is disabled when
using area search, which is giving us some trouble when trying to
pinpoint the individual photos to an index in the array.
For some reason the order of the array returned from the range 0-9
extended with the range 10-19 is not the same as the order in the array
returned from the range 0-19.

Furthermore if you run the exact URL I supplied as a sample, it will
return a count of 10, but the array of photos will be empty. I can't
figure out why this is. It might be the same in other areas,
that the actual amount of photos we can get doesn't match the amount
the count tells me there should be.


Is there any public documentation on these behaviours I can get access
to, so I can sort out the last bugs in our implementation?


Kind regards,
Michael Olesen


Furthermore I had a couple of other questions I didn't get to ask in the mail, but will ask here too:

Some of the photos supplied by the data API, which we are using to make our own thumbnail scrollbox, doesn't exist when we try running them through the photowidget (with photoId and userId supplied). This happens on maybe 1 out of 20 or so photos.

Furthermore, I wanted to see what is actually going on with the data returned by the data API using an area based search, so in an attempt to further pinpoint the index of the individual photos returned, I found something very odd.

I don't have the exact query I tested this with anymore, so the query posted is just to prove the method, not the result:

I wanted to compare the ordering of the say first 100 results from a given area, with the result of a foreach picking just 1 photo at a time, with an incrementing index value from 1 to 100.
What I got was most unexpected. I thought I would get just a differently ordered list, but instead I saw a lot of dublets. Often if not all the time in succession.

If you want proof of this behavior, I can remake the example with sample PHP code, but if anyone seen this before I don't think I need to.


PS:
There were several reasons why we needed to make our own PhotoListWidget, for one, it doesn't handle endpoints very well. If you scroll above the first entry it starts behaving strangely, and also we lack the location info when working with the photos in this manor, at least its not in data we get returned from the service, and there is no documentation on how to retrieve it, other than via the data API.

Hope someone can give me some help here.
Panoramio has a great deal of relevant photos for the users of our site www.lokus.dk

Sample of our current implementation:
http://lokus.dk/taastrup/hoeje_taastr./eigtveds_alle/billeder/panoramio

-mod edit TomasK- despammed email address

Draken

unread,
Sep 14, 2010, 8:48:37 AM9/14/10
to panora...@googlegroups.com
Please notice the Panoramio photos on your website need to be hyperlinked to the photo URL hosted on Panoramio. Otherwise you are not complying with the API terms.

Having said that, I hope you get some answers from the Team or knowledegeable users.

Chillyskye

unread,
Sep 14, 2010, 9:33:48 AM9/14/10
to panora...@googlegroups.com
About the missing link to the photo on Panoramio.
I was messing with a few things for trying to linking directly to the fullsize version of the photo, but dropped the idea.
However the eventlistener for clicking on the photo is still there, just without doing anything.

But as you may have noticed from my post I have a lot of loose ends in the way the widgets work, and the page still need a lot of polish, cleanup included.
Just for now I have some other tasks to tend to, untill I know how I can work around my current issues.

Chillyskye

unread,
Sep 16, 2010, 4:43:43 AM9/16/10
to panora...@googlegroups.com
I was wondering how long it normally takes before one gets a response when mailing to questions at panoramio (com).
Or alternatively if there is another email address or any other means of communication I can use, to get in contact with them.

The first emails we sent was some weeks ago.
I don't expect to get a definitive solution right away, but at least an indication that they have received our mails or something.

-mod edit TomasK: Despammed email address

Tomas K☼h☼ut

unread,
Sep 16, 2010, 5:07:47 AM9/16/10
to panora...@googlegroups.com
Chillyskye:

You have right mail address.
But please note, that Team is rather small (especially when you see, how many users are signed here), so help desk is not their top priority.

And please, don't put email addresses in forum directly (don't give a harvest for spambots).

Zagadka

unread,
Sep 17, 2010, 9:05:46 AM9/17/10
to panora...@googlegroups.com
I have the same issues, so I'll listen in.

Chillyskye

unread,
Sep 21, 2010, 8:10:11 AM9/21/10
to panora...@googlegroups.com
Because of the lack of response so far, I've reproduced my previous results, and listing them here, along with my methods.
Hope this can set some more focus on the issues.


First thing first, the issues with pinpointing a photo to an index in the returned array of photos from a given geographical area.
Logically you should be able to generate the same result if you take 100 photos at once, and if you take the 100 just one at a time and append them to an array. However as I discovered this isn't the case.

The following is a vardump of the rectangle I'm working with for this sample. Its the same for both of the following code bits.
Code:
array(2) {
["sw"] => array(2) {
["lat"] => string(13) "55.6356227551"
["lng"] => string(13) "12.2433150247"
}
["ne"] => array(2) {
["lat"] => string(13) "55.6636420396"
["lng"] => string(13) "12.3482058545"
}
}

The first codebit is suppose to take the first 100 photos from the area, and print them one at a time.

[PHP]
Code:
$image_url = 'http://www.panoramio.com/map/get_panoramas.php?set=public&from=0&to=100&minx='.$rect['sw']['lng'].'&miny='.$rect['sw']['lat'].'&maxx='.$rect['ne']['lng'].'&maxy='.$rect['ne']['lat'].'&size=original';
$images_contents = json_decode(file_get_contents($image_url));
$i = 0;
foreach($images_contents->photos as $photo) {
echo $i.": ".$photo->photo_id."<br>";
$i++;
}

>From that I get the following result. Note: no dublets.
Code:
0: 3883690
1: 6116408
2: 852601
3: 20732571
4: 5907200
5: 11652870
6: 7376918
7: 15543176
8: 24481510
9: 933615
10: 24500327
11: 24499303
12: 24499362
13: 3237553
14: 4031813
15: 7618666
16: 1345296
17: 237124
18: 9310307
19: 5144171
20: 1292113
21: 3048961
22: 6939130
23: 26680629
24: 24499876
25: 14247681
26: 11250236
27: 852573
28: 5590081
29: 11653015
30: 94870
31: 11992966
32: 1291894
33: 5907353
34: 24481597
35: 24500308
36: 23471790
37: 24481480
38: 5884360
39: 24500278
40: 9549175
41: 18711762
42: 427854
43: 5319212
44: 3400135
45: 24481144
46: 24505835
47: 10506390
48: 23361660
49: 5862231
50: 4423302
51: 18711306
52: 24498810
53: 4423701
54: 20046929
55: 18732365
56: 18732023
57: 3048198
58: 1345343
59: 24499770
60: 24500079
61: 24499235
62: 9310384
63: 1370409
64: 24499178
65: 9310419
66: 24500107
67: 2300680
68: 24481167
69: 26680507
70: 18732282
71: 18731510
72: 9310328
73: 18731091
74: 9492294
75: 24499786
76: 24499334
77: 24498857
78: 18731758
79: 3891481
80: 23363070
81: 24499909
82: 18711707
83: 23361639
84: 24499058
85: 9310460
86: 24500158
87: 23362847
88: 24499010
89: 3048273
90: 23361726
91: 24500191
92: 24481103
93: 9310474
94: 22618856
95: 9310369
96: 14247665
97: 9737848
98: 9309792
99: 9310403

The second codebit is suppose to take the first 100 photos from the area one by one, and print them.

[PHP]
Code:
for($i = 0;$i < 100;$i++) {
$image_url = 'http://www.panoramio.com/map/get_panoramas.php?set=public&from='.$i.'&to='.($i+1).'&minx='.$rect['sw']['lng'].'&miny='.$rect['sw']['lat'].'&maxx='.$rect['ne']['lng'].'&maxy='.$rect['ne']['lat'].'&size=original';
$image_contents = json_decode(file_get_contents($image_url));
echo $i.": ".$image_contents->photos[0]->photo_id."<br>";
}

>From that I get the following result. Note all the dublets.
Code:
0: 3883690
1: 6116408
2: 6116408
3: 852601
4: 20732571
5: 20732571
6: 5907200
7: 5590081
8: 11653015
9: 94870
10: 11992966
11: 11652870
12: 11652870
13: 7376918
14: 7376918
15: 15543176
16: 933615
17: 24500327
18: 24500308
19: 23471790
20: 24481480
21: 5884360
22: 24500278
23: 18711762
24: 24499362
25: 24499362
26: 24481144
27: 24505835
28: 24499362
29: 3237553
30: 24481144
31: 24505835
32: 4031813
33: 4031813
34: 7618666
35: 4031813
36: 4031813
37: 7618666
38: 7618666
39: 1345296
40: 1345296
41: 4423701
42: 1345296
43: 4423701
44: 237124
45: 237124
46: 9310307
47: 9310307
48: 5144171
49: 5144171
50: 18732023
51: 3048198
52: 1292113
53: 1292113
54: 3048961
55: 6939130
56: 24499770
57: 26680629
58: 24500079
59: 24499235
60: 9310384
61: 1370409
62: 24499178
63: 9310419
64: 9310419
65: 24500107
66: 2300680
67: 24481167
68: 18732282
69: 18731510
70: 18731091
71: 18731091
72: 9492294
73: 24499786
74: 24499334
75: 24498857
76: 18731758
77: 3891481
78: 3891481
79: 23363070
80: 24499909
81: 18711707
82: 23361639
83: 24499058
84: 9310460
85: 24500158
86: 23362847
87: 24498952
88: 24499010
89: 3048273
90: 23361726
91: 24500191
92: 24481103
93: 9310474
94: 22618856
95: 14247681
96: 14247681
97: 14247665
98: 9737848
99: 9309792

If I was just getting all 100 photos at once it wouldn't be an issue, cause they seem to be unique in that case (but the order is not always the same, every time I retrieve the list, but I will come to that later).
The fact of the matter is however, that I'm using the following method to chunk up the thumbsarray for my custom photolist widget, as getting a full list of maybe 700 or so photos, as there are in some areas, can take a while for a user to retrieve.

[JavaScript]
Code:
var url = 'http://www.panoramio.com/map/get_panoramas.php';
url += '?set=public';
url += '&from='+(number*chunk_size);
url += '&to='+((number*chunk_size)+chunk_size);
url += '&minx=<?= $rect['sw']['lng'] ?>';
url += '&miny=<?= $rect['sw']['lat'] ?>';
url += '&maxx=<?= $rect['ne']['lng'] ?>';
url += '&maxy=<?= $rect['ne']['lat'] ?>';
url += '&size=square';
url += '&callback=handleChunk';

Calling this dynamicly as the user scrolls through the photolist widget.
Current implementation of this with the area from the samples above:
http://lokus.dk/taastrup/hoeje_taastr./billeder/panoramio
I've used the div-structure from the Panoramio photolist widget, but the method behind to get the photos is custommade with calls to the service with URLs created as shown above. The chunk_size right now is 20 (vertical photolist), but in a soon upcomming version its 32 (horizontal photolist)


Because we are getting the photos in chunks its easy to hit upon the dublets, ofcause, the larger the chunk_size, the smaller the chance for this to happen, but if we turn it up too far the user is going to experience excessive loadtimes.
But ideally the arrays should be dependable, and even better, sortable (which they doesn't seem to be either)


I mentioned that there once in a while appears to be something up with the ordering. It infact looks more like that a single photo pops into the list once in a while, and then out the next time you reload the exact same list.
I can't really reproduce this, as it seems to be rather random, but it has happened in the first chunk of photos on http://lokus.dk/taastrup/hoeje_taastr./billeder/panoramio .
So just reloading that site some times can produce the phenomenon, but its not garentied to.


Next thing on the issue-list is photos which gets returned from the data api, with a thumbnail, but can't be shown in the photo widget.
It doesn't happen all that often, but it does happen for some photos. Using the folllowing options to create the photowidget.
We use photoId + userId to get the photo. Which is retrieved from the current position in our photolist widget.

[JavaScript]
Code:
var photoWidtgetOptions = {
'width': 510,
'height': 340,
'rows': 1,
'columns': 1,
'croppedPhotos': false,
'attributionStyle': panoramio.tos.Style.HIDDEN,
'disableDefaultEvents': true
};

var photodisplay_widget = new panoramio.PhotoWidget('panoramio_displayarea',
{disableDefaultEvents:true,'ids':[{'photoId':photo_id,'userId':user_id}]},
photoWidtgetOptions
);

I've found a case here which has existed for at least some days.
The photoId is 6039564
The userId is 612176
And unless the ordering of the array we are working with changes, a sample can de found at http://lokus.dk/charlottenlund/sophus_bauditz_vej/billeder/panoramio?pos=3
The photo exist if I go to http://www.panoramio.com/photo/6039564, so I don't get why its not retrievable via the widget. (Some privacy settings?)


Last thing on my current issue-list
The count field in our result set, when retrieving photos from an area, doesn't match the rowcount in the photos array, when we use the data API.
The following is the method I'm using to get the count from the result set, and how many rows actually gets returned.

[PHP]
Code:
$image_url = 'http://www.panoramio.com/map/get_panoramas.php?set=full&from=0&to=10000000&minx='.$rect['sw']['lng'].'&miny='.$rect['sw']['lat'].'&maxx='.$rect['ne']['lng'].'&maxy='.$rect['ne']['lat'].'&size=original';
$images_contents = json_decode(file_get_contents($image_url));
echo 'count: '.$images_contents->count.'<br>';
echo 'rowcount: '.count($images_contents->photos);

Here is 2 samples, first their coord sets followed by the result of the method above.

[Sample 1]
Code:

array(2) {
["sw"] => array(2) {
["lat"] => string(13) "54.7610839535"
["lng"] => string(13) "11.9125184726"
}
["ne"] => array(2) {
["lat"] => float(54.7660839535)
["lng"] => string(13) "11.9925184726"
}
}

count: 10
rowcount: 0

[Sample 2]
Code:
array(2) {
["sw"] => array(2) {
["lat"] => string(13) "55.6356227551"
["lng"] => string(13) "12.2433150247"
}
["ne"] => array(2) {
["lat"] => string(13) "55.6636420396"
["lng"] => string(13) "12.3482058545"
}
}

count: 323
rowcount: 247

As you can see in the first sample there should be 10 photos, but we get none returned.
In the second sample there should be 323, but we only get 247.

© Douglas MacGregor

unread,
Sep 21, 2010, 1:04:56 PM9/21/10
to panora...@googlegroups.com
I don't know the answer to these questions, but it is very important that someone who does know gives an answer.

We are very concerned that some external websites are not using the API properly. If we want them to display our photos in this way, Panoramio has to make it easy for them to use the API and it has to work without needing a degree in computer science!

Galatas ©

unread,
Sep 21, 2010, 1:27:24 PM9/21/10
to panora...@googlegroups.com
Quote © Douglas MacGregor:
I don't know the answer to these questions, but it is very important that someone who does know gives an answer.

We are very concerned that some external websites are not using the API properly. If we want them to display our photos in this way, Panoramio has to make it easy for them to use the API and it has to work without needing a degree in computer science!


That's the least they can do considering so many members dislike their photos being used in this way at all.

hvbemmel

unread,
Sep 22, 2010, 1:32:15 AM9/22/10
to panora...@googlegroups.com
Quote © Douglas MacGregor:
Panoramio has to make it easy for them to use the API and it has to work without needing a degree in computer science!


Actually they did. That's the reason the widget API was developed.

But I agree with you that the data API should be overhauled too.

Chillyskye

unread,
Sep 27, 2010, 8:30:12 AM9/27/10
to panora...@googlegroups.com
Quote Galatas:
That's the least they can do considering so many members dislike their photos being used in this way at all.


As I'm not a member of the Panoramio community per say, I would like to know what you refere to when you say that many members dislike their photos being used in this way.
By this way, are you refering to external use of the photos or am I reading it incorrectly?

Chillyskye

unread,
Sep 28, 2010, 7:57:56 AM9/28/10
to panora...@googlegroups.com
hvbemmel:
Do you know if the team is actually looking at overhauling the data API currently, or has plans to do so in the near future?


Another thing is, can someone with some code insight confirm that my methods and results are valid, and does document several bugs or strange behaviours in the API.
Because if this is the case, then I don't understand why the team can't at least acknowledge there are some flaws. I've tried contacting them many times now, and not even a response with that they have received my mails.
I understand they are not many on the team, and prioritize the softer support questions. But getting a stronger and stronger feeling of being ignored for pointing out flaws. This may not be true, but its the impression I get when no one answers.

caseriodacastineira

unread,
Apr 14, 2011, 2:39:26 AM4/14/11
to panora...@googlegroups.com
if i call for a json string asking from the photo 75 to 85 on the selected area i using this:

http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=full&from=75&to=85&minx=-7.47&miny=42.29&maxx=-7.42&maxy=42.32&size=medium

i get the right answer:

Code:
{"count": 118, "photos": [{"upload_date": "20 March 2011", "owner_name": "Gocx", "photo_id": 49760477, "longitude": -7.4258139999999999, "height": 375, "width": 500, "photo_title": "", "latitude": 42.318162000000001, "owner_url": "http://www.panoramio.com/user/4421954", "owner_id": 4421954, "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/49760477.jpg", "photo_url": "http://www.panoramio.com/photo/49760477"}, {"upload_date": "25 March 2010", "owner_name": "jgvreg", "photo_id": 33629816, "longitude": -7.4402330000000001, "height": 375, "width": 500, "photo_title": "Vista do Val entre A Medorra e A Mioteira", "latitude": 42.305039000000001, "owner_url": "http://www.panoramio.com/user/4322171", "owner_id": 4322171, "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/33629816.jpg", "photo_url": "http://www.panoramio.com/photo/33629816"}, {"upload_date": "25 March 2010", "owner_name": "jgvreg", "photo_id": 33629823, "longitude": -7.4396750000000003, "height": 375, "width": 500, "photo_title": "Vista cara Monforte e Castro Caldelas", "latitude": 42.305101999999998, "owner_url": "http://www.panoramio.com/user/4322171", "owner_id": 4322171, "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/33629823.jpg", "photo_url": "http://www.panoramio.com/photo/33629823"}, {"upload_date": "20 March 2011", "owner_name": "Gocx", "photo_id": 49760491, "longitude": -7.4361661996699997, "height": 375, "width": 500, "photo_title": "Vilar (Pesqueiras)", "latitude": 42.3170071909, "owner_url": "http://www.panoramio.com/user/4421954", "owner_id": 4421954, "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/49760491.jpg", "photo_url": "http://www.panoramio.com/photo/49760491"}], "has_more": false}


but if i ask for the photos from 80 to 100 using this:

http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=full&from=80&to=100&minx=-7.47&miny=42.29&maxx=-7.42&maxy=42.32&size=medium

i get an empty json string:

Code:
{"count": 118, "photos": [], "has_more": false}


anyone has an answer for this?

thanks in advance

junk0128

unread,
Apr 19, 2011, 6:36:49 AM4/19/11
to panora...@googlegroups.com
Quote caseriodacastineira:
if i call for a json string asking from the photo 75 to 85 on the selected area i using this:

http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=full&from=75&to=85&minx=-7.47&miny=42.29&maxx=-7.42&maxy=42.32&size=medium

i get the right answer:

{"count": 118, "photos": [{"upload_date": "20 March 2011", "owner_name": "Gocx", "photo_id": 49760477, "longitude": -7.4258139999999999, "height": 375, "width": 500, "photo_title": "", "latitude": 42.318162000000001, "owner_url": "http://www.panoramio.com/user/4421954", "owner_id": 4421954, "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/49760477.jpg", "photo_url": "http://www.panoramio.com/photo/49760477"}, {"upload_date": "25 March 2010", "owner_name": "jgvreg", "photo_id": 33629816, "longitude": -7.4402330000000001, "height": 375, "width": 500, "photo_title": "Vista do Val entre A Medorra e A Mioteira", "latitude": 42.305039000000001, "owner_url": "http://www.panoramio.com/user/4322171", "owner_id": 4322171, "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/33629816.jpg", "photo_url": "http://www.panoramio.com/photo/33629816"}, {"upload_date": "25 March 2010", "owner_name": "jgvreg", "photo_id": 33629823, "longitude": -7.4396750000000003, "height": 375, "width": 500, "photo_title": "Vista cara Monforte e Castro Caldelas", "latitude": 42.305101999999998, "owner_url": "http://www.panoramio.com/user/4322171", "owner_id": 4322171, "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/33629823.jpg", "photo_url": "http://www.panoramio.com/photo/33629823"}, {"upload_date": "20 March 2011", "owner_name": "Gocx", "photo_id": 49760491, "longitude": -7.4361661996699997, "height": 375, "width": 500, "photo_title": "Vilar (Pesqueiras)", "latitude": 42.3170071909, "owner_url": "http://www.panoramio.com/user/4421954", "owner_id": 4421954, "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/49760491.jpg", "photo_url": "http://www.panoramio.com/photo/49760491"}], "has_more": false}

The count value tells a lie.

elicoo

unread,
Oct 28, 2012, 10:44:06 AM10/28/12
to panora...@googlegroups.com
Did anyone solve this issue?

GianfrancoUCL

unread,
Jul 17, 2013, 5:07:29 AM7/17/13
to panora...@googlegroups.com
Hello.
Has anyone get an answer to this thread? I am posting here since my problem look related to this old thread.

I am trying to get all geolocated pictures inside a bounding box.
When I get the first chunk of pictures I got the following header in JSON:
stdClass Object ( [count] => 5740 
[has_more] => 1 
[map_location] =>....

If I am not wrong it means that in my bounding box I might have 5740 pictures.
This header comes both when I ask one picture a time and when I ask for more pictures.
I tried to collect all of them with a while do loop in PHP whose condition is while ($hasmore=1);
where $hasmore is my variable receiving the has_more parameter for each picture.

I tried in several fashions, chunk of pictures, one by one pictures but I never got to the point where has more is 'false'.
I had loops repeated more than 20k.. I had to stop them since I expected not more than 5740.
Have anyone met this problem?
Thank You

Gianfranco
Reply all
Reply to author
Forward
0 new messages