In OpenLayers v5, if I have a view defined like this:
var view = new View({
center: [952014.59, 5571269.68],
zoom: 8
});
, trying to get its resolution doing view.getResolution() outputs 611.49622628141.
How should I interpret this number?
Here is my problem: I am trying to figure out if the resolution of the view is greater/smaller than that found parsing the MaxScaleDenominator and MinScaleDenominator of this WMS. They are 500000 and 0 respectively for each layer.
However, the numbers from OL and the WMS seem to be in different units, and frankly I understand the ones coming from the WMS but not those coming from OL.
Can anybody help me understanding how should I handle this, in order to make these numbers comparable?
EDIT1
The main problem is that view.getResolution() seems to output values which are always the same regardless of the latitude.
Consider my output: 611.49622628141.
If you look at the equation presented at this link, the pixel scale (Spx) can be obtained by:
Spx = C * cos(latitude) / 2 ^ (zoomlevel + 8)
, where C is the equatorial circumference of the Earth (equal to 40075016.686 m). My zoomlevel is 8 and the latitude assumed by OL seems always 0 (equator). Indeed, if you do the calculations, you'll obtain eaxctly 611.49622628141.
So I guess that I should not trust the output from view.getResolution() to make my comparison, am I wrong? If I am not, this would be a good reason not to close this question, as it has very much to do with this specific method.
EDIT2
By the way, as far as I understand, following the answer in the duplicated question linked (making adjustment as per last comment (cm to m missing conversion), I am finally able to calculate the scale I needed from the view.getResolution() output, but the doubts I had (see EDIT1) still remain unsoved.
My calculation led me to:
map scale =
pixel resolution (as per view.getResolution()) / screen distance per pixel (in meters) =
611,49622628141 / 0,00028 =
2183915
, so approximately 1:2 millions.
My doubt if .getResolution() output is accurate for any projection/latitude/(map size?) still is there...