Yerel bir geojson dosyasından vektör kaynağı yükleyen bir fonksiyona sahibim.Kaynak vektör görüntüleniyor (Özellikler gösterilmiyor mu?)
Sorun şu ki, katmanlardan biri için uzak olmasına gerek yok, ancak özellikler kaynağın düzgün bir şekilde yüklenmesine rağmen hiçbir zaman gösterilmiyor ve konsol.loglar bana gerçekten onu getirdiğini gösteriyordu ... Satırı atıyorum: "this.layerSwitcherGroup.getLayers(). Push (this.pointsLayer)"; koddan. Bu satır yorumlandığında, yükleyici hiçbir zaman çalışmaz (konsoldan bir konsol.log görünmez).
Not: Sunucudaki dosya cr'ler eski haline gelinceye kadar güncellenene kadar cr'leri yalnızca geçici olarak düzenliyorum. Geojson dosyasını yerel işlevli sunucudan indirip indirip crs bölümünü düzenlediğimde de aynısını yaptım. Yerel işlev çalıştı, ancak uzak değil.
addPoints: function() {
this.addPointInteraction();
this.pointsLayer = new ol.layer.Vector({
source: new ol.source.Vector({
/**
* The function is responsible for loading the features and adding them to the source.
* ol.source.Vector sources use a function of this type to load features.
* @param extent - the area to be loaded
* @param resolution - the resolution (map units per pixel)
* @param projection - ol.proj.Projection for the projection as arguments
*
* this (keyword): within the function is bound to the ol.source.Vector it's called from.
*/
loader: function(extent, resolution, projection) {
console.log('vector Loader...');
var url = //can't show the url here;
$.ajax({
url: url,
context: this,
success: function(json) {
console.log('Data: ', json);
json.data.crs = {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
};
console.log('changed CRS: ', json);
var features = new ol.format.GeoJSON().readFeatures(json.data);
console.log('this inside loader: ', this);
this.addFeatures(features);
}
});
}
}),
style: this.defaultPointStyleFunction
});
this.layerSwitcherGroup.getLayers().push(this.pointsLayer);
this.pointsLayer.getSource().once("change", function(evt) {
console.log('pointsLayer once');
//console.log('pointsLayer changed: ', this.pointsLayer);
//console.log('pointsLayer source: ', this.pointsLayer.getSource());
console.log('pointsLayer features: ', this.pointsLayer.getSource().getFeatures());
//console.log('current layerSwitcherGroup layers: ', this.layerSwitcherGroup.getLayers());
this.hidePoints();
this.onSetSelection(1);
}, this);
this.currPointId = null;
},
yerel modu ile eserler yukarıda listelenen her işlev, bu yüzden ben uzaktan yükleyici ile yanlış yapıyorum emin değilim ...
Günlük ifadelerinin çıktısını ekler misiniz? –
Çıktı, vektörün doğru şekilde eklendiğini, tam olarak gösterilemediğini gösterir çünkü ondan çok fazla gizli bilgi gizlemek zorunda kaldım. :/Noktaların * yanlış yerde olduğunu gösteren * olduğunu keşfettim, bu yüzden bir yerde bir projeksiyon hatası var. – Ada