加载多个geojson格式的图层数据,通过tree控制图层显示与隐藏,尝试了datasource.remove()方法,返回false,有什么方法可以控制图层显示隐藏,或者直接移除该图层。
Thank you for your community forum post! Unfortunately, I am not able to read your post. It’s possible that some other community forum members can help you out here. Alternatively, if you can translate your question to English, and I can try to solve your issue
-Sam
Per Google Translate:
Load multiple geojson format layer data, control layer display and hide through tree, tried datasource.remove() method, return false, is there any way to control the layer display or hide, or remove the layer directly.
I wonder if the datasource
object has a show
property. If so, a potential solution could be setting show: false
. Moving forward, more information on datasource
would be helpful. Is datasource
an ImageryLayer?
-Sam
Make sure you are waiting for the GeoJsonDataSource’s promise to resolve which will give you the handle to be used when you call Viewer.dataSources.remove(myDataSource). You may need to subscribe to the dataSourceAdded event on DataSourceCollection.
You should be able to use myDataSource.show = false to hide the data source’s entities.
thanks