Google map auto Zoom

Hi there...

As I asked a while ago about the auto zoom function in google map for the album folders when you have multiple points was broken it got fixed after that.

However now it has broke again after the change in google map code. Has the function changed or did auto zoom fall out of place.

It is such a great feature to have. especially when I do shooting in multiple countries.

As well has google map become heavier on the bandwidth then it was before?

Comments

  • What do you mean by auto zoom? http://ejohn.org/blog/one-week-of-google-maps-2/?

    We have not had this kind of code in the plugin ever to my knowledge.
  • yes it used to be.. and I remember clearly it was you that fixed it.

    http://www.zenphoto.org/documentation/plugins/_plugins---google_maps.php.html#functionprintAlbumMap

    `
    string $zoomlevel: the zoom in for the map. NULL will use the default (auto-zoom based on points)
    `
    Here is the forum post I made about this and the mention of auto zoom is there below.
    http://www.zenphoto.org/support/topic.php?id=4080
  • That post does not say that we fixed the auto-zoom. We are still passing the zoom level as always, so NULL is being passed to Google. Therefore I presume that the change must be on their end. Also given the link I provide above it would appear that Google does not provide the function.
  • hmm.. I am pretty sure I got it working pretty well in earlier releases....

    Well if it is not there, I wonder about the code there you just sent, I haven't looked at it to closely but I wonder how hard it is to add to ZenPhoto?

    AutoZoom is such a great feature when working a lot with GPS photos, as I do, I tag all my photos automatically with GPS coordinates. AutoZoom would only apply to MapAlbum then.
  • It should not be too hard if you are a Javascript programmer. The current plugin sets each point as a variable. That would need to be changed to make it an array element. Then the "auto-zoom" functon would be called. There are probably some details that need to be considered, like when to call the function relative to other code and handling the change of size the "auto-zoom" documentation speaks of.

    I'm not that competent with Javascript, so I won't attempt the addition.
  • @olihar

    Autozoom used to work, you are correct.

    In version 1.1.7 it functioned properly. As of the new 1.2 series (AFAIK) a lot of the google maps code was replaced ... much of it is almost-completely broken now.

    I downgraded to 1.1.7 because of the missing functionality.
  • There does seem to be a weird slowdown bug in the version of Google Maps that 1.1.7 was downloading. A quick googling suggested changing the API version from V=2 to V=2.123. Which fixed it for me.
  • @Mannkind and sbillard

    maybe I am not crazy after all remembering that it used to work...

    I have been wondering as well is it true as it is now that google maps is loading a lot slower then it used to?

    so... is there a change in how google maps gets displayed or how zenPhoto asks for the info.

    While I remember happy new year to yah all.
  • @olihar

    Yep, you can see an example of autozooming working in 1.1.7 (with the minor gmaps tweak, silly Google)... http://photos.thenullpointer.net/Cougar Rock 200707/
  • @mannkind

    Are you using 1.2.2 of ZenPhoto and older version of the plugin.

    or are you using 1.1.7 for the whole thing?

    ether way would you like to share your tweaked code (gmaps tweak) for others to have a look at?

    @sbilliard

    I guess it would be worth a look and compare the codes in these 2 as we have a working sample right there.
  • just a similar topic while I remember.

    Is it not possible to display google maps for folders.

    Say I have a folder called 001 and inside that one is 0a , 0b and 0c.

    I can get a map showing inside each of the 0x folders but is it possible to get a map to display for 001 and displays all the details from these 3 0x sub folders? Do you follow me?
  • I'm using 1.1.7, now. It was recently that I upgraded to the 1.2 series (after using 1.1.2 or so for a very long time now).

    I don't know if a diff of my changes would help. It looks like ZP is using the full PhoogleMaps library now (and the full library seems to be much better than when I made PhoogleMapsLite) and a quick diff of the google_maps.php ZP-plugin shows a lot of changes (much of it might be formatting, I didn't look too deep).
  • The plugin works only at one level, there is no provision to look in subfolders.
  • I have been doing some looking around but not found the time to have a look myself.

    I will have a better look myself later, but if anyone is interested.

    http://forums.overclockers.co.uk/showthread.php?p=12806520

    `
    var minLat=49.1810862;
    var minLng=-1.5333333;
    var maxLat=53.9833333;
    var maxLng=3.2250023;

    botLeft = new GLatLng(minLat, minLng);
    topRight = new GLatLng(maxLat, maxLng);

    bounds = new GLatLngBounds(botLeft, topRight);
    map.setCenter(new GLatLng(((maxLat + minLat) / 2.0),((maxLng + minLng) / 2.0)),map.getBoundsZoomLevel(bounds));
    `
    P.s.
    On the other subject about sub folder grabbing
    I wonder how hard it will to make a `printAlbumSubFolderMap` function
  • Have you tried the current nightly build?
  • wow would you look at that. Works great just a tiny preference I would like is to give it a tiny little more space... as in Zoom out just a tiny bit more.. Will look into you code changes tomorrow if I find the time.

    Or if you have time to get it up for discussion what people would prefer in the default version.

    Thanks yet again..

    P.s. `printAlbumSubFolderMap` function is and will be still a big no no?
  • What would `printAlbumSubFolderMap()` do?
  • This post just remind me that the function to show wikipedia entries on google maps is not yet implemented. I do not know if I will have time to do it before next release. So the code that offer this choice in the plugin administration page should be commented for now.
    Regards
    Eric
  • Oh I forgot to add it,
    As for the auto zoom I think there is a dedicated function for that in the google API, would have to look there. Otherwise there is a library(that can also be found on the google api website) that extend the functionnalities concerning auto zoom and gives more option on binding neighbourgh points together depending on the zoom level.
    For big albums the situation were you have 100s of points on the map is bouund to happen, and this will result in lower performance. If I remember, binding multiple point into a single one is suppose to help that, and also clean up the mess :)
    regards
    Eric
  • What would printAlbumSubFolderMap() do?

    It would fetch info from the photos inside of subfolders. Lets say you could have a map for your whole gallery right on the front page or in album.php with sub folders.
  • `printAlbumSubFolderMap(): If your gallery (album) has many picures in it this could take quite a while.
  • I am fully aware of that, I am thinking this kind of function for a special project..

    Connected to that I am wondering about babar_e comment about binding points and the possibilities there for bigger albums.
  • I suppose you would have to do that at the php script level, an dwrite afunctin that scan the database for pictures that are within a certain distance and bind them together.
    When you zoom, then the map would have to request in live the individual markers if the zoom level is enough to distinguish between them.
    But I believe this is a long term development :)

    Meanwhile for autozoom in using google map functions you can have a look there:

    http://groups.google.com/group/Google-Maps-API/browse_thread/thread/60707f79305efc96/f81f365b292b6422?lnk=gst&q=centerAndZoomOnBounds&pli=1

    It looks simpler than the current one, but not sure how fast it is:

    GMap2.prototype.centerAndZoomOnBounds = function(bounds) {
    var center_lat = (bounds.getNorthEast().lat() +
    bounds.getSouthWest().lat()) / 2.0;
    var center_lng = (bounds.getNorthEast().lng() +
    bounds.getSouthWest().lng()) / 2.0;
    if(bounds.getNorthEast().lng() < bounds.getSouthWest().lng()){
    center_lng += 180;
    }
    var center = new GLatLng(center_lat,center_lng)
    map.setCenter(center, map.getBoundsZoomLevel(bounds));
  • Just a quick question towards this again.

    If you look here at the map.

    http://www.olihar.com/gallery/Photos/People/

    it is like the auto-zoom function is not working 100% right. It would be great if the zoom level was just 1 more zoom level out in this case.

    Just a quick note.
Sign In or Register to comment.