1

Is there any built-in way of limiting the request width/height of ImageWMS sources and have the map just scale the image up to fill the extent? I'm building an application that includes a bunch of WMS providers that don't support resolutions higher than 2048.

3
  • it depends on the client application you are using - but try using tiles to avoid these issues.
    – Ian Turton
    Mar 17, 2017 at 8:40
  • You want to reduce or increase this value? There is a limit to all the wms max tile size. For e.g. MS4W supports max 2048 pixels tile size. Which WMS server you are using? Mar 18, 2017 at 18:33
  • I want (if possible), for ex. if OpenLayers tries to request a 3000x1000 image, request a 2048x1000 image instead and stretch it. Maybe I could draw it into a canvas first and then set the Image src. I think our end-client would rather have a blurry image than loading the map with tiles (which would be the best solution, I know.) I could also create a tile grid with 2048px sized tiles, but I'd have to recreate it every time the projection changes.
    – Thiatt
    Mar 19, 2017 at 1:52

1 Answer 1

1

Solution 1 - Stretch

  1. Custom loader
  2. If the image is larger than 2048px, store originalWidth and originalHeight and request image with min(2048, original[Width|Height]).
  3. Draw requested image into a canvas with size (originalWidth, originalHeight)
  4. Set canvas data as src for Image

Solution 2 - Tile

  1. Use TileWMS with a tile grid of 2048px sized tiles
  2. Recreate source and tile grid everytime projection changes

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.