johnmckerrell / OpenStreetView

An open licensed repository of street level photography, with metadata.
http://www.openstreetview.org/
32 stars 16 forks source link

Better distribution on thumbnails on the map #14

Open mnalis opened 14 years ago

mnalis commented 14 years ago

When you look at the map at specified zoomlevel, the OSV does not display all of the thumbnails, but just a limited number of them. It is quite ok, but the problem is that it currently just gets first xxx thumbnails in that area or something, which results in very uneven display. (question: is that the work of find_in_area(bbox) function in photo.rb ?)

For example, if you zoom to Europe, you will see OSV load and display bunch of thumbnails (at approximately the same location) in England, and another bunch in Ireland (probably because there where the first inserted in the database) and none of the thumbnails in Czech or Croatia or other countries that have pictures.

That leads to quite a wrong perception of where there are pictures (and where there are not), and unless user knows where exactly (s)he has to blindly zoom to "empty space" to see pictures there, (s)he will never see them.

the thumbnail selection code should be modified so it avoids thumbnails that would render at (almost) the same location, and prefers those which are more distanced from those already selected for display.

That would not only help with displaying picture distribution more fairly and allowing people to see where the database contains pictures, but would also help with loading less thumbnails in bigger views (for example, when viewing Europe, it could get away with 10 thumbnails in mostly various countries; instead of loading hundred of thumbnails all in the exact same location).

johnmckerrell commented 14 years ago

Yes this would relate to the "find_in_area" call. That was designed so that it could be called from an application which would then return each page of results that it needed, but I do agree that some mechanism to get more spread out results would be better.

mnalis commented 14 years ago

ok, I've tried doing something, you can (I hope) pull it from http://github.com/mnalis/OpenStreetView

Few things:

Phew, much more text explaining than actual code :-)

johnmckerrell commented 14 years ago

I have finally pushed this out, sorry for the delay partly I wasn't sure how to merge it in but it seemed almost worryingly easy. Though it works really well on the whole world view as I zoom into the UK it's not showing anything until just the UK is visible so I'm definitely going to have to take a look at improving it but it's definitely better than what we had before. I'll make a small revision to make this output an option rather than the default but it's good to have, thanks!

mnalis commented 14 years ago

Is it showing nothing at all, or just nothing in the UK region ? can you send me Permalink (and what resolution you're running) ?

Now that you've put it up I've seen a behaviour for example on http://openstreetview.org/?lat=52.560099201479&lon=15.362899302788&zoom=4 (at 1024x768) when it shows neighbouring countries, but not UK.

That issue looks like it's because that it sorts by date (descending), and stops when it hits the limit of 100 pictures, the oldest photos (which happen to be in UK) will not be displayed.

Could you perhaps send me a SQL dump of photos table ? I'm having just a few dozen geolocated pictures (and all from Croatia at that) on my test site, which makes it hard to test/fix :(

johnmckerrell commented 14 years ago

Nothing on the UK but stuff elsewhere, yes it sounds like it's the order by date part as you say but if the images were a bit more spaced out that wouldn't be such an issue. Here's a URL though I guess it won't work on your screen as yours didn't work on mine:

http://openstreetview.org/?lat=53.196598259124&lon=-6.4779210088407&zoom=5

It's probably largely just down to tweaking the parameters a bit. I'll have a look at doing a database dump tomorrow.