Seeding fails with unhelpful error if no layers cover requested zoom levels
All my layers have a min_zoom of at least 2 - when I try and run tegola cache seed without the --min-zoom option, I now get the rather cryptic error:
Error: error seeding tile ({Z:1 X:1 Y:1}): ERROR: syntax error at or near ")" (SQLSTATE 42601)
Due to the following (non-)query being run:
SELECT () AS data
I just switched to mvt_postgis so perhaps this issue is specific to that provider. I wasn't having this issue with an older version of Tegola using the "classic" postgis provider.
The fix was obvious when I realised what the cause was, but I think zoom levels with no layers should be automatically skipped. It might also be worth catching len(layers) == 0 in MVTForLayers so that the invalid SQL isn't generated.
@russss again, thanks for the great report. I did some investigation and you're right, there's no check for a map that has 0 layers. I think we could add this check at potentailly 2 places: https://github.com/go-spatial/tegola/blob/8e40cafbbeca99e606589e5a156aed84452d1e71/cmd/tegola/cmd/cache/worker.go#L47
and:
https://github.com/go-spatial/tegola/blob/8e40cafbbeca99e606589e5a156aed84452d1e71/atlas/atlas.go#L105
Putting a len() check in the first location I think would address the immediate issue you're encountering, but for added durability, a check in the SeedMapTile method would be great too.
Do you want to try forming up the PR?