I am trying to render a large geojson using geojson-vt. But i am facing a problem, my programs stops at the below line:
var tileIndex = geojsonvt(json, tileOptions);
Debug disappears after this line…
I am trying to use below code for geojson-vt:
var url = ‘./geojson/sample.geojson’;
Cesium.GeoJsonDataSource.load(url).then(function (json) {
var arr = ;
console.log(json._entityCollection);
arr = json._entityCollection._entities;
var tileOptions = {
maxZoom: 18,
tolerance: 5,
extent: 4096,
buffer: 64,
debug: 0,
indexMaxZoom: 0,
indexMaxPoints: 100000,
};
var tileIndex = geojsonvt(json, tileOptions);
var vectorSource = new ol.source.VectorTile({
format: new ol.format.GeoJSON(),
tileGrid: ol.tilegrid.createXYZ(),
tilePixelRatio: 16,
tileLoadFunction: function (tile) {
var format = tile.getFormat();
var tileCoord = tile.getTileCoord();
var data = tileIndex.getTile(tileCoord[0], tileCoord[1], -tileCoord[2] - 1);
var features = format.readFeatures(
JSON.stringify({
type: ‘FeatureCollection’,
features: data ? data.features :
}, replacer));
tile.setLoader(function () {
tile.setFeatures(features);
tile.setProjection(tilePixels);
});
},
url: ‘data:’
});
var vectorLayer = new ol.layer.VectorTile({
source: vectorSource
});
map.addLayer(vectorLayer);
});