angular-cesium
angular-cesium copied to clipboard
How to get entities from Cesium
Angular: 7.2.15 Cesium: 1.59.0 Angular-cesium: 0.0.58
In my application I am using the toolbar component to indicate a selected region on the map. Having made the selection, I want to get the points (as geojson, point array, something) to use in other parts of my application. Utilizing mapsManagerService.getMap().getCesiumViewer(), I can see cesium, but the EntityCollection is empty. I'm sure I'm missing something in what I have done, taking a lot straight from the demo app, but it boils down to... What do I need to do to create a circle/ellipse/poly that in turn ends up as part of the cesium entity collection?
Hi,
In angular cesium we use Cesium.DataSource
for each layer instead of basic EntityCollection
, so you can do viewer. dataSources
.
Any way, I am not sure what is your architecture but I would recommend using some kind of state management for storing your entities and not relaying cesium to do it.
For what I am doing, we will either using czml to drop in an existing selection or making a selection via the toolbar (circle/poly/etc), and then outputting that selection to save. I don't have a problem inserting, just getting the data out.
With that, looking at viewer.dataSources
I see an array of length 448, but I don't see where I would access the point information for something newly drawn on the map. Thanks for your guidance so far, hopefully just a little more will get me where I need to be.
one way is to go over all datasources and to see which entities are in the selection bounds.
but I would recommend saving the entities you draw on the map in some kind of management store, then to go over the entities in the store and to filter them by the selection bounds.
Hi,
I'm also having issues retrieving entities from Cesium. I would like to use the API @TheTiGuR mentioned. But as @TheTiGuR said this EntityCollection
is empty. This collection has the function getById()
I do think that having another entity administration is an option, it will result in extra usage of your resources.
Currently I'm trying to implement a tooltip mechanism. The tooltip is slaved to a entity. But entity can move or your viewport might change which results that I cannot use the MapEventsManagerService
since that requires to hover over the entity constantly. The tooltip has a timeout, when it reaches that time out the tooltip will be hidden.
This implementation is inspired by this example: sandcastle.cesium.com
How would you suggest implementing tooltips?
Best regards, Aznguy