在javascript按钮上拍摄Google地图快照 [英] take snapshot of google map on javascript button click

查看:78
本文介绍了在javascript按钮上拍摄Google地图快照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已在代码隐藏文件&中为Google地图添加了标记.如何在单击javascript按钮时为该地图拍摄快照

Markers were added for google map in code-behind file & how to take snapshot for that map on click of javascript button

推荐答案

可能有更好的方法,但是据我所知,以下是两种方法做这个.

1)使用 Google静态地图API [
There might be better ways to do this, but as per my knowledge following are the two ways you can do this.

1) Use Google Static Map API[^], they are simple querystring based API, which will return an Image as a result. also the maximum image size returned is 640 x 640, so you might want to query multiple times and combine the images.

(But in this case you will have to add those markers again)


2) A better solution is to call getTileUrl() method, this will return a URL that contains Image file of your current view.

This will give you Image of a particular tile that you are passing as a parameter at given zoom level. so you will have to call this for each tile in your view.

each tile of google map is 256 x 256 pixels. so depending upon how big is your map your tiles will be as follows.

0,0     1,0     2,0     3,0
0,1     1,1     2,1     3,1
0,2     1,2     2,2     3,2
0,3     1,3     2,3     3,3



我希望这些复杂的解决方案中的任何一个都将对您有所帮助...:)



I hope either of these complicated solutions will be helpful... :)


这篇关于在javascript按钮上拍摄Google地图快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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