3

Is there any way to use the geoserver kml reflector in cesium viewer? I have millions of features with height value. The geoserver kml reflector works in google earths, but not in cesium.

  • What does not work? – Ian Turton Oct 30 '15 at 20:39
  • It works in GE. The kml contains a wms link so it's loading pictires. In a closely zoom level it renders kml vectors (a few 100). In cesium I added a this type of kml, but nothings happening... no errors, no features.. – Tamas Kosa Nov 2 '15 at 9:53
  • geoserver.geo-solutions.it/edu/en/google_earth/reflector.html This is what I would like to see to work in cesium. If I add this kind of kml to cesium nothing happening. – Tamas Kosa Nov 5 '15 at 10:42
  • Is your geoserver instance returning an Access-Control-Origin-Allow header? – DPierce Nov 12 '15 at 4:46
3

I have it working on a project I'm currently switching from Google Earth to Cesium. We've found that the crucial variable is mode=download because Cesium doesn't seem able to handle mode=refresh whether it comes from the KML reflector or the full WMS interface. I think this is because mode=download links behave like links to a static file, while mode=refresh relies on the NetworkLink construct that is specific to Google Earth.

  • Thanks for your answer, next week I'll try to check it. So how is this work? Will it download all the features? I have a couple of hundred thousand of features and it would be great if it renders in wms in high zoom levels and render the features as kml in low zoom level (the map window contains a couple of hundreds in this case) – Tamas Kosa Nov 20 '15 at 20:40
  • 1
    We've had to implement two things in our client-side JavaScript that we used to get for free from Google Earth & Geoserver: 1) Unfortunately when using mode=download you have to specify whether Geoserver will give you vector or raster data. So our own code now decides which to request based on the area in the viewport and a parameter that we hand-code for each layer. 2) We listen for Cesium moveEnd events and request the layer again each time the viewport has changed, with a new bbox. – Eldan Goldenberg Nov 20 '15 at 23:49
  • Getting these things basically working wasn't too difficult, but there's a lot of challenge & subtlety to making the interaction feel good. In particular we've had to invest a lot of time into tweaking where the threshold between vector and raster is, and when the refresh should really fire. – Eldan Goldenberg Nov 20 '15 at 23:52
  • Is this something what you could show me on a working sample? At the moment I have no clue where should I start. – Tamas Kosa Nov 30 '15 at 12:09
  • Not yet, but I should soon - it's work in progress. Here's the algorithm 1. Get the bounding box of the current view (let me know if you're also stuck with this - I actually have working code I can share for this part). 2. Estimate the size of the area in view. 3. Compare that to a score we set manually for each data layer (we're using the kmscore attribute that we used to pass to Geoserver). 4. Based on the relationship between 2 & 3, either request the layer from Geoserver with format=kml (to get vectors) or format=image/png – Eldan Goldenberg Dec 1 '15 at 18:40
0

Geoserver kml reflector works fine in Cesium.

...

    var optionsKML = {

    camera : viewer.scene.camera,

    canvas : viewer.scene.canvas,

    clampToGround: true

    };

    pk = viewer.dataSources.add(Cesium.KmlDataSource.load('http://xxxxxx.xxxx.xxx/geoserver/wms/kml?layers=layername', optionsKML));

...

KML data use styling from SLD.

Also set:

  1. In Cesium set infBox to true:

var viewer = new Cesium.Viewer('cesiumContainer', {

...

infoBox : true,

...

});

  1. Set "KML placemarks", title.ftl( for labels) and description.ftl ( if you want to display attrib data when clicked on kml entity in Cesium ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.