私はASPでVBを使用しています。私は、この場合、Googleマップから持ち込まれた静的なマップであるイメージを含むASP Imageコントロールを持っています。私はVBのコードを使用してイメージ(bmp、jpg、または何か)にそのイメージをダウンロードしたいと思います。イメージはクライアント側のasp:Imageオブジェクトにあります。サーバー側からコードを使用してイメージをダウンロードするだけです。必要に応じて、JSをクライアント側で使用してこれを行うことができます。その場合、私はまだ誰かがこれを行う方法を知っているかどうかを見たいと思います。WebページからImageオブジェクトをファイルに保存
ここにページに表示されたマップをasp:imageオブジェクトにロードするためのJavaScriptコードです。この部分は素晴らしい作品です。イメージをファイルとして保存するだけです。この機能は、生成し、あなたの使用してGoogleマップの静的API、以来、「マップ」「マップ・オプション」、「境界」と「マーカー」
function Export() {
map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
//URL of Google Static Maps.
var staticMapUrl = "https://maps.googleapis.com/maps/api/staticmap";
//Set the Google Map Center.
staticMapUrl += "?center=" + mapOptions.center.G + "," + mapOptions.center.K;
//Set the Google Map Size.
staticMapUrl += "&size=220x350";
//Set the Google Map Zoom.
staticMapUrl += "&zoom=" + mapOptions.zoom;
//Set the Google Map Type.
staticMapUrl += "&maptype=" + mapOptions.mapTypeId;
//Loop and add Markers.
for (var i = 0; i < markers.length; i++) {
var data = markers[i];
if (data.pointNumber !== null) {
var labelNumber = data.pointNumber;
var labelString = labelNumber.toString();
var iconName = 'm' + labelString + '.png';
var roundLat = data.latitude; // + .00003;
var roundLon = data.longitude; // + .000005;
var myLatlng = new google.maps.LatLng(roundLat, roundLon);
var image =
{
url: 'ImagesForPoints/' + iconName,
scaledSize: new google.maps.Size(35, 48), // scaled size
//size: new google.maps.Size(53, 73),
//origin: new google.maps.Point(0,0),
//anchor: new google.maps.Point(30, 69)
anchor: new google.maps.Point(19, 45)
};
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
icon: image,
});
bounds.extend(marker.position);
map.fitBounds(bounds);
}
}
//Display the Image of Google Map.
var imgMap = document.getElementById("imgMap");
imgMap.src = staticMapUrl;
imgMap.style.display = "block";
}
あなたは画像をasp:imageオブジェクトに表示するだけでよいですか? – toto
問題を示すサンプルコードとこれまでの内容を追加できますか?それは、あなたが抱えている部分をもっとはっきりさせるでしょう。 – Adrian
私はイメージをページ上のイメージオブジェクトに表示することができます。私がしたいのは、画像をどこかのファイルとして保存することだけです。また、ファイルストリームとして取得できる場合は、必要なものをすべて実行できます。私はちょうどこれを行うように見えることはできません。私はそれが画面上の画像オブジェクトにどのように入るのかに関するコードを投稿します。 @toto – WhiteBearMike