Hi,
In my app I have an entity collection received from geoJson.
I need to convert it to primitive collection.
The entity exposes the polygon/billboard graphics. How does one convert the graphics to the actual billboard/polygon instances?
Or, if there is a better way, to convert a whole entity collection to primitive collection.
Once you load a data source, you just add it to the list of data sources and everything is done for you.
viewer.dataSources.add(dataSource);
Also see this example:
http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=GeoJSON%20and%20TopoJSON.html&label=DataSources
I’ve already done that. My problem is that I’m using a quadtree implementation, so for every tile I call for another KML and I want to put it in my tile’s primitiveCollection (I’ve managed to activate a primitiveCollection for a tile)…
I have a geoJson, I have a primitive collection for the tile - just can’t connect both…
Is there a way to hook a “dataSource” to a tile, so as to bind a dataSourceCollection to a tile, so it would update its primitiveCollection? (like the viewer implementation)?
I tried, but it doesn’t seem to “hook” right…
Just to make it clear, here’s an example:
http://jsfiddle.net/yonatankra/jvjfkq9t/
In this example, I’m loading the quadTree example (to which I’ve added a primitiveCollection to its data field). You can see I’ve already implemented what you’ve suggested, and it works - my problem is that now I’m “running the show”, since I have to manage the data that’s showing according to the tile’s appearance instead of the quadTree taking care of that… (as would be the case if the primitiveCollection in the tile would be filled with the data in the KML/geoJson).
There’s no official way to do this (especially since QuadTreePrimitive itself is private and undocumented and may change in the future). That being said, if you are implementing your own QuadTreePrimitive you can create your own instance of DataSourceDisplay for each tile and add your tile source to that (Or you can just add each tile DataSource to the same display.) I haven’t done it and I’m sure it will be inefficient overall, but it should work.
Why would it be inefficient?
Would using a primitive collection in every tile to cope with polygons and billboards for each tile would be better (i.e. parse the geoJson manually)?
Or would it be better to populate the main viewer dataSource (what I do in the current example) and handle the “show” attribute according to current “level of details”?
Thanks