Serving vector data from Geoserver to Cesium


I want to create vector layer on Geoserver and serve it to Cesium sandcastle application so that I can apply custom styles on entities from vector layer. If someone has an experience with creating vector layers on Geoserver and serving them to Cesium it would be most helpful.
I set up Geoserver and Cesium. I created workspace, store and layer on Geoserver.
All set up but somehow I'm missing this connection point between Geoserver and Cesium.

The questions are:

1. How to load layer from Geoserver to Cesium:
If it's even possible to do this, which method should I use? GeoJsonDataSource.load takes a layer from SampleData folder, but can I provide it an URL of my Geoserver layer (something like http://localhost:8080/geoserver/workspace:layer)?

2. Vector layer data format:
I've seen topics concerning this, but haven't found detailed explanation on how to do this exactly; someone mentioned that you can't create GeoJson layer on Geoserver but you can get GeoJson as an output? What does 'output' mean? I don't have much experience with Geoserver.

I need to do this because I want to make Cesium webGIS application which shows objects such as buildings, roads, infrastructure etc. as a part of larger webGIS solution, with all data stored on company's server.
The reason for GeoJson is because I have experience with styling GeoJson entities.

I'm using:
Cesium 1.39
Windows 7 64bit
Chrome browser
Geoserver not locally installed but on company's server

Hi Paula,

For a GeoJson file, you would use GeoJsonDataSource.load, and you can indeed pass in any valid URL. The Cesium Workshop Tutorial shows some examples of loading and styling data, from KML, GeoJson, and the more Cesium-specific CZML formats.

I’m not familiar with Geoserver, so hopefully a member of the community can chime in on how to output a GeoJson.



Hi Gabby,

thanks for reply!
I found a plugin for WFS developed by Sushrut Shivaswamy -->!topic/cesium-dev/Jkga8_8tPWA
And Sushrut was very kind and helpful, but I still didn't manage to implement it. I assume it's because of my lack of knowledge in programming. Can you help me with this or do you know if someone from community used this plugin before so I can see an example which can help me to implement this plugin?

I'm getting the "Uncaught TypeError: Cesium.WebFeatureServiceImageryProvider is not a constructor (on line 4)"

Thank you,

Hi Paula,

I haven’t used it myself yet, so I can’t provide support, hopefully another member of the community could chime in. Offhand, it looks like you may not be able to use Cesium.WebFeatureServiceImageryProvider to create that imagery provider, as it is not in the Cesium namespace. Make sure the library is being loaded and try just WebFeatureServiceImageryProvider.



Hi Gabby,
I am facing the same issue as what Paula is facing. Is there any workaround for this issue?

Or , is there any other way to add WFS layer to Cesium map that you can share with us?! That will be of great help, thank you.


I followed up on this here:

Hope that helps.

Thank you for the quick reply Omar, that helps!