0

I am adding a Point-WMS-TileLayer to a Leaflet-Map. In addition I am using Leaflet-WMS plugin to get a onClick a Map-PopUp with the specific GetFeatureInfo for the clicked Point. If the Sites load and I click some Points everything works well. But at some Point the Request-URL gets some weird X-Y-Values, although I am clicking the same Spot and don't even zoom-In or out in the Map. After this the GeoServer, where the WMS is running on, brings the error: "X and Y incorrectly specified".

Here the correct Request-URL: http://localhost:8080/geoserver/ows?SERVICE=WMS&&request=GetFeatureInfo&service=WMS&version=1.1.1&layers=adressen_ngbl_badd&query_layers=adressen_ngbl_badd&info_format=application%2Fjson&feature_count=1&height=1005&width=1620&srs=EPSG%3A3857&bbox=1136864.3437032222%2C6817256.124069765%2C1137106.1952380307%2C6817406.161595986&x=306&y=542

and here the wrong-one just a click after the first one: http://localhost:8080/geoserver/ows?SERVICE=WMS&&request=GetFeatureInfo&service=WMS&version=1.1.1&layers=adressen_ngbl_badd&query_layers=adressen_ngbl_badd&info_format=application%2Fjson&feature_count=1&height=1005&width=1620&srs=EPSG%3A3857&bbox=1136814.15688211%2C6817195.19749854%2C1137297.859951727%2C6817495.27255099&x=336.08380039165377&y=584.9470353149735

Does something experienced the same issue and knows some fix for my problem?

2
  • 3
    By the WMS standard the x and y (or i and j in WMS 1.3.0) must be integers so the issue must be fixed on the client side.
    – user30184
    Nov 11, 2023 at 19:23
  • @TomazicM : I am using this Code to create the Request onClick: codefile.io/f/9zJvGpA37x
    – jules2703
    Nov 12, 2023 at 10:23

1 Answer 1

1

I edited Leaflet-WMS plugin code. I changed the request parameter URL from

requestParamaters[version >= 1.3 ? 'i' : 'x'] = point.x;
requestParamaters[version >= 1.3 ? 'j' : 'y'] = point.y;

to:

requestParamaters[version >= 1.3 ? 'i' : 'x'] = Math.floor(point.x);
requestParamaters[version >= 1.3 ? 'j' : 'y'] = Math.floor(point.y);

This fixed these weird x- and y-values and gives at every click the correct response from the GeoServer.

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