gpt4 book ai didi

javascript - 传单标记未显示

转载 作者:行者123 更新时间:2023-11-30 10:16:18 25 4
gpt4 key购买 nike

此代码曾经有效,但我不确定我更改了什么,或者在 Leaflet 中更改了什么以破坏它,但没有显示任何标记。数据正在正确返回,正在创建标记对象,但没有显示任何标记。我在这里不知所措。使用 0.7.2。让我向您展示代码...

  function getGameMarkers(){
var center = map.getCenter();
var zoo = map.getZoom();
var bounds = map.getBounds();
var min = bounds.getSouthWest().wrap();
var max = bounds.getNorthEast().wrap();

//console.log(bounds);
//console.log(min);
//console.log(max);

$.ajax({type: "GET", url: "./ajax/markers.php", dataType: "json", data: "clat="+center.lat+"&clng="+center.lng+"&zoom="+zoo+"&minlat="+min.lat+"&minlng="+min.lng+"&maxlat="+max.lat+"&maxlng="+max.lng+cookiestr,
success: function(data){
if (data.showmap == 1) {
plotlist = data.map_data;
removeMarkers();
//console.log(plotlist.length);

for (i=0;i<plotlist.length;i++) {
var iconic = String(plotlist[i].icon);
var plotmark = new L.marker([plotlist[i].lat,plotlist[i].lng], {icon: L.icon({iconUrl: iconic, iconSize: [32, 32]}) }).bindPopup(plotlist[i].html);
map.addLayer(plotmark);
console.log(plotmark);
console.log(plotlist[i]);
plotlayers.push(plotmark);
}

$("#content").html(data.html);
}else {
$("#map_content").show();
$("#map_content").html(data.main_content);
$("#content").html(data.side_content);
}
}
});

一切正常。服务器正确返回信息。列表中始终有 13 个项目(预期行为),我将 ploSTList[i] 的内容以及 plotmarker 对象打印到控制台。

这里是 plotlist[i] 的输出:

e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
Object {lat: "41.564087", lng: "-73.023376", icon: "./img/avicon3.png", html: "<a href='#' onclick='getcon(8,107184863);'>viktor</a><br/><br/>Level: 2 / Energy: 3 "} (index):100
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
Object {lat: "40.944637", lng: "-73.671570", icon: "./img/avicon3.png", html: "<a href='#' onclick='getcon(8,116518883);'>gambatedhan</a><br/><br/>Level: 3 / Energy: 8 "} (index):100
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
Object {lat: "41.288128", lng: "-74.135742", icon: "./img/avicon2.png", html: "<a href='#' onclick='getcon(8,118454338);'>halil</a><br/><br/>Level: 1 / Energy: 8 "} (index):100
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
Object {lat: "40.857449", lng: "-74.039612", icon: "./img/avicon3.png", html: "<a href='#' onclick='getcon(8,120599464);'>KIM15</a><br/><br/>Level: 2 / Energy: 1 "} (index):100
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
Object {lat: "40.6687012", lng: "-73.9646988", icon: "./img/bicon2.png", html: "<a href='#' onclick='getcon(2, 157764); return false;' >Brooklyn Botanic Garden</a>"} (index):100
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
Object {lat: "40.7062111", lng: "-73.3062286", icon: "./img/ricon.png", html: "<a href='#' onclick='getcon(1, 114779); return false;' >West Islip</a>"} (index):100
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
Object {lat: "40.7625999", lng: "-73.4531784", icon: "./img/ricon.png", html: "<a href='#' onclick='getcon(1, 114526); return false;' >Old Bethpage</a>"} (index):100
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
Object {lat: "40.9381485", lng: "-73.8320770", icon: "./img/ricon.png", html: "<a href='#' onclick='getcon(1, 114063); return false;' >Bronxville</a>"} (index):100
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}

一切看起来都很好......现在是 plotmark 输出:

e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}
(index):99
e {options: Object, _latlng: o.LatLng, _initHooksCalled: true, _leaflet_events: Object, _popupHandlersAdded: true…}

再一次,看起来不错。

所以...

以下是我对可能发生的情况的看法...返回的那些 lat/lng 坐标被弃用或被不同地解释并且它们不在 map 上,或者图层由于某种原因未显示。有什么想法吗?

最佳答案

事实证明,世界正在重新开始,并 self 包裹。要解决此问题,需要在 map 选项中将 worldCopyJump 设置为 true。

关于javascript - 传单标记未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23517214/

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