开发者

KmlLayer custom icons

开发者 https://www.devze.com 2023-01-26 03:40 出处:网络
I have a webs开发者_开发百科ite 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 a

I have a webs开发者_开发百科ite 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消