How to use KML to export markers/layers to Google Earth or Google Maps

Example KML export link from this website for layer 1

Frontend: layer map in Google Earth (via KML export)

Frontend: layer map in Google Maps (via KML export)

Each marker and layer has a corresponding KML-Feed which can be accessed directly, e.g.

http://www.[your-domain].com/wp-content/plugins/leaflet-maps-marker-pro/leaflet-kml.php?marker=1
or
http://www.[your-domain].com/wp-content/plugins/leaflet-maps-marker-pro/leaflet-kml.php?marker=1,2,3,4
or
http://www.[your-domain].com/wp-content/plugins/leaflet-maps-marker-pro/leaflet-kml.php?layer=1
or the following for all markers:
http://www.[your-domain].com/wp-content/plugins/leaflet-maps-marker-pro/leaflet-kml.php?layer=all

You can use the generated KML-file to display the included markers or layers directly in Google Earth which is available for Windows, Mac OS X and Linux. Please note that you need an internet connection to display your maps correctly as the marker icons and popup-images are loaded from the source you provided them.

As an alternative, you can also use the links above to display your maps in Google Maps via the feature “My Places“. To add your maps to Google Maps My Places, please proceed as follows:

  1. Download your marker or layer KML file by using a link from above
  2. Login at http://maps.google.com with your Google Account
  3. Click on my places
  4. Click on “Create new map”
  5. Click on “Import”
  6. Select the KML file you downloaded previously (note: loading from URL often doesn´t work on Google Maps as reported in user forums)
  7. Click button “Upload from file”
  8. Save your map

Please note that due to the “cross origin policy” active on Google Maps site (and a Firefox bug?), custom icons won´t be displayed with Firefox at the moment. In other browsers like Chrome, custom icons will be displayed. If you want to have maximum compatibility with your marker or layer map uploaded to Google Maps My Places, please download the KML-File from your WordPress site with the parameter &default_icons, e.g.

http://www.[your-domain].com/wp-content/plugins/leaflet-maps-marker-pro/leaflet-kml.php?layer=all&default_icons

This will display your marker or layer map in Google Maps with the default icon from Google Maps. If you want to know if and how this bug gets resolved, please check the Google Maps Google Group or Firefox support forums. I searched those forums for several hours but didnt find a solution how to solve this from my plugin side – so I created this workaround.