[GIS] In leaflet does the addControl automatically handle events via the leaflet API

guijavascriptleafletoverlay

I need to add additional overlay layers to be controlled by the controls within the leaflet map boundaries, but the code utilizes a leaflet-custom.js file. I am assuming it handles the event and triggers creating DOM elements for the overlay but I cannot verify as the custom file is a minified file so I don't know what configurations were made.

When I add my wms tile layers to the controls the wms tile layers do not display as a result of 403 errors with the Forbidden message, the urls are all modified, and the type changes from images/pngs/jpegs to text/html.

Therefore is there any way to programmatically add geolocation with with the events?

Best Answer

Your two problems seem like they might be unrelated. A 403 response is usually a permissions problem. Either the web server process doesn't have permissions access the resource, or the you are not providing the correct credentials upon request. Can you give details about your WMS server?

The addControl() method simply extends the L.Control class which only inherits a few positional methods and attributes. The rest is really up to you. You have to provide the controls, both graphically and programmatically, and script the listeners. Any event resulting from a user action needs to be handles by you whether that is calling a new layer or simply navigating to a new page.

The L.Control.Layer class provides a basic, but full handling of events. You simply need to give it an dictionary object with the layers that you want to present user controls and it will handle providing the controls and listening for user actions. Layer Example/Tutorial

I have noticed you can been struggling with this custom module for a while? Do you know why it was custom built? What are your goals? Could it not be easier to just start from scratch than fighting with a 'black-box' for hours?

Any any case if you think you need to use this custom module see this question about possible getting the module in human-readable format. https://stackoverflow.com/questions/822119/online-tool-to-unminify-decompress-javascript