保存当前谷歌地图作为图像 [英] Save current Google Map as image

查看:420
本文介绍了保存当前谷歌地图作为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能保存当前的谷歌地图作为一个形象?下面是我的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆