t-rex-tileserver / t-rex

t-rex is a vector tile server specialized on publishing MVT tiles from your own data
https://t-rex.tileserver.ch/
MIT License
557 stars 69 forks source link

T-Rex version for higher zoom levels (up to 42)? #316

Open damiendevienne opened 7 months ago

damiendevienne commented 7 months ago

Hello,

First, thanks for the great tool. For updating our visualization tool from raster tiles to vector tiles (with T-rex), we need to be able to go to zoom levels up to 42. This implies quite a lot of changes in the code, including some variables that must be changed from u32 to u64, which does not go smoothly until now. Before going further, we wondered whether such a "deepzoom" versions of T-Rex had been (by chance) developed already? If not, would it be a useful feature for next versions of T-Rex?

All the best,

pka commented 7 months ago

Hi Damien, Please have a look at https://github.com/bbox-services/bbox/tree/main/bbox-tile-server the successor of T-Rex. BBOX uses Xyz of https://github.com/pka/tile-grid/blob/main/src/tile.rs#L44 which is already using u64 for x/y. So maybe your use case is already covered?

damiendevienne commented 7 months ago

Oh great, we'll give it a look. Thanks!

simonpenel commented 7 months ago

Hi, thanks a lot for your help! I planned to use bbox with the previous t-rex configuration file. I am using a user defined grid:

 [grid.user]
width = 256
height = 256
extent = { minx = -20037508.3427892480, miny = -20037508.3427892480, maxx = 20037508.3427892480, maxy = 20037508.3427892480 }
srid = 3857
units = "m"

However I got

Error during initialization: 3857.json: No such file or directory (os error 2)

I was wondering what should be the contents of the 3857.json file?

If I remove the line srid = 3857 the following error is returned

Error during initialization: bbox-tile-server/config_lifemap.bbox - missing field `srid`
in `grid.user`

Best, thanks again

Simon

pka commented 7 months ago

Hi Simon,

I've added a guide for creating OGC conformant custom grid spec files and referenced it in the t-rex migration guide.

For your case here's the output of morecantile custom --epsg 3857 --extent -20037508.3427892480 -20037508.3427892480 20037508.3427892480 20037508.3427892480 --name "CustomWebMercator" --title "Web Mercator with custom extent" | jq . >CustomWebMercator.json

CustomWebMercator.json

Use this instead of 3857.json and reference it with tms="CustomWebMercator".

simonpenel commented 7 months ago

Thanks for your help Pirmin,

sorry I didn't understand which value should take the "srid" parameter then?

I though I should use CustomWebMercator instead 3857

[[datasource]]
dbconn = "postgresql://lm:gvC5b78Ch9nDePjF@localhost/tree"
name = "dbconn"
default = true

#[grid]
#predefined = "web_mercator"

[grid.user]
width = 256
height = 256
extent = { minx = -20037508.3427892480, miny = -20037508.3427892480, maxx = 20037508.3427892480, maxy = 20037508.3427892480 }
#srid = 3857
srid = "CustomWebMercator"
tms = "CustomWebMercator"
units = "m"
...

but I got

Error during initialization: bbox-tile-server/config_lifemap.bbox - invalid type: string "CustomWebMercator", expected i32
in `grid.user.srid`

PS I copied the CustomWebMercator.json in the assets directory, this is correct?

Sorry again to bother you Best, Simon

simonpenel commented 7 months ago

OK, I get it I use

[grid]
json = "../assets/CustomWebMercator.json"
tms = "CustomWebMercator"

thanks again Simon

pka commented 7 months ago

In BBOX, the tms name is part of the tileset configuration, so you can have tilesets with differenct tile grids:

[[grid]]
json = "../assets/CustomWebMercator.json"
[[tileset]]
name = "my tileset"
tms = "CustomWebMercator"

This is not directly translatable from a t-rex configuration file. You have to create a bbox configuration file from the converted t-rex configuraton output and apply the changes above.

pka commented 7 months ago

Since you're mentioning zoom level 42, here's the command for creating a grid with max level 42:

morecantile custom --epsg 3857 --maxzoom 42 --extent -20037508.3427892480 -20037508.3427892480 20037508.3427892480 20037508.3427892480 --name "CustomWebMercator" --title "Web Mercator with custom extent" | jq . >CustomWebMercator.json

CustomWebMercator.json

damiendevienne commented 7 months ago

Hi Pirmin,
First, thanks a lot for your help. And sorry for this long message. We tried with @simonpenel to prepare a small example showing the bug we are facing when zooming in the map, and for which we are struggling finding a solution. If it is obvious for you what happens an how to solve it, it would be great !

The symptom : if you zoom in the simple map (only black) we prepared at this url: http://134.214.213.45/assets/html/index_test42.html, you will see that starting from zoom 27, some tiles do not display correctly, creating some kind of irregular checkerboard image

The reproducible example: To make the problem very simple and easily reproducible we decided that the map only displays one tile (always the same, named 1.pbf). The server configuration file was this one this one :

[[datasource]]
#will not be used 
name = "gebco"
[datasource.wms_proxy]
baseurl = "https://www.gebco.net/data_and_products/gebco_web_services/web_map_service/mapserv?version=1.3.0"
format = "image/jpeg"

[[assets.static]]
dir = "./assets"
path = "/assets"

[[tilestore]]
name = "tilecache"    
[tilestore.files]
#base_dir = "../tiles"
base_dir = "/tmp/mvtbench"

[[tilestore]]
name = "mbtilecache"
[tilestore.mbtiles]
path = "/tmp/tilecache.mbtiles"

[[tilestore]]
name = "pmtilecache"
[tilestore.pmtiles]
path = "/tmp/tilecache.pmtiles"

[[tileset]]
name = "gebco"
wms_proxy = { source = "gebco", layers = "gebco_latest" }

and the configuration json files used are available here: mystyle_test42.json lines_test42.json

Do you have any idea where the problem could come from?

All the best, and thanks again for your time,

Damien

pka commented 7 months ago

Back from holidays. Will try to reproduce this problem with bbox test data and the custom Mercator TMS.

Could you open an issue in the bbox Repo?