heigeo / leaflet.wms

A Leaflet plugin for working with Web Map services, providing: single-tile/untiled/nontiled layers, shared WMS sources, and GetFeatureInfo-powered identify.
http://heigeo.github.io/leaflet.wms/
MIT License
242 stars 135 forks source link

How can i pass external wms url and layer name dynamically #31

Closed Manjulajntuk closed 8 years ago

Manjulajntuk commented 8 years ago

1 In this link tools tab will navigate to the add layer then wms layer opetion will come in that user supposed to add url . In this how the url is being processed can you explain to me . From form user will pass url and layer name i want the code of being processed how the layer is adding to base map and how they are swiping on it can you expalin with reference code Thanks

sheppard commented 8 years ago

Hi, this looks like an OpenLayers map, so it isn't a direct example of how you would do this with Leaflet. But I would guess they did something like this:

  1. Create a simple HTML form with two fields (URL and name)
  2. Attach a JavaScript event handler that stops the form's default submit behavior
  3. Within the event handler, read the values from the two fields into variables
  4. Create a new layer with those values and add it to the map

Steps 2 and 3 should be easy to do with jQuery or a similar library, or just plain JavaScript. Step 4 is the only part that directly involves Leaflet or leaflet.wms.