【问题标题】:getting an image of current google map获取当前谷歌地图的图像
【发布时间】:2014-04-12 10:29:03
【问题描述】:

有谁知道如何获取我当前显示的谷歌地图的静态图像。我已使用此代码在 div 中获取 googl 地图

 <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> 
function initialize() { 
    var mapOptions = { 
    center: new google.maps.LatLng(0,0),
    zoom:1,
    scrollwheel:false,
    disableDefaultUI: true, 
    draggable: false

    };

    map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}

我正在使用这个 url 来获取静态图像

http://maps.googleapis.com/maps/api/staticmap?center=0,0&zoom=1&size=750x425&sensor=false&visual_refresh=true&scale=1

但是我没有得到与函数显示的图像相同的图像。

【问题讨论】:

标签: google-maps google-maps-api-3


【解决方案1】:

没有营业执照的最大允许宽度/高度为640px

你可以做什么:使用 2 的比例,将缩放设置为 0,宽度/高度使用一半大小:

http://maps.googleapis.com/maps/api/staticmap?center=0,0&zoom=0&size=350x212&sensor=false&visual_refresh=true&scale=2

注意:结果不会完全一样,因为缩放不同。您会看到不同的标签(在缩放 0 时,例如您不会看到任何标签)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-11
    • 1970-01-01
    • 2012-11-26
    • 2012-12-22
    • 1970-01-01
    • 2013-12-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多