How to check if a layer is a basemap layer

591
3
Jump to solution
03-01-2019 05:43 AM
DanielChristensen1
New Contributor II

Hello,

I have an event as shown below. How can I check if the added layer is part of a basemap? e.g. world terrain layer, etc.

this.view.on("layerview-create", (event) => {
   // Only recreate model if it's not a basemap change
   this._createModelFromLayers();
   this.render();
})
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Theoretically you would get the views "map" and the maps "basemap" and then you have access to the Basemap objects referenceLayers and or baseLayers collection properties, to see if your layer exists in those collections.

View solution in original post

3 Replies
RobertScheitlin__GISP
MVP Emeritus

Theoretically you would get the views "map" and the maps "basemap" and then you have access to the Basemap objects referenceLayers and or baseLayers collection properties, to see if your layer exists in those collections.

DanielChristensen1
New Contributor II

This was a great suggestion thank you.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Don’t forget to mark this question as answered by clicking on the mark correct link on the reply that answered your question.

0 Kudos