WordPress.org

Ready to get started?Download WordPress

Forums

Geo Mashup
[resolved] Auto-zoom incorrect when loading posts and kml (7 posts)

  1. jamesinealing
    Member
    Posted 1 year ago #

    Hi, I've searched the documentation and forums but can't seem to find anything about the issue I'm having.

    I am loading posts onto a dynamic global map and then adding a kml layer through custom.js. I have Default Zoom Level set to Auto in my main options. When the auto-zoom is applied after everything has loaded it is fitting the map purely to the kml points and not taking into account the posts.

    The odd thing is that I've now turned it off in the main dashboard options, and manually specified exact zoom levels in the shortcode that embed the particular map, and it's still not changing it!

    http://wordpress.org/extend/plugins/geo-mashup/

  2. Dylan Kuhn
    Member
    Plugin Author

    Posted 1 year ago #

    Make sure your custom javascript isn't requesting a viewport adjustment. If you're using the mapstraction API, pass false as a second argument, though that should be the default:

    map.addOverlay( kml_url, false );
  3. jamesinealing
    Member
    Posted 1 year ago #

    Hi Dylan, sorry for the late reply - just as I was trying that out our broadband went down, and it's only just back up now.

    I've just been trying to figure this out, but can't. I'm using the GoogleV3 example from http://code.google.com/p/wordpress-geo-mashup/wiki/Documentation#Custom_JavaScript which doesn't have the map.addOverlay call. Is there an easy way I'm missing of customising that example? Or should I look at another approach? Sorry for my ignorance.

  4. Dylan Kuhn
    Member
    Plugin Author

    Posted 1 year ago #

    Yep, you need pass another option. Here's the example with that change, merry solstice :)

    // An Example Google V3 customization
    
    GeoMashup.addAction( 'loadedMap', function ( properties, mxn ) {
    
            // Load some KML only into global maps - for instance pictures of squirrels
    
            var google_map = mxn.getMap();
    
            if (properties.map_content == 'global') {
    
                    // Make the Google v3 call to add a Flickr KML layer
                    var kml = new google.maps.KmlLayer( 'http://api.flickr.com/services/feeds/geo/?g=52241987644@N01&lang=en-us&format=kml', {
                            map: google_map,
                            preserveViewport: true
                    } );
    
            }
    
    } );
  5. jamesinealing
    Member
    Posted 1 year ago #

    Ah ha, thanks Dylan. I guess another one I should have fathomed out for myself! I think I was thinking it would be more complicated than just an API setting. I presume an auto-zoom based on all points (both WP posts and from the kml) is rather more complicated and would require some coding?

    One final (related) question if I may? Once I have plenty of data (it's a user submitted site) the above issue will not really be of much significance, but I did think I could happily mitigate it by setting auto_zoom_max. But it doesn't seem to work, and I saw in an old post at http://code.google.com/p/wordpress-geo-mashup/issues/detail?id=410 that it wasn't set up for v3. I presume that is still the case? Not a big problem for me, but thought I'd mention it.

    I should also say how great Geo Mashup is - I played with it many years ago, and then when a new mapping project arose I went and looked at all sorts of alternatives, only to find myself straight back here!

  6. Dylan Kuhn
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for the review! I think you must be right, I probably need to write some more code to make auto_zoom_max work with google v3. Star this to stay updated on that:

    http://code.google.com/p/wordpress-geo-mashup/issues/detail?id=609

  7. jamesinealing
    Member
    Posted 1 year ago #

    Thanks Dylan, will keep an eye out. Meanwhile I think I'll just set a 'zoomed out' manual level

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags