简体   繁体   English

从Google地图版本2切换到版本3后,为什么我的标记不会显示?

[英]Why don't my markers display after switching from version 2 to version 3 of Google Maps?

After the transition from version 2 to version 3 of Google Maps, the markers are no longer visible. 从Google地图版本2过渡到版本3后,标记将不再可见。 I can not find the error! 我找不到错误! Can anyone help me? 谁能帮我? The offending page is http://www.lalpinistavirtuale.it/default.asp (below is a Google map where you should see about 200 clickable marker). 违规页面是http://www.lalpinistavirtuale.it/default.asp (下面是一张谷歌地图,你应该看到大约200个可点击标记)。 Thanks in advance 提前致谢

你创建的标记功能是使用“Gmarker”而在V3中你应该使用“google.maps.Marker”

In your initialize function, you have switched the first section of code over to v3, but you have some more work to do: initialize函数中,您已将第一部分代码切换到v3,但还有一些工作要做:

  • GSize(32,32) should become: google.maps.Size( 32, 32) GSize(32,32)应该成为: google.maps.Size( 32, 32) GSize(32,32) google.maps.Size( 32, 32)
  • GPoint(16,32) should become: google.maps.Point( 16, 32) GPoint(16,32)应该成为: google.maps.Point( 16, 32) GPoint(16,32) google.maps.Point( 16, 32)
  • GLatLng(44.1883535,7.41206386) should become: google.maps.LatLng( 44.1883535, 7.41206386) GLatLng(44.1883535,7.41206386)应该成为: google.maps.LatLng( 44.1883535, 7.41206386)
  • GIcon creation should be refactored to use: google.maps.MarkerImage( url, size:Size, origin?:Point, anchor?:Point, scaledSize?:Size ) 应该重构GIcon创建: google.maps.MarkerImage( url, size:Size, origin?:Point, anchor?:Point, scaledSize?:Size )
  • map.addControl calls should be refactored into: MapOptions properties as follows: map.addControl调用应该重构为: MapOptions属性,如下所示:

var mapOpts = {
    panControl:        true,   // First half of replacing GLargeMapControl
    zoomControl:       true,   // Other half of replacing GLargeMapControl
    scaleControl:      true,   // Replaces GScaleControl
    mapTypeControl:    true    // Replaces GMapTypeControl
};

Each of these controls have options that may be set; 这些控件中的每一个都有可以设置的选项; more details are at the v3 API Reference . 更多详细信息,请参阅v3 API参考 You may have other v2 code that has to be refactored, but that's the lion's share. 您可能有其他必须重构的v2代码,但这是最重要的。 You are welcome :) 别客气 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM