te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - Unable to display 3 map types in Google Maps - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Unable to display 3 map types in Google Maps - Stack Overflow

programmeradmin4浏览0评论

I am new to Google Maps.
I want to display Google maps with three different map types(map,satellite,Hybrid) in the map.

For that I am writing code like

function initialize() {
  var mapOptions = {
    center: new google.maps.LatLng(35.02, 111.02),
    zoom: 8, mapTypeControlOptions: {
  mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE,google.maps.MapTypeId.HYBRID]
    },
    mapTypeId: google.maps.MapTypeId.ROADMAP,
  };
  var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

But with the above code I am able to display only Map and satellite map types in the map. the third map type hybrid is not displaying in the map. Also when I click on the type satellite I am getting an option like Label . So I don't want to display the label option under satellite.

I am new to Google Maps.
I want to display Google maps with three different map types(map,satellite,Hybrid) in the map.

For that I am writing code like

function initialize() {
  var mapOptions = {
    center: new google.maps.LatLng(35.02, 111.02),
    zoom: 8, mapTypeControlOptions: {
  mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE,google.maps.MapTypeId.HYBRID]
    },
    mapTypeId: google.maps.MapTypeId.ROADMAP,
  };
  var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

But with the above code I am able to display only Map and satellite map types in the map. the third map type hybrid is not displaying in the map. Also when I click on the type satellite I am getting an option like Label . So I don't want to display the label option under satellite.

Share Improve this question edited Oct 12, 2012 at 14:02 johannes 7,2725 gold badges40 silver badges57 bronze badges asked Oct 12, 2012 at 13:54 krishna savithkrishna savith 911 silver badge4 bronze badges 1
  • it's off-topic, but remove the trailing ma here which will throw an error in IE: mapTypeId: google.maps.MapTypeId.ROADMAP, – duncan Commented Oct 12, 2012 at 14:52
Add a ment  | 

3 Answers 3

Reset to default 8

Maps v3 will always condense the four available mapTypeIds (HYBRID, ROADMAP, SATELLITE, TERRAIN) into two buttons plus a checkbox for each of these buttons. So SATELLITE + HYBRID will give you a Satellite button with a Labels checkbox and ROADMAP + TERRAIN will give you a Map button with a Terrain checkbox.

Please note that the checkbox is only shown when you hover over an active button, so you will have to be in Map mode to see the Terrain checkbox under the button and you must be in Satellite mode to see the Labels checkbox!

It is interresting to see that there actually is a Hybrid button, but it only bees visible when you add HYBRID to the mapTypeIds without adding SATELLITE. The same is true for the Terrain button, which only bees visible when you add TERRAIN to the list, but not ROADMAP.

Switching the mapTypeControlOptions.style to a dropdown box (DROPDOWN_MENU) instead of buttons (HORIZONTAL_BAR) will also not reveal more than two items in the resulting dropdown box. Just like the buttons there will be a maximum of two dropdown items plus a checkbox for each of them.

looks like you can have only 2 of the 4 MapTypeId labels on your map.

but you can can force the map to hybrid by setting

map.setMapTypeId(google.maps.MapTypeId.HYBRID)

at any time, be it the user clicking a link, a button, a timmer, at the end of your code, etc.

check this jsfiddle: http://jsfiddle/RASG/vDLfs/


i just discovered something new on a google group.

when you add google.maps.MapTypeId.HYBRID to mapTypeIds, and you already have google.maps.MapTypeId.SATELLITE, instead of showing both options google maps now add an option called "labels" when you mouseover "satellite".

the effect is the same as having the "hybrid" option in v2.

check the updated jsfiddle: http://jsfiddle/RASG/vDLfs/6/

Adding a Google Earth map type to the display disables the TERRAIN option under ROADMAP and the HYBRID option under SATELLITE.

发布评论

评论列表(0)

  1. 暂无评论