Search code examples
htmlkmlgoogle-earthgoogle-earth-plugin

how to add custom marker in google earth api?


Instead of the regular placemark that is a yellow pin. I want to instead use this icon. http://maps.google.com/mapfiles/kml/pal3/icon39.png I'm not sure if I have to import a KML file or if I can just use it by loading it up. If anyone can help me just post the icon somehwhere on google earth, I would appreciate it. I looked through some google kml files, and guides, but couldn't get it to work. Thanks


Solution

  • The easy way: If you are creating your KML file using the Google Earth client right click the icon choose 'properties' click on the icon - top right click on 'add custom icon' paste in the URL to icon you want to use

    otherwise you will need to edit the .kml file with some kind of text editor find the that is being used for the placemark in question in the change the value to the URL of the icon you want

    if you need help to find the correct style look for placemark name and find its this normally has a '#' tag in front of it do a search in your document for that style (removing the '#' tag)

    sometimes that finds it straight away (if you see the stuff there go for it)

    otherwise you will need to find both the styles (2 of them) listed under it (use same approach as above) then proceed to change the for the in BOTH places