Número de ID do Erro |
BUG-000163573 |
Enviado | December 8, 2023 |
Última Modificação | December 6, 2024 |
Aplica-se à | ArcGIS Maps SDK for JavaScript |
Versão encontrada | 4.28 |
Sistema Operacional | Windows OS |
Versão do Sistema Operacional | 11.0 64 bit |
Status | Known Limit
Após revisão pela equipe de desenvolvimento, foi determinado que esse problema está relacionado a uma limitação conhecida do software que está fora do controle da Esri. A seção Informações Adicionais do problema pode conter mais explicações.
|
Informações Adicionais
When assigning a value to WMSLayer.sublayers at layer initialization, it essentially overwrites the layer's sublayers discovered from the service's get capabilities response. Unless specified, all sublayer properties are set to their default values, instead of the values found in the service.
The solution is to wait for the layer to load and then 'turn off' the undesired sublayers. This ensures that all sublayer properties, like minScale and maxScale, are imported from the layer's get capabilities response.
For example:
const wmsLayer = new WMSLayer({
url: "your-url-here"
});
await wmsLayer.load();
const sublayer = wmsLayer.findSublayerByName("my-sublayer-name");
if (sublayer) { // check if sublayer exists
wmsLayer.sublayers = [sublayer]; // only show desired sublayer
}
map.add(wmsLayer);
The team plans to update the documentation to make this more clear.
Solução Provisória
Add the WMSSubLayer subsequently.
For example:
const wmsLayer = new WMSLayer({
url: "your-url-here"
});
await wmsLayer.load();
const sublayer = wmsLayer.findSublayerByName("my-sublayer-name");
if (sublayer) { // check if sublayer exists
wmsLayer.sublayers = [sublayer];
}
Etapas para Reproduzir