Problem with displaying KML points from Geoserver

1. A concise explanation of the problem you’re experiencing.

Since Cesium version 1.4x have problems with displaying points as KML ( from Geoserver ). Have three checkbox where I can on/off points as KML.

The problem is that when I turn on the KML points, the KML points are displayed only in current window screen area of the map. All points “outside” window map screen at the time of the “on” click aren’t visible as KML.

Interesting thing is that everything was fine in version 1.39, but not in newer versions (!)

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

This is the code for a poi category “Histo” ( Layers -> POI -> Histo ), but the problems are the same for the rest of POI categories ( Alp huts and HPO/KT checkpoints )

var optionsKML = {

camera : viewer.scene.camera,

canvas : viewer.scene.canvas,

clampToGround: true

};

function poi1() {

if (dvorci) {

viewer.dataSources.remove(dvorci);

dvorci = null;

} else {

viewer.dataSources.add(Cesium.KmlDataSource.load(geoserverUrl + ‘/wms/kml?layers=castles_ruins_radi’, optionsKML))

.then(function(dataSource){

dvorci= dataSource;

});

}

};

Here are the live links to same code in different Cesium versions:

Cesium v1.39 - https://topomap.ddns.net//cesium139/apps/hrbh.html ---- working fine when u move the map

Cesium v1.43 - https://topomap.ddns.net//cesium143/apps/hrbh.html ---- KML point visible only in current map window

Best way to test it is to zoom into area of the National Park Brijuni - just search Brijuni, Croatia.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

ATM this is, for me, the easiest way to display points attributes from Geoserver onto Cesium globe.

4. The Cesium version you’re using, your operating system and browser.

Cesium v1.43 , Windows 10 Pro x64, Chrome, FF, Edge

Hi Davor,

The camera parameter you are passing when loading the KML is determining the view of the entities that should be shown. You can try listening to KmlDataSource.refreshEvent if the network link is watching for the camera, or watching for camera update yourself and calling the KmlDataSource.update method.

Hope that help, thanks!

Gabby

Thx for the reply Gabby!

In the mean time was evaluating OpenLayers so I’ll try olCesium, looks much easier to implement all necessary features…

Davor

Huh, the year pass but the problem still persist

Pls, anyone have a solution for displaying KML points outside initial map screen … eg. after map moving/zooming …

Gabby points me in few directions, but have no idea how to implement them :frowning:

Source code is still the same,

on/off working fine, but this pan/zoom thing is a pain :

var optionsKML = {

camera : viewer.scene.camera,

canvas : viewer.scene.canvas,

clampToGround: true

};

var dvorci;

function poi1() {

if (dvorci) {

viewer.dataSources.remove(dvorci);

dvorci = null;

} else {

viewer.dataSources.add(Cesium.KmlDataSource.load(geoserverUrl + ‘/wms/kml?layers=castles_ruins_radi’, optionsKML))

.then(function(dataSource){

dvorci= dataSource;

});

}

};

Unfortunately didn’t found any working codes examples with this problem/solution, so if anyone have working code, please post it here.

Thanks in advance,

Davor