• Thanks again for the great mapping plugin; we previously added a KML layer to our WP Geo maps, but this has stopped working as of the V3 Api. Can you please provide an example how to add a KML layer?

    http://accesslocal.tv

    We have tried putting something together from the documentation which suggests this is possible using the Google Maps Javascript V3 API and the wpgeo_map_js_preoverlays filter, though the documentation does not show a KML example…

    Thanks for your help!

    https://ww.wp.xz.cn/plugins/wp-geo/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ben Huson

    (@husobj)

    Thank you for your support.
    I’ll take a look and see if I can provide a working example to help.

    Ben

    Plugin Author Ben Huson

    (@husobj)

    Try something like this in your functions.php file:

    function my_wpgeo_map_js_preoverlays( $output, $map_id ) {
    
    	// May Map KML
    	$output .= "var myMapKML = new google.maps.KmlLayer( {
    			url: 'http://kml-samples.googlecode.com/svn/trunk/kml/Model/ResourceMap/macky-alt.kml'
    		} );
    		myMapKML.setMap(" . $map_id . ");
    		";
    
    	return $output;
    }
    add_filter( 'wpgeo_map_js_preoverlays', 'my_wpgeo_map_js_preoverlays', 10, 2 );
    Thread Starter foxyea

    (@foxyea)

    Thanks for the great example!

    Map KML layer is working now. Strange thing, the WP Geo widget we are using on the home page is now centering and zooming on the KML object. Is there a way to make the zoom show all points? We have some posts with map points that are outside of this KML layer boundary. See it here:

    Home Page:
    http://accesslocal.tv

    Post with a map point outside of the KML layer:
    http://accesslocal.tv/2014/05/30/hunger-awareness-week-spreads-the-importance-of-community-health/

    Plugin Author Ben Huson

    (@husobj)

    Which widget are you using?

    Thread Starter foxyea

    (@foxyea)

    Ben,

    We apologize for the delay in getting back to you, we launched a new theme that required our full attention and turned the mapping plugin off for a while for troubleshooting.

    Now we are back using WP-Geo: Still getting the zooming and centering behavior on our KML layer.

    To answer your question, we are using the WP-Geo Recent Locations widget.

    Our other questions is regarding performance. We are seeing very large database requests and are trying to determine if it is WP-Geo. Turning the plugin off definitely improves overall performance and site load time. Any ideas on optimizing our server and preloads for WP-Geo?

    Thanks again! We love the way this plugin works with our content, just trying to get the wrinkles out.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘WP Geo KML Layer Using Google Maps V3 API’ is closed to new replies.