使用ext中的google map如何修改默认坐标

evanerv0079 2009-04-20 06:00:38
我想使用ext做个google map的应用,使用的就是ext自带的key请问是否可以修改默认的经度纬度,我现在打开地图就是美国的坐标
gmap.js
Ext.onReady(function(){

var mapwin;
var button = Ext.get('earth-win-shortcut');
var Width = window.screen.availWidth-100;
var Height = window.screen.availHeight-200;

button.on('click', function(){
// create the window on the first click and reuse on subsequent clicks
if(!mapwin){

mapwin = new Ext.Window({
layout: 'fit',
title: '网站所在地',
closeAction: 'hide',
width:Width,
height:Height,
x: 40,
y: 60,
items: {
xtype: 'gmappanel',
region: 'center',
zoomLevel: 14,
gmapType: 'map',
mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
setCenter: {
geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',
marker: {title: 'Fenway Park'}
},
markers: [{
lat: 40.22,//北京纬度
lng: 116.2,//北京经度
marker: {title: 'Boston Museum of Fine Arts'},
listeners: {
click: function(e){
Ext.Msg.alert('Its fine', 'and its art.');
}
}
},{
lat: 40.22,//北京纬度
lng: 116.2,//北京经度
marker: {title: 'Northeastern University'}
}]
}
});

}

mapwin.show();

});

});



...全文
689 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Glomb 2010-07-29
  • 打赏
  • 举报
回复
setCenter: {
geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',
marker: {title: 'Fenway Park'}
},
这是设置地图中心点的。你得修改这里才能把地图的中心点设置在北京。geoCodeAddr这个是地址转换成坐标的函数。
zgb0331 2009-05-02
  • 打赏
  • 举报
回复
路过,拿分,闪人!!!
HNsnopy 2009-05-02
  • 打赏
  • 举报
回复
详细查看Google Map API.EXTJS也是调用了Google的API而已
Ghost_520 2009-04-26
  • 打赏
  • 举报
回复
geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',

这个属性是设定默认坐标的吧, 如果你要设定一个默认坐标的话, 要把你要设定的坐标地理位置修改为美国地址格式, 如

"348 yangyuan Way,Wuhan,湖北 ,XXX, China" , 好像是这样设置的 。
mike_24 2009-04-26
  • 打赏
  • 举报
回复
UP

52,782

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧