2

I have a very long GET request to the MapServer due to a large number of objects in a dynamic variable "object_id". (object_id=1,2,3,4,5,6,7,.........)

My query string is: "https://wms-server.local/wms?map.layer[polygon].class[0].style[0]=OUTLINECOLOR+200+64+150+WIDTH+4&object_id=9&service=WMS&request=GetMap&layers=polygon&styles=&format=image%2Fpng&transparent=true&version=1.1.1&width=256&height=256&srs=EPSG%3A3857&bbox=-20037508.342789244,0,-10018754.171394622,10018754.171394628"

MapServer returns an error 414 (GET request limit)

How do correctly XML file from my GET request to get tiles (DRAWING)

P.S. Maybe there is a more correct solution for an unknown number of objects? (I need get tiles to Leaflet)

1 Answer 1

1

You can turn this into a POST request and pass in your parameters as key=value pairs.

Create a string SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT= and then make a POST request. You'll also need to set the Content-type header in the request to application/x-www-form-urlencoded

JavaScript example:

const url = "https://wms-server.local/wms";
const postData = "SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=your_layers&WIDTH=800&HEIGHT=600&FORMAT=image/png&CRS=EPSG:4326&BBOX=0,0,10,10";

fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/x-www-form-urlencoded"
  },
  body: postData
});

There is a Leaflet example at the end of https://github.com/Leaflet/Leaflet/issues/5549

See also Make POST request for WMS in Leaflet for big values of cql_filter and

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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