从google maps V2迁移到Version 3
Migration from google maps V2 to Version 3
我正在进行从google maps V2到V3的迁移项目,无法获得以下工作
<!DOCTYPE html>
<html>
<head>
<script
src="http://maps.googleapis.com/maps/api/js?key=myApiKey&sensor=false">
</script>
<script>
function initialize()
{
var map=new google.maps.Map(document.getElementById("googleMap"));
map.setCenter(new google.maps.LatLng(51.508742,-0.120850),5);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="googleMap" style="width:500px;height:380px;"></div>
</body>
</html>
实际上我不想在新的google.maps.Map
函数中使用options参数。我想使用map将地图居中。中心功能。
这是错误的:
map.setCenter(new google.maps.LatLng(51.508742,-0.120850),5);
setCenter只接受一个参数,即LatLng对象。试试这个:
map.setCenter(new google.maps.LatLng(51.508742,-0.120850));
相关文章:
- Firebase迁移-简单的Firebase.set没有'不再工作了——旧的还是新的
- 没有在Angular应用程序中定义firebase(在firebase迁移之后)
- 2012年12月迁移在App Dashboard中不可用
- 将javascript应用程序迁移到使用AMD的提示(例如requirejs)
- 从Sencha Touch迁移到EXT JS 6-Contoller的默认/空路由
- Knex迁移;不要创造任何东西
- 在Google Apps上从JavaScript迁移到Python
- 从 ExtJS 4 迁移到 Ext JS 5
- 将迁移的Silverlight到HTML应用程序划分为NPM模块
- 如何从SQL API代码迁移到Google Fusion Table API v1
- 从Google Maps JavaScript API V2迁移到V3,编码多边形
- 正在将构造函数函数迁移到TypeScript
- 停止sails.js中模式的自动迁移
- Angularjs未捕获错误:迁移到V1.3时出现[$injector:modulerr]
- IE 11迁移问题
- 将Mootools迁移到prime或primish/使用JavaScript类的最佳方式
- Realm React Native-需要迁移:目标类型'字符串'不会'不存在于属性'电
- 网站从http迁移到https
- 将项目从mootools迁移到prime
- 从google maps V2迁移到Version 3