简体   繁体   中英

How to get the type of layer or source in OL3?

I want to know how I can get the type of a layer and a source in ol3?

Background: I have a map which the user can modify. The user can (de)activate layer from different sources and I want to extract all the settings the user has made. Like the visible layer, the center point, resolution and more to rebuild the map later.

At the moment I want to collect all the layers and it's sources, but I'm not able to get the layer type. So I don't know if it's a Tile or a Image, etc.

Unfortunately object.constructor.name is an empty string. So any other ideas?

使用instanceof例如layer instanceof ol.layer.Tile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM