Zoom Level Example: Weather Map-GoogleMaps/API/doc/MarkerManagerExamples/ZoomLevelExample-N☆E 学習帳

[ リロード ]   [ ソース ]  [ トップ | 一覧 | 単語検索 | 最新 | バックアップ | ヘルプ ]

Counter: 3163, today: 3, yesterday: 3

Zoom Level Example: Weather Map

http://www.google.com/apis/maps/docu­mentation/

Version 2 (2006.11)

The following example creates a mock weather map for Europe. At zoom level 3, 20 randomly distributed weather icons are displayed. At level 6, when all 200 cities with population over 300,000 are easily distinguished, an additional 200 markers are shown. Finally, at level 8, 1000 markers are shown. (Note: to simplify the example, markers will be added at random locations.)

function setupMap() {
  if (GBrowserIsCompatible()) {
  map = new GMap2(document.getElementById("map"));
  map.addControl(new GLargeMapControl());
  map.setCenter(new GLatLng(41, -98), 4);
  window.setTimeout(setupWeatherMarkers, 0);
  }
 }
 
 function getWeatherMarkers(n) {
  var batch = [];
  for (var i = 0; i < n; ++i) {
  batch.push(new GMarker(getRandomPoint(), { icon: getWeatherIcon() }));
  }
  return batch;
 }
 
function setupWeatherMarkers() {
  mgr = new GMarkerManager(map);
  mgr.addMarkers(getWeatherMarkers(20), 3);
  mgr.addMarkers(getWeatherMarkers(200), 6);
  mgr.addMarkers(getWeatherMarkers(1000), 8);
  mgr.refresh();
 }