English 中文(简体)
如何计算适当的山 go图
原标题:How to calculate appropriate google maps zoom level

我有一个trick问...... 我正在使用山角地图静电灯,以树立一个带有标识的地图的形象。 我正在努力做的是,鉴于我想要展示的两个标识的位置,计算适当的动物群。

我有纬度A、长度A、纬度B、长度B和中心点(麻风)。 是否有任何人知道解决动物群的公式?

感谢!

问题回答

I took 3 static maps at levels 11, 12 and 13, and used the "Maps Labs" feature of Google Maps, holding down the shift key at the corresponding min/max latitude/longtitude marks. Then I wrote a Perl program to calculate the latitude/longtitude ranges, the expected values (with the formula I predicted by inspecting the data), and the deltas (ie. abs(expected - range)), which should be close to zero. Once I had convinced myself that I had gotten as close as I could, here were my results:

Z11:  LatRange[0.323999]  ExpLat[ 0.324]  DeltaLat[  0.0000000000000019]
Z11:  LonRange[0.439999]  ExpLon[  0.44]  DeltaLon[  0.0000000000000023]

Z12:  LatRange[0.161999]  ExpLat[ 0.162]  DeltaLat[  0.0000000000000010]
Z12:  LonRange[0.219999]  ExpLon[  0.22]  DeltaLon[  0.0000000000000011]

Z13:  LatRange[0.081000]  ExpLat[ 0.081]  DeltaLat[  0.0000000000000031]
Z13:  LonRange[0.109999]  ExpLon[  0.11]  DeltaLon[  0.0000000000000006]

我所用的公式是:

ExpLat = 0.162 * (2 ** (12 - Z))
ExpLon = 0.220 * (2 ** (12 - Z))

如果ExpLat,ExpLon是预期的纬度和长度范围,Z是动物体。

尽管你正在使用静态地图复印件,但你仍然能够参考常规地图档案,然后进行捆绑盒式计算:

map = new GMap2(document.getElementById("map"));

// Define the two corners of the bounding box
var sw = new GLatLng(59.0, 13.12); //any lat,lng pair
var ne = new GLatLng(60.35, 16.90);

var bounds = new GLatLngBounds(sw, ne);

var zoom = map.getBoundsZoomLevel(bounds));




相关问题
How to decide the current point reach on google map?

How to decide the current point reach on google map? I have a list of points (pickup points) of a route that I want to show in my google map with polyline. Now i have to get the current location of ...

Topographical or relief data in Map APIs

I was wondering if anyone knew of any map APIs that offer topographical or relief data? I ve had a quick look at Google and Bing APIs, but could find nothing there. Google allow you to view a map as ...

Using maps on Windows Mobile

I m experimenting with maps on different mobile platforms. Getting Google Maps to work on Android was easy, following this tutorial. Getting the same to work on Windows Mobile is a different matter. ...

Adding a custom icon to a google map

I need a hand adding a custom icon to some Google Maps javascript. Code below for your reference: function populateMap() { var map = new GMap2(document.getElementById("map")); map.setCenter(new ...

RSS to KML Overlay

I m want to display my blog as a Google Map overlay (each post contains geotags). How can I dynamically create a KML overlay from an RSS? Or better, how can I create a loop (PHP) that would display ...

开放街道地图管理员

我需要开放Street的标记管理员。 地图,如山角地图。

热门标签