go-spatial / tegola

Tegola is a Mapbox Vector Tile server written in Go
http://tegola.io/
MIT License
1.25k stars 193 forks source link

Issues with seeding tiles and extents #884

Open Medit8r opened 1 year ago

Medit8r commented 1 year ago

I am not a Go programmer, so pardon if I miss some subtlety in understanding the code. I'd wanted to seed a set of tiles over a region of southwest, Western Australia using a geopackage as the provider. The config was quite simple and appears here:

Config for layer by sql.txt

Note that I've included the srs for web mercator (3857). The documentation indicates that if the srid is not included, that will be the default, but experimentation indicates that that is not the case.

Here is the request: tegola cache seed --config config.toml --bounds "12733838, -4187929, 13634226, -3186027" --log-level "DEBUG" --overwrite true --max-zoom 16 --min-zoom 16

The results are the same whether bounds are given (in 4326, or 3857, or not given at all:

Errors for config for layer by sql.txt

See how the sql is being expanded as if the srs were 4326, and it uses default bounds? When I look at the code, in gpkg_register.go, and review the NewTileProvider function, I can see this at line 363:

CodeDoesTheWrongThing.txt

See the comment in the TODO? The srid setting is set to 3857, so the bounds in the layer should be used. Instead they are set to the defaults for 4326. I tested the sql and it returns the results correctly using the bounds retrieved from the layer in 3857:

image

image

If I go the other route, not using custom sql but using the table name instead, the correct bounds are reported, but the processing appears to ignore the bounds, and instead generates tiles for the whole world:

image

as I said, this is the first time I've seen Go code so pardon if I've miss understood. I just want to seed the tiles for a given zoom layer using 3857 as the srs, with bounds given in 3857.

Any help greatly appreciated, Tom