WMS Image Size – How to Calculate Final Image Size from WMS?

owslibresolutionwms

I would like to retrieve an image from a WMS server (see the link below) with python OWSLib (or any other methods).

I know that resolution is 1m per pixel.

For example, I want to get bbox=(54.2652, 18.5889, 54.4189, 18.7866) (epsg 4326).

How can I calculate image size in pixel?

http://mapy.geoportal.gov.pl:80/wss/service/img/guest/ORTO/MapServer/WMSServer

Best Answer

EPSG:4326 does not convert nicely into meters, but you can calculate the lengths of latitude and longitude degrees for example with http://www.csgnetwork.com/degreelenllavcalc.html

At 54°N the length of latitude is 111304.96 m and length of longitude is 65575.75 m.

Your BBOX is 0.1537 degrees high and 0.1977 degrees wide.

HEIGHT = 0.1537 / (1/111304.96) = 17107.57235
WIDTH = 0.1977 / (1/65575.75) = 12964.32578

However, if you really want to have resolution in meters, use some projected coordinate system instead of EPSG:4326. For example UTM zone 35N should be good for Poland http://epsg.io/32635.