in the below posted code, i want to pass the parameter keyGridsAsGeoJSON
as input to the function in style
attribute.every time i print the value of k
which is var k = keyGridsAsGeoJSON
i receive the values posted below.
i expect that k
contains values which contained in keyGridsAsGeoJSON
.
the values in keyGridsAsGeoJSON
are as shown in the image below.
please let me know why the contents of k
is not as the contents of keyGridsAsGeoJSON
value of k:
k: RenderFeature {id_: undefined, type_: 'Polygon', flatCoordinates_: Array(10), flatInteriorPoints_: null, flatMidpoints_: null, …}
ends_: [10]
flatCoordinates_: (10) [738401.380994772, 6643445.99157804, 738417.2804938197, 663446.495435405, 38417.7843511839, 643430.558613589, 738401.035135203, 6643430.054756225, 73841.3809947722, 643445.99157804]
flatInteriorPoints_: null
flatMidpoints_: null
id_: undefined
properties_: {layer: 'default'}
type_: "Polygon"
[[Prototype]]: Object
code:
public visualisePolygonsAsMVTTilesOnMapWithColors(map,keyGridsAsGeoJSON,fillColor,strokeColor,text){
var features = [];
var iter = 0
var k = keyGridsAsGeoJSON
console.log("keyGridsAsGeoJSON:",keyGridsAsGeoJSON)
keyGridsAsGeoJSON.forEach(function(keyGridAsGeoJSON) {
let polygonGeometry = [keyGridAsGeoJSON['features'][0]['geometry']]
polygonGeometry.forEach(function(geojson) {
var geometry = new GeoJSON().readGeometry(geojson, {
dataProjection: 'EPSG:4326',
featureProjection: map.getView().getProjection()
});
features.push(new Feature(geometry));
});
});
var vectorTile = new VectorTileLayer({
source: new VectorTileSource({
format: new MVT(),
url: environment.LocalHostForTileLayerSourceAsMVTTileForZXYWS + "/{z}/{x}/{y}"
}),
style: function (k){
console.log("features:",features)
console.log("k:",k)
}
});
return vectorTile;
}