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.
Answer
Solution 1 - Stretch
- Custom loader
- If the image is larger than 2048px, store
originalWidth
andoriginalHeight
and request image withmin(2048, original[Width|Height])
. - Draw requested image into a canvas with size
(originalWidth, originalHeight)
- Set canvas data as src for
Image
Solution 2 - Tile
- Use TileWMS with a tile grid of 2048px sized tiles
- Recreate source and tile grid everytime projection changes
No comments:
Post a Comment