Example of checking layer validity before adding to map

1659
2
Jump to solution
12-18-2015 10:23 AM
TracySchloss
Frequent Contributor

I'm having problems with a map that has many layers.  I'm getting one of those obscure errors that doesn't help you one bit.  I believe there is an issue with one of my layers, but I've combed through the rest end point and my layer constructors and everything looks OK. 

I know I've seen this before - someone posted a chuck of code that would check that the layer was valid before adding, so it was easier to troubleshoot which layer has the problem.  It gave you some feedback in the console that told you if there was a problem or not.

Keywords like map, layer, add are all so generic that searching on these words doesn't help.  Does anyone remember writing or seeing this code so I could incorporate it into my project?

1 Solution

Accepted Solutions
KenBuja
MVP Honored Contributor
2 Replies
KenBuja
MVP Honored Contributor
TracySchloss
Frequent Contributor

Those are the ones!

The first one gave me the error, but didn't tell me which layer is was from (and I have 11 layers!).  The 2nd one told me both the error and the layer it came from.

0 Kudos