Git Product home page Git Product logo

Comments (5)

boardend avatar boardend commented on May 26, 2024

I will try that out, thanks!

The downside is that we will probably render (or at least take into consideration) more data than actually necessary to render the whole extent? In this sense, the OpenLayers canvas source will be more economical (and probably more performant). But letโ€™s see it in action and compare then.

Maybe a bit off topic here, but during testing of #8 I got aware of devicePixelContentBox (see here for a nice write up). I added this method to the pure JS implementation. The nice thing about this is, that when for example the whole page gets zoomed, it will use all the physicals pixels (so the canvas size / rendered image will actually grow), but also increase the devicePixelRatio, so that the rendered map will look the same (besides any symbols in px). OpenLayers doesn't do that, it will just stretch the canvas. So maybe it is worth investing some more time into a custom canvas renderer anyways...

from qgis-js.

andreasneumann avatar andreasneumann commented on May 26, 2024

The downside is that we will probably render (or at least take into consideration) more data than actually necessary to render the whole extent? In this sense, the OpenLayers canvas source will be more economical (and probably more performant). But letโ€™s see it in action and compare then.

Yes - I am aware of this - that it will have a performance impact - but getting proper labels, diagrams and point symbols at tile borders that aren't cut off is important. The user can decide what mode (canvas vs xyz) should be used.

The XYZ mode also has advantages when panning at the same zoom level. It can then use the cached tiles.

from qgis-js.

boardend avatar boardend commented on May 26, 2024

I've added the "Extent Buffer Factor" (as discussed yesterday) to the QgisXYZDataSourceOptions

With a value of 0.5 the labels of the "AoS - Precipitation per balance basin" demo map seem to look good.

When the next build job finishes, you can test it on the project site

Let me know what you think and what would be a good default value to add here and here

I also did some performance testing:

Test code
console.log("Start 'extentBufferFactor' test");
const doTest = async (buffer: number) => {
for (let x = 0; x < 10; x++) {
  for (let y = 0; y < 10; y++) {
    await api.renderXYZTile(16099 + x, 10959 + y, 15, 256, 1, buffer);
  }
}
};
for (let i = 0; i < 5; i += 0.25) {
const timer = "with buffer " + i.toFixed(2);
console.time(timer);
await doTest(i);
console.timeEnd(timer);
}
console.log("End 'extentBufferFactor' test");
Results Firefox
Start 'extentBufferFactor' test
with buffer 0.00: 4369.24ms - timer ended
with buffer 0.25: 4090.8ms - timer ended
with buffer 0.50: 4067.74ms - timer ended
with buffer 0.75: 4187.72ms - timer ended
with buffer 1.00: 4178.3ms - timer ended
with buffer 1.25: 4258.8ms - timer ended
with buffer 1.50: 4344.56ms - timer ended
with buffer 1.75: 4224.42ms - timer ended
with buffer 2.00: 4229.26ms - timer ended
with buffer 2.25: 4306.76ms - timer ended
with buffer 2.50: 4326.92ms - timer ended
with buffer 2.75: 4397.78ms - timer ended
with buffer 3.00: 4353.14ms - timer ended
with buffer 3.25: 4342.84ms - timer ended
with buffer 3.50: 4391.06ms - timer ended
with buffer 3.75: 4504.52ms - timer ended
with buffer 4.00: 4493.12ms - timer ended
with buffer 4.25: 4386.26ms - timer ended
with buffer 4.50: 4535.62ms - timer ended
with buffer 4.75: 4333.3ms - timer ended
End 'extentBufferFactor' test
Results Chrome
Start 'extentBufferFactor' test
with buffer 0.00: 5465.216796875 ms
with buffer 0.25: 5771.030029296875 ms
with buffer 0.50: 5685.670166015625 ms
with buffer 0.75: 5565.19091796875 ms
with buffer 1.00: 5318.02294921875 ms
with buffer 1.25: 5480.2861328125 ms
with buffer 1.50: 5370.35693359375 ms
with buffer 1.75: 5334.903076171875 ms
with buffer 2.00: 5177.893798828125 ms
with buffer 2.25: 5221.556884765625 ms
with buffer 2.50: 5656.748046875 ms
with buffer 2.75: 5537.4580078125 ms
with buffer 3.00: 5761.090087890625 ms
with buffer 3.25: 5696.218017578125 ms
with buffer 3.50: 5590.222900390625 ms
with buffer 3.75: 5731.06689453125 ms
with buffer 4.00: 5599.095947265625 ms
with buffer 4.25: 5574.143798828125 ms
with buffer 4.50: 5230.76220703125 ms
with buffer 4.75: 5712.307373046875 ms
End 'extentBufferFactor' test

๐Ÿค”

So the factor has either a negligible effect, the implementation (or test) is broken, or QGIS will cache the data in a way, that it makes no sense to re-render the same tiles for a measurement like this..?

from qgis-js.

andreasneumann avatar andreasneumann commented on May 26, 2024

Thank you @boardend for adding the "extent buffer factor"

I don't know why the test results are so unexpected.

I think 0.5 would be a good default value.

from qgis-js.

andreasneumann avatar andreasneumann commented on May 26, 2024

@boardend - I think we can close this issue. The solution provided works fine for me!

from qgis-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.