未捕获的TypeError:无法读取属性' 0'未定义的MapBox

时间:2015-07-20 14:27:20

标签: javascript mapbox

我的函数showMap的参数数据似乎不起作用。我undefineddata.latlng data.lbounds window.setTimeout(initMap, 100); function initMap() { //this should check if your leaflet is available or wait if not. if(typeof L === "undefined"){ window.setTimeout(initMap, 100); return; } L.mapbox.accessToken = 'myAccessToken'; $('.map').each(function() { var map = L.mapbox.map($(this).attr('id'), 'mapbox.streets', {zoomControl:false}).setView([48.855, 2.4], 8); var geocoder = L.mapbox.geocoder('mapbox.places'); var adress = document.getElementById($(this).attr('id')); geocoder.query(adress.getAttribute("data-adress-map"), showMap); function showMap(err, data) { // The geocoder can return an area, like a city, or a // point, like an address. Here we handle both cases, // by fitting the map bounds to an area or zooming to a point. if (data.lbounds) { map.fitBounds(data.lbounds); } else if (data.latlng) { map.setView([data.latlng[0], data.latlng[1]], 13); } var marker = L.marker([data.latlng[0], data.latlng[1]]).addTo(map); marker.bindPopup(adress.getAttribute("data-title-map") +"<br>"+ adress.getAttribute("data-adress-map")); new L.Control.Zoom({ position: 'bottomright' }).addTo(map); } }); } 。我不知道如何调试它。我的代码以前工作得很好......

感谢您的帮助。

data

编辑:

我找到了。这是一个非常愚蠢的问题。 select distinct * from [KUNDEN] k1 where not exists ( select * from [BELEG] b where k1.Nummer = b.Adressnummer) and exists ( select * from [KUNDEN] k2 where k1.Nummer <> k2.Nummer and k1.Name = k2.Name and k1.Vorname = k2.Vorname) 工作正常。事实上,我的地址不起作用,因为内部有逗号。好的,谢谢。

1 个答案:

答案 0 :(得分:0)

我找到了。这是一个非常愚蠢的问题。数据工作正常。事实上,我的地址不起作用,因为内部有逗号。好的,谢谢。

相关问题