ign-argentina / argenmap

Visor de mapas web basado en Leaflet
https://ign-argentina.github.io/argenmap/
GNU General Public License v3.0
37 stars 24 forks source link

WMS layers aren't showing in menu as capabilities XML parsing fails #232

Closed Zalitoar closed 1 year ago

Zalitoar commented 1 year ago

Problem detected: Layers can't be added to menu as the capabilities XML parsing fails. XML is treated as text, and at some point it is encoded changing the expected XML syntax in other characters not supported by the actual basic text search for layers parameters.

Possible solution: Refactor WMS parsing function using DOMParser to handle the XML response instead converting it to text. This would avoid the automatic 'URI encoding' of text.

GSC996 commented 1 year ago

To fix it, the code that was using jQuery has been entirely replaced with pure JavaScript. Requests (fetch) will now be made to the service's host, and the resulting XML will be parsed using DOMParser. Additionally, code has been added to identify and handle errors in the service's responses, providing information about the specific layer of the service where the error occurred.