2011-07-20 9 views
3

Google Earth APIを使用して、特定の座標に目印を作成しました。今度は、デフォルトのマーカーアイコンよりも意味のあるユーザーをユーザーに表示するため、目印と同じ座標に画像を配置したいと考えています。これを行う方法はありますか?Google Earthアプリ画像

答えて

1

どれ画像が目印のアイコンとして使用することができます。

これを行うには、目印を作成してから、そのスタイルを画像ファイルを指すカスタムスタイルに設定します。

この方法では、必要な画像は目印と同じ座標になります。

何か、次が動作するように、明らかにあなたがイメージを指すようにhttp://yourserver/yourimage.pngを変更する必要があります。詳細については

// Create the placemark. 
var placemark = ge.createPlacemark(''); 
placemark.setName("placemark"); 

// Define a custom icon. 
var icon = ge.createIcon(''); 
icon.setHref('http://yourserver/yourimage.png'); 
var style = ge.createStyle(''); //create a new style 
style.getIconStyle().setIcon(icon); //apply the icon to the style 
placemark.setStyleSelector(style); //apply the style to the placemark 

// Set the placemark's location. 
var point = ge.createPoint(''); 
point.setLatitude(12.345); 
point.setLongitude(54.321); 
placemark.setGeometry(point); 

// Add the placemark to Earth. 
ge.getFeatures().appendChild(placemark); 

は、APIドキュメントに目印のセクションを参照してください。 http://code.google.com/apis/earth/documentation/placemarks.html

関連する問題