English 中文(简体)
是否有办法根据图像的提供确定谷歌统计地图的分层?
原标题:Is there a way to set the zoom level of Google Static Maps, based on the availability of imagery?

我在为客户进行的工作中使用统计图。 我喜欢17分级(整个地球为0,最接近的动物为21),但视图像地点所在,谷歌可能不具备17分级的图像。 告诉地图标本是动态选择尽可能高的冲积层的方法吗? 我没有看到这样做的途径,但我肯定会欣赏任何建议。

最佳回答

就我所知,静态地图必须包含高射线,如高射线。

&zoom=17&z=17/code>

如果你使用非统计地图,你可以轻易找到和(或)确定最高层:

V2: http://googlegeodevelopers.blogspot.com/2009/06/how-low-can-you-go-introducing.html

v3: http://code.google.com/apis/maps/documentation/javascript/services.html#MaxZoom

鉴于你正在静态使用,我认为你有两个选择:

  1. do not set a zoom on the url query and let Google Maps determine the "best" zoom level.
  2. set the zoom to 17 or something even less zoomed in (14 or 15) and then allow the user to zoom in with a link that refreshes the map with a different URL string. (You need to do this with javascript)

http://www.ohchr.org。

这里是执行动物群 j的一种方式。 (我对此感兴趣,并 together。) 我确信,有更好/更可取的方式。

<><><><>>><>>>>><>>>>>>

<img src="http://maps.googleapis.com/maps/api/staticmap?center=55.516192,-87.39624&size=400x400&maptype=satellite&sensor=false&zoom=12" />

<input type="submit" id="in" value="Zoom in" />
<input type="submit" id="out" value="Zoom out" />

• 确保动物体积层处于 que点末。

<>JS

$( #in ).click(function(){
    var map = $( img ).attr( src );
    var zoomPat = /(.+)(zoom=)([d]*)/;
    var zoomLevel = map.match(zoomPat);
    var zoomLevelNum = Number(zoomLevel[3]); 

    if(zoomLevelNum == 21){
       alert( Maximum level reached );
    } 
    else{    
    var newZoom = zoomLevel[1] + zoomLevel[2] + (zoomLevelNum + 1);
    $( img ).attr( src , newZoom);           
    } 

});

$( #out ).click(function(){
    var map = $( img ).attr( src );
    var zoomPat = /(.+)(zoom=)([d]*)/;
    var zoomLevel = map.match(zoomPat);
    var zoomLevelNum = Number(zoomLevel[3]); 

    if(zoomLevelNum == 0){
       alert( Minimum level reached );
    } 
    else{    
    var newZoom = zoomLevel[1] + zoomLevel[2] + (zoomLevelNum - 1);
    $( img ).attr( src , newZoom);           
    } 

});

rel=“noreferer”>http://jsfiddle.net/jasongennaro/FFTKG/2/

问题回答

首先,我要谈谈THANK Jason Gennaro和他的共同提交文件的替代思想! 不幸的是,这一想法假定,每个地图上都设定了分层。 如果像我的情况一样,我让奥古拉(sic)调整地图本身的规模,那么我就对贾森法典进行了修改/补充。 如果你想利用他的思想,但希望地图在两个地点周围适当大小,使用下面的代码来计算距离,则你可以估算出一种动物群的浓度水平,以补充体积。 对这些距离的估测是经过大量测试。 我已经安装并测试了该守则。 工作完美。 欢乐。

function tom_distance2($lat1, $lng1, $lat2, $lng2, $miles = true)
{
  $pi80 = M_PI / 180;
  $lat1 *= $pi80;
  $lng1 *= $pi80;
  $lat2 *= $pi80;
  $lng2 *= $pi80;

  $r = 6372.797; // mean radius of Earth in km
  $dlat = $lat2 - $lat1;
  $dlng = $lng2 - $lng1;
  $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2);
  $c = 2 * atan2(sqrt($a), sqrt(1 - $a));
  $km = $r * $c;
  $di9 = round(($km * 0.621371192));
  if ($di9 >= "5000") {$tom98 = "1"; // zoom level
  } else if ($di9 >= "4000") {$tom98 = "2";
  } else if ($di9 >= "1500") {$tom98 = "3";
  } else if ($di9 >= "800") {$tom98 = "4";
  } else if ($di9 >= "400") {$tom98 = "5";
  } else if ($di9 >= "180") {$tom98 = "6";
  } else if ($di9 >= "100") {$tom98 = "7";
  } else if ($di9 >= "0") {$tom98 = "10";
  } else {$tom98 = "8";} // just in case :)
  return $tom98;
}

将这一职能称为......

$td2 = "&amp;zoom=" . tom_distance2($tlat1, $tlong1, $tlat2, $tlong2, 1);

页: 1 公布变量名称。 有时它们具有意义: 这是PHP。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!