Francesco
Francesco

Reputation: 25239

KmlLayer custom icons

I have a website where a user of my community can import his KML file (exported from Earth of Google Maps) and display a map (ex his favorite restaurants in Chicago). this part was ok and easy but now I would customize the icons on the map, and i dont see how is it possible using KML files...

there is any othe solution to this, maybe exporting/importing a different file instead of kml? does google maps allow to export the results in json/xml?

Upvotes: 4

Views: 4108

Answers (1)

Tony
Tony

Reputation: 933

If you're trying to just change the placemark marker icons, you can just set the style of the placemark to a style that contains the icon node.

    <Style id="icon">
        <IconStyle>
            <Icon>
                <href>http://path/to/your/icon.png</href>
            </Icon>
        </IconStyle>
    </Style>
    <Placemark>
        <name>Name</name>
        <description>
        hi
        </description>
        <styleUrl>#icon</styleUrl>
        <Point>
            <coordinates>...</coordinates>
        </Point>
    </Placemark>

This will show the icon contained at that path for the marker instead of the default.

Upvotes: 5

Related Questions