VectorTileRenderer icon indicating copy to clipboard operation
VectorTileRenderer copied to clipboard

Active developed

Open BergChristian opened this issue 4 years ago • 13 comments

Hi Ali

Ran into your project and I think this is a great one and I can't see any other on the Internet doing what you do. I can see that there is some time ago it was actively developed. I am happy to contribute to the project if you are interesting in taking it active. I can see HW rendering is one thing to achieve as well as spending some time on that function to draw street names...

All the best Christian

BergChristian avatar Apr 18 '20 13:04 BergChristian

Hi, Thanks for the interest. Contributions are certainly welcome for this project. Let me know which part/feature are you interested in.

AliFlux avatar May 02 '20 08:05 AliFlux

Hi

I am interested in getting performance up. Either HW accelerated drawing using Direct2D or maybe just see if there is other things to do

BergChristian avatar May 02 '20 17:05 BergChristian

I assume, that drawing isn‘t the bottle neck. I draw all lines and polygons in 5-10 ms with GPU backend of Skia. The problem is reading the data, decoding it and than, one of the biggest part, evaluating the filter of each style layer with each feature of the data.

Another big part is the placing of symbols and text on the tile. For this you need the symbols and text of the surrounding 8 tiles (read data, decode and filter for all 8 tiles). I assume, that this costs the most time at the end.

charlenni avatar May 02 '20 19:05 charlenni

A couple of days ago, I was porting this renderer to Cesium JS library for vector tile rendering on the fly. I did some extensive tests and figured out that the biggest bottleneck is the filter.

The filter system is essentially a function evaluator. One way to speed it up would be to generate a filter code (in C#) for each layer as soon as the style is loaded. Then execute that filter code in run-time for faster performance (see this for runtime execution of C# code).

AliFlux avatar May 02 '20 22:05 AliFlux

I’m not sure, if this approach (runtime execution of C# code) runs on all platforms (.Net, iOS, Android and so on).

I made the filter system with special objects, that all implement an evaluation function (see here). I tried to optimize it. One big point was to go away from Json objects. They are flexible, but slow. Now it is acceptable fast. Perhaps it could be made faster, if some feature sorted out before filtering, because line or fill layers aren’t interested in points.

Perhaps someone has another idea to speed it up.

charlenni avatar May 03 '20 07:05 charlenni

That's some nicely organized code. I'm experimenting with web-based vector rendering, and so far the best way to go about it is to dynamically compile filters.

AliFlux avatar May 06 '20 08:05 AliFlux

Hi!

I have tried this https://openmaptiles.com/ It works nicely with your code but it is insanely fast on the web. Any idea how they make it so fast?

CBergAccount avatar May 07 '20 13:05 CBergAccount

How did you tested OpenMapTiles with this code?

charlenni avatar May 07 '20 13:05 charlenni

Hi,

You could download a trial from there web page which I used directly with your code and GMAP.Net. Worked straight out of the box.

I just the Winform example you provide.

CBergAccount avatar May 07 '20 14:05 CBergAccount

On the web, it uses WebGL and some extreme optimization techniques to render the vector tiles. Can you test your openmaptiles with the tileserver-gl in raster mode? (it uses a similar technique of rendering)

AliFlux avatar May 07 '20 14:05 AliFlux

I am sorry, I don't have the time right now to test it and since I am not familiar with Java it would take me a lot of time... If you want to try it, just download the vector tiles, just download it from their webpage.

CBergAccount avatar May 07 '20 14:05 CBergAccount

Hi. I was implementing vector tiles for web using javascript and HTML5 canvas. Turns out the biggest performance bottleneck is the filtering operations. I'll be testing it further and posting results

AliFlux avatar Sep 09 '21 09:09 AliFlux

I've updated the repo with some performance improvements. Here are a few of these:

  • Shared sqlite connection between threads
  • Marked sqlite connection as readonly
  • Deferred disk cache to a delayed event that doesnt bother rendering thread

AliFlux avatar Sep 09 '21 18:09 AliFlux