go-spatial / tegola

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

Geopackage-provided tiles are malformed in v20 #999

Open Monstrofil opened 4 days ago

Monstrofil commented 4 days ago

I have this minimal config:

tile_buffer = 64

[webserver]
port = ":9090"

[[providers]]
name = "sample_gpkg"
type = "gpkg"
filepath = "bp.gpgk"
srid = 4326

[[providers.layers]]
name = "landuse1"
tablename = "bp"
geometry_fieldname = "geometry"
id_fieldname = "fid"

[[maps]]
name = "landuse_new"

[[maps.layers]]
provider_layer = "sample_gpkg.landuse1"
dont_simplify = true
min_zoom = 3
max_zoom = 15

When running with gospatial/tegola:v0.20.0, I get this: image

When i switch to gospatial/tegola:v0.19.0, geometry becomes normal: image

I believe there is a bug in v20.

iwpnd commented 4 days ago

Can you share the file please?

Monstrofil commented 4 days ago

Sure. demo.zip

ps. change the table name to functional_zones_table.

iwpnd commented 4 days ago

I can confirm the issue in v0.20.0 and everything working in v0.19.0. Also took a look at the data and couldn't find anything wrong with it either. I was able to verify that the gpkg provider correctly gets the feature from the gpkg and creates a valid polygon. I'm not sure why, but the issues appears to occur during encoding to mvt.

ARolek commented 4 days ago

I have a feeling this has to do with this PR https://github.com/go-spatial/tegola/pull/952.

@gdey can you give us some guidance on what our best path forward here is? It seems to me that upgrading the geom package has caused a regression in rendering. I think the geom package version was bumped to bring in a fix for the slippy package to get tests to pass on Apple Silicon. This was discussed in https://github.com/go-spatial/tegola/issues/951

gdey commented 4 days ago

I need to look into this, and the other one listed here. I'll take a look tomorrow. See what I can find, but it does look like an issue with geom.

iwpnd commented 4 days ago

Just for a sanity check. The mvt_postgis provider is not affected.

ARolek commented 4 days ago

Just for a sanity check. The mvt_postgis provider is not affected.

Correct. The mvt_postgis provider does all geoprocessing in PostGIS. The Geopackage provider does the geoprocessing in tegola, which is why this is showing up only in the geopackage provider.

iwpnd commented 4 days ago

which is why this is showing up only in the geopackage provider.

just tested the legacy postgis provider. Same issue there for geometry_type=polygon but fine for geometry_type=linestring. 👀

ARolek commented 4 days ago

@iwpnd indeed, the same issue would show up for the legacy postgis provider. The geom package's line handling is fine, but the polygon handling is where the issues stem from.

gdey commented 3 days ago

Yeah, this looks like an old regression I had with makevalid. Where it would drop certain points due to floating point precision errors.