ol-mapbox-style icon indicating copy to clipboard operation
ol-mapbox-style copied to clipboard

difference projection,difference render

Open mclkyo opened this issue 2 years ago • 3 comments

when is use projection 3857,style render correct but i use projection 4326,style render is difference

map project is 3857,style render correct image

4326 style, the line style is uncorrect,and the vector data position is wrong image

mclkyo avatar Aug 08 '22 12:08 mclkyo

If you use a projection other than EPSG:3857, you have to pass a resolutions property to applyStyle()'s options, e.g.

const maxResolution = 360 / 512; // for EPSG:4326 (degrees)
const resolutions = [];
for (let i = 0; i < 23; ++i) {
  resolutions.push(maxResolution / Math.pow(2, i));
}

applyStyle(myLayer, myStyle, 'mySource', { resolutions });

ahocevar avatar Aug 08 '22 12:08 ahocevar

image the style is render correct,but i add a vector data to map, the vector position show is wrong

image this is my code

mclkyo avatar Aug 09 '22 01:08 mclkyo

Then the tilegrid does not match the tile layout of the service you are using. Consult the service provider for the correct tile layout, and define your TileGrid accordingly.

ahocevar avatar Aug 10 '22 20:08 ahocevar