【发布时间】:2014-11-14 07:08:56
【问题描述】:
我正在尝试为谷歌地图制作自定义叠加层。我使用这个this 示例。而且我对覆盖宽度定义有疑问。
var sw = overlayProjection.fromLatLngToDivPixel(this.bounds_.getSouthWest());
var ne = overlayProjection.fromLatLngToDivPixel(this.bounds_.getNorthEast());
// Resize the image's div to fit the indicated dimensions.
var div = this.div_;
div.style.left = sw.x + 'px';
div.style.top = ne.y + 'px';
div.style.width = (ne.x - sw.x) + 'px';
div.style.height = (sw.y - ne.y) + 'px';
此代码返回小于一个像素的宽度,用于与此 latlonbox 叠加:
<LatLonBox>
<north>90.0</north>
<south>-90.0</south>
<east>180.0</east>
<west>-180.0</west>
</LatLonBox>
有人遇到过这个问题吗?也许有人知道解决方案。如果有任何帮助,我将不胜感激。
【问题讨论】:
标签: google-maps google-maps-api-3 overlay custom-overlay