我有一组标记以缩放级别15添加到地图中。标记lat和lng当前设置为小数点后第6位。
当我放大或缩小标记位置时,它们会移出正确的位置。我是否需要在每个缩放级别删除和重绘标记?我需要提高我的坐标的准确性吗?这让我发疯了......
测试页:http://m.uwosh.edu/api/v1.0/map/ 点击底栏中的黄色图标。
我正在创建我的标记:
function createMarker(data, type)
{
var posn = new google.maps.LatLng(data.lat,data.lng);
var title = data.title;
var image,shadow,shape;
if (data.typeId === '101') {
image = new google.maps.MarkerImage('/api/v1.0/map/images/buildings.png',
// This marker is 20 pixels wide by 32 pixels tall.
new google.maps.Size(24, 28),
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
new google.maps.Point(0, 28));
shadow = new google.maps.MarkerImage('/api/v1.0/map/images/shadow-buildings.png',
// The shadow image is larger in the horizontal dimension
// while the position and offset are the same as for the main image.
new google.maps.Size(39, 28),
new google.maps.Point(0,0),
new google.maps.Point(0, 28));
}
var markerOptions = {
position: posn,
title: title,
shadow: shadow,
icon: image
};
var marker = new google.maps.Marker(markerOptions);
// could add event handler here
//add marker to array for latter use
if (type === 'building') {
buildingMarkers.push(marker);
}
}
答案 0 :(得分:1)
当标记放置在纬度/经度位置时,您不必添加/删除标记。
也许某些代码可能会帮助我们解决这个问题。