I created a KML file that defines several zones using polygons, in Google Earth. My plan was to just use this file on my wordpress site, along with “comprehensive google maps plugin” for wordpress. However, it turns out that while it works, per the developer, I am unable to set a center or zoom. I want to zoom to 10, and center at specific coordinates. I have googled and researched and I keep coming up with a few scripts, but its a bit confusing to me what i would even do with them. This is my first foray into KML. Is there something i can add into the KML file that was generated by google earth, that would allow me to accomplish this? any help would be tremendously appreciated.
Share
Try with WP Flexible Map instead. It allows you to specify zoom on a KML map, and also gives you access to the map object so that you can set centre after it loads.
Example of shortcode to load KML file; NB: per FAQ, I set an id from which a JavaScript global variable name is later derived. [Edit: I’m an idiot, I copypasta’d the wrong example! fixed]
Now, add this code to a plugin (or your theme’s functions.php if you wish):