Openlayers 3 - What does resolution mean as a parameter to a style function?

I am trying to use the resolution passed to the StyleFunction to determine the size of my images. Using tests, when scaling, where the scale line is 100 m, the resolution reported by the stylistic function is 2.3886.

I take screenshots of the scale line and measure its length in pixels. The 100 mm scaling line is 68 pixels or 1.4705 m per pixel.

1.4705! == 2.3886, so what is a permission block? The API documentation does not explain this and says that it is just a number, but without the idea of ​​units it is difficult to develop.

This is an exact scaling of the icon to the length of the real world BTW.

Using this jsfiddle.net/dz9gL0g0/, I found that 200 m scalping reports 2.38, but 100 m less (1.19). Is the resolution that I get from a previous scalable level? If I use the resolution passed to OR calling the getResolution function directly, the 100m scaleline always returns 2.83 for me, not 1.19, I think it should, although 1.19 * 84 is basically correct (the scale line is larger in the example than my application that gives me a line of scale of 68 pixels for 100 m).

Moving the window changes the resolution - resize the jsfiddle and change the resolution block. My 100mm scalping still matches the geographic function I use for testing, but now reports 2.38.

+4
source share
3 answers

github (https://github.com/openlayers/ol3/issues/3770) , ol.proj.Projection.getPointResolution(), (, , - , eh?).

var view = map.getView();
var coords = view.getCenter();
var resolution = view.getResolution();    
var projection = view.getProjection();
var resolutionAtCoords = projection.getPointResolution(resolution, coords);

1,50XXXX, . , , , , .

+3

- 1 . , EPSG:3857, . , 20000 /, , 1 px 20000 .

, .

+5

AFAIK resolution in meters per pixel. Here is a function from my application that has a ol.style.Circleradius style 3 / resolution:

http://i.stack.imgur.com/Vf6TB.jpg

Is your zoom line working properly? Using non-standard projection, I had to use ol.proj.addProjection(...)and ol.proj.addCoordinateTransforms(...)in addition to simply defining the projection through proj4.defs(...)to make it work.

+1
source

Source: https://habr.com/ru/post/1589142/


All Articles