Following this example and according to Leaflet WMS documentation I extended L.WMS.Source class and overwrote hooks (e.g. showFeatureInfo).

My example can be found here.

When I use the code as given in the example above

name = info.split(/'/)[3];
info = "Name: " + name;

the popup displays

Name: border:none

which seems to be a part of HTML inside my popup window.

What do I have to do to only get the name of the feature displayed?

  • 1
    border:none is rather CSS than HTML. – Stefan Sep 16 '18 at 4:52

Here are my findings, I'm not sure if they can be considered as answer. I copied the example to my local server and tried and debugged it in three different browsers: IE11, Firefox and Chrome.

In IE example actually worked! This is one of the popups I got:

Aumuhle - Schweppenhausen [<51] (01/04-31/10) -CCA (210m) >00-496724602392

Debuggger showed that content of info string is reply from WMS service:

"GetFeatureInfo results\n\nLayer 'camp_sites'\nFeature 2715\nname =
'Aumuhle - Schweppenhausen [<51] (01/04-31/10) -CCA (210m)>00-496724602392'\n\n"

In Firefox and Chrome the content of info string is iframe tag pointing to WMS service site:

"<iframe src='' style='border:none'>"

Console showed cross origin error:

Cross-Origin Request Blocked:
The Same Origin Policy disallows reading the remote resource at
(Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.