我有一個JSON文件,包含了文件名和邊界框的每一行中的單張地圖添加圖像:使用JSON
{ "type": "Feature", "properties": { "name": "images\/gis\/json_Andros1.png" }, "geometry": { "type" : "LineString", "coordinates": [[37.8416750531,24.7951207305],[37.8418346487,24.7954102608]] } }
我通過訪問該文件:
var raster_group = new L.featureGroup([]);
$.getJSON($('link[id="rasters_geojson"]').attr("href"), function(data) {
var geojson = L.geoJson(data, {
onEachFeature: function (feature, layer) {
var rasterfilename = (String(feature.properties['name']));
var rastercoordinates = L.GeoJSON.coordsToLatLngs(feature.geometry['coordinates'],0);
alert(rasterfilename); alert(rastercoordinates);
layer = new L.imageOverlay(rasterfilename, rastercoordinates);
return layer;
}
});
geojson.addTo(raster_group);
});
誤差是NS_ERROR_NOT_AVAILABLE:
還有一個問題。如何只加載地圖邊界框內的圖像?
最終它會成爲這張地圖上的光柵圖像的結果,所以我必須找到一種方法來加載視圖所需的圖像。 –