Geographic Information Systems Asked by hoge6b01 on December 11, 2020
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?
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 resultsnnLayer 'camp_sites'nFeature 2715nname =
'Aumuhle - Schweppenhausen [<51] (01/04-31/10) -CCA (210m)>00-496724602392'nn"
In Firefox and Chrome the content of info
string is iframe
tag pointing to WMS service site:
"<iframe src='http://92.222.90.244/websig/lizmap/www/index.php/lizmap/service/?repository=07&project=camping_europe&service=WMS&request=GetFeatureInfo&version=1.1.1&layers=camp_sites&styles=&format=image%2Fpng8&transparent=true&infoformat=text%2Fjavascript&width=1174&height=644&srs=EPSG%3A3857&bbox=-2842234.4597559944%2C4314717.3726416305%2C2900938.0974790095%2C7465145.930443454&query_layers=camp_sites&X=773&Y=179' style='border:none'>"
Console showed cross origin error:
Cross-Origin Request Blocked:
The Same Origin Policy disallows reading the remote resource at http://92.222.90.244/websig/lizmap/www/index.php/lizmap/service/?repository=07&project=camping_europe&service=WMS&request=GetFeatureInfo&version=1.1.1&layers=camp_sites&styles=&format=image%2Fpng8&transparent=true&infoformat=text%2Fjavascript&width=1158&height=644&srs=EPSG%3A3857&bbox=-2803098.701273984%2C4314717.3726416305%2C2861802.338996999%2C7465145.930443454&query_layers=camp_sites&X=743&Y=232.
(Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
Answered by TomazicM on December 11, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP