保存当前谷歌地图作为图像 [英] Save current Google Map as image
问题描述
我怎么能保存当前的谷歌地图作为一个形象?下面是我的Javascript用于初始化地图。
How can I save the current google map as an image? Below is the Javascript I use to initialize the map.
var myMarker = new google.maps.LatLng(result[0].centerLat, result[0].centerLong);
var myOptions = {
disableDoubleClickZoom: true,
zoom: result[0].zoom,
center: myMarker,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
我看了一下<一个href=\"https://developers.google.com/maps/documentation/javascript/reference#Map\">https://developers.google.com/maps/documentation/javascript/reference#Map但似乎没有方法返回当前地图对象URL或图像。是否有可能在地图保存为以某种方式的图像?
I had a look at https://developers.google.com/maps/documentation/javascript/reference#Map but there seems to be no method that returns a URL or image for the current map object. Is it possible to save the map as an image in some way?
推荐答案
您可以使用谷歌地图API静态:<一href=\"https://developers.google.com/maps/documentation/staticmaps/\">https://developers.google.com/maps/documentation/staticmaps/
You can use the google maps static API : https://developers.google.com/maps/documentation/staticmaps/
您可以得到你需要传递给来自谷歌静态地图API(例如中心,可见区域等等)Maps JavaScript API第参数。
You can get the parameters that you need to pass to the static maps api (e.g. center , visible region etc) from the google maps javascript api.
这篇关于保存当前谷歌地图作为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!