Support » Plugin: Geo Mashup » Auto-zoom incorrect when loading posts and kml

  • Resolved jamesinealing


    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!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Dylan Kuhn


    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 );

    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 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.

    Plugin Author Dylan Kuhn


    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( '', {
                            map: google_map,
                            preserveViewport: true
                    } );
    } );

    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 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!

    Plugin Author Dylan Kuhn


    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:

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Auto-zoom incorrect when loading posts and kml’ is closed to new replies.