Select to view content in your preferred language

Possible bug :WMSLayer in 4.4 version adding multiple WMSLayers to map

4948
6
07-14-2017 02:52 AM
bartlissens1
Emerging Contributor

When adding a WMS Layer on its own the layer works and the map gets loaded.

As soon as I add 2 or more WMSLayers(which work on their own added as only WMS layer) the second WMSLayer produces the following erro message : 

[] #load() Failed to load layer (title: 'undefined', id: 'undefined') TypeError: Cannot read property 'sublayers' of undefined
at WMSLayer.js:5
at Array.forEach (<anonymous>)
at r (WMSLayer.js:5)
at Object.b.readSublayers (WMSLayer.js:9)
at Object.n (init.js:472)
at Object.e.read (init.js:982)
at Object.l (init.js:225)
at init.js:1018
at Object.f.readLoadable (init.js:473)
at Object.e.read (init.js:1018)

All the WMS layers after the first layer also produce this error message. 

In attachment the index.html file i've used to reproduce the issue as wel as the proxy page + config that is used to allow the getcapabilities requests for the WMSLayers.

Using presentations/2017-devsummit/building-custom-layers at gh-pages · ycabon/presentations · GitHub  I am able to

work around the issue but I would prefer not having to use custom classes to be able to use WMSLayers in my application.

6 Replies
ThomasSolow
Frequent Contributor

Thanks for the bug report.  I've been able to reproduce this and I think I've identified the issue.  Layer ids are being assigned incorrectly when the layer XML is converted to JSON, which will affect any WMS layer added after the first.

bartlissens1
Emerging Contributor

Hi Thomas,

Thanks for the fast reply. good to hear the issue has been identified.

Can you tell me if this will be fixed as a patch to the javascript api or if this will be something that will be fixed for the next release?

kind regards,

Bart

0 Kudos
ThomasSolow
Frequent Contributor

I'm not sure how often the API is updated outside of major releases (I'm not part of the JS API team).  This seems like a pretty big deal so I would hope it won't wait until 4.5.

I can confirm that the issue has been accepted and fixed, but I don't know how long it will take for the fix to make it to the release codebase.

0 Kudos
BjornSvensson
Esri Regular Contributor

bart lissens‌ : This is planned to be fixed for JSAPI version 4.5, which is currently scheduled for end of September.

0 Kudos
bartlissens1
Emerging Contributor

Thx for the information Bjorn.

0 Kudos
NickCameron2
Regular Contributor

Hi,

I have some users that were desperate for WMS support but this bug is a bit of a deal breaker to using them right now though . So I created a simple patched class that inherits from WMSLayer to get around the bug until it's fixed. It's not super pretty but good enough for the interim. It's in typescript but moving the relevant bits into a javascript class should be super simple.

Thanks,

Nick

0 Kudos