By using some of the code in the pending pull request on GmlDataSource I have begun
working on a WFS ImageryProvider that can query a server for feature info and then
render the features.
See : https://github.com/sushrut141/Cesium-WebFeatureService
I have the provider able to query and render simple features published as vector layers in Geoserver.
I was hoping to integrate this module into the Cesium tree.
I would appreciate any help in adding more features to the module that users see fit.
I want to try your code. Can you tell me how to integrate it into Cesium?
Should I just put the WebFeatureServiceImageryProvider.js file somewhere in source code folders? I've put it in Source/Scene and wrote code for initialization in sandcastle, but an error occurs
//initialise cesium
var viewer = new Cesium.Viewer("cesiumContainer");
//initialise WFS provider
var wfs = new Cesium.WebFeatureServiceImageryProvider({
thank you for quick answer and help, but I still don't manage to make the plugin work. I'm not very experienced in programming and I don't understand what do you mean by including the plugin in main html page in a script tags. I see there are Cesium.js and main.js files in Source folder but there's no main.html file. I've included the WebFeatureServiceImageryProvider in Cesium.js that looks like this:
define(['./Core/appendForwardSlash', './Core/arrayFill', *...LOTS OF SIMILAR CODE...*
, './Scene/WebFeatureServiceImageryProvider', *LOTS OF SIMILAR CODE*
Scene_WebFeatureServiceImageryProvider, *LOTS OF SIMILAR CODE*
Cesium['WebFeatureServiceImageryProvider'] = Scene_WebFeatureServiceImageryProvider; *LOTS OF SIMILAR CODE*
I haven't changed anything in sandcastle code except the url. Do I have to put something there?
The file will need to be included in the main html page of your app.
I’m not sure how that works in sandcastle but in a basic webpage you would have something like
// instantiate the cesium globe
var viewer = new Cesium.Viewer('viewer');
// . create the wfs getter to load a vector layer on the globe.
var wfs = new Cesium.WebFeatureServiceImageryProvider({
url : "[http://localhost:8080/geoserver/web](http://localhost:8080/geoserver/web)",
layers : "vectorLayerName",
viewer : viewer
});
Hope that makes sense.
Regards,
Sushrut Shivaswamy
I've followed your advice, but still getting "Uncaught TypeError: Cesium.WebFeatureServiceImageryProvider is not a constructor (on line 4)".
Do you have any idea why is that so and how can I fix that?
Do I have to put WFS.js in a particular folder or it doesn't matter where I put it (like can I put it for example on Desktop)?
Also, you mentioned Cesium.js script tag but in examples from sandcastle there is only Sandcastle-header.js script tag like in the code below.
Thank you so much and sorry for bothering you,
Paula
I haven’t personally used this module, but from a quick search on the forum, it looks like TerriaJS (a library built on top of CesiumJS) supports WFS, see: