문제

Currently, I am creating icons in Google Earth using the following Javascript code:

// Define a custom icon.
var icon = ge.createIcon('');
icon.setHref('http://myserver/marker.png');

What I would like to be able to do, is have an "offline" version of this that simply either styles the current placemarker icon (e.g. change its color) or use some sort of colored circle using KML. I have already ruled out the possibility of using a local file.

Is this even possible with Google Earth API without using a remote icon URL?

도움이 되었습니까?

해결책

Sure, you can control the colour and size of the icons directly via the api. For example to set the size and colour of the placemark icon...

var icon = ge.createIcon('');
var style = ge.createStyle('');

style.getIconStyle().setIcon(icon); 
style.getIconStyle().setScale(5.0); // size

var colorMode = style.getIconStyle().getColor(); 
colorMode.set("ff000000"); // colour
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top