我正在尝试构建一个搜索栏,将其缩放到我的地理服务器中该点的位置。每当我在搜索栏中搜索一个值时,都会出现此错误:Uncaught TypeError:无法读取属性“ call”。任何帮助,将不胜感激。
var url1 = historic_structures;
var search; //setting variable for our layer
$.getJSON(url1, text, function(data) {
search = L.geoJson(data, {
pointToLayer: function(feature, latlng) {
return L.circleMarker(latlng, {
radius:6,
opacity: .5,
//color: "#000",
color:getColor(feature.properties.name),
fillColor: getColor(feature.properties.name),
fillOpacity: 0.8
}); //.bindTooltip(feature.properties.Name);
},
onEachFeature: function (feature, layer) {
layer._leaflet_id = feature.properties.name;
var popupContent = "<p>The <b>" +
feature.properties.name + "</b> play here,</br> They are in the " +
feature.properties.iso + "</br>" +
'<a href="'+ feature.properties.Directory +'" target="_blank">Local directory</a></p>' ;
if (feature.properties && feature.properties.popupContent) {
popupContent += feature.properties.popupContent;
}
layer.bindPopup(popupContent);
}
}).addData(data).addTo(map); // adding the layer fetched from .json file to the map
//---------------adding the leaflet-search plugin inside the $GetJSON function ----------
L.control.search({
layer: historic_structures,
initial: false,
propertyName: 'ISO', // Specify which property is searched into.
zoom: 18,
position: 'topleft'
}).addTo(map);
}); // $GetJSON function enclosure for this layer