gpt4 book ai didi

google-maps - 标记错误地更改了缩放位置

转载 作者:行者123 更新时间:2023-12-02 04:11:02 28 4
gpt4 key购买 nike

我在缩放级别15上将一组标记添加到 map 。标记lat和lng当前设置为小数点后第六位。

当我放大或缩小标记位置时,它们会移出其正确位置。我是否需要在每个缩放级别上删除并重新绘制标记?我需要提高坐标的准确性吗?这真让我抓狂...

测试页: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);
}
}

最佳答案

您不必添加/删除标记,因为标记放置在经/纬度位置。

也许一些代码可以帮助我们解决这个问题。

关于google-maps - 标记错误地更改了缩放位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5199018/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com