go-spatial / tegola

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

Tiles not loading at specific zoom levels #883

Closed AISuhasDattatreya closed 2 years ago

AISuhasDattatreya commented 2 years ago

I'm loading a polygon dataset and at a zoom level, a few sections of the map do not get loaded. I've observed that it is specifically from the same section of the map. However, when I zoom into that area, the tiles continue to load

Screenshot 2022-09-04 at 4 16 23 PM

Zoomed out

Screenshot 2022-09-04 at 4 17 12 PM

zoomed in area

I'm using s3 to cache the tiles and I've tried to delete the cache but the same problem persists. I've removed the min and the max zoom level properties

config.toml


[webserver]
port = ":8080"

# register data providers
[[providers]]
name = "tegolamap"           # provider name is referenced from map layers
type = "postgis"        # the type of data provider. currently only supports postgis
host = ""      # postgis database host
port = 5432             # postgis database port
database = "postgres"       # postgis database name
user = ""         # postgis database user
password = ""           # postgis database password
srid = 4326             # The default srid for this provider. If not provided it will be WebMercator (3857)

[cache]
type = "s3"
bucket = ""
region = "eu-west-2"
aws_access_key_id = ""
aws_secret_access_key = ""

[[providers.layers]]

  [[providers.layers]]
  name = "test"
  id_fieldname = "ogc_fid"
  geometry_fieldname = "geometry"
  sql = 'SELECT ST_AsBinary(geometry) AS geometry, "Postcode", ogc_fid FROM test WHERE geometry && !BBOX!'

[[maps]]
name = "tegolamap"
center = [7.0982, 50.7374, 11.0]

  [[maps.layers]]
  provider_layer = "tegolamap.test"

I've deployed this on AWS lambda. I see no errors on cloudwatch but some errors were captured on network

Screenshot 2022-09-04 at 4 26 13 PM
ARolek commented 2 years ago

Have you checked your logs for an SQL error? If the same tile is having issues, even after a full cache purge, I suspect the issue is at fetching the data.

AISuhasDattatreya commented 2 years ago

No SQL errors on cloudwatch either..

ARolek commented 2 years ago

Try turning on the SQL debug mode and then executing a curl command to fetch the single tile that's causing you issues. You can then take the query to your database and investigate if there's some deeper issue happening. Here's how to toggle on debugging:

https://tegola.io/documentation/debugging/

ARolek commented 2 years ago

On your error log it shows a 502 response code. That's likely a timeout error. Please look into using mvt_postgis data provider rather than postgis.

https://tegola.io/documentation/configuration/#providers

ARolek commented 2 years ago

@AISuhasDattatreya Give this config a test. This uses the mvt_postgis provider:

Note: I removed the srid=4326 config value. Is your data in 4326? If so we will need to modify this config a bit

[webserver]
port = ":8080"

# register data providers
[[providers]]
type = "mvt_postgis"    # the type of data provider.
name = "tegolamap"      # provider name is referenced from map layers
host = ""               # postgis database host
port = 5432             # postgis database port
database = "postgres"   # postgis database name
user = ""               # postgis database user
password = ""           # postgis database password

[cache]
type = "s3"
bucket = ""
region = "eu-west-2"
aws_access_key_id = ""
aws_secret_access_key = ""

[[providers.layers]] 

  [[providers.layers]]
  name = "test"
  id_fieldname = "ogc_fid"
  geometry_fieldname = "geometry"
  sql = 'SELECT ST_AsMVTGeom(geometry,!BBOX!) AS geometry, "Postcode", ogc_fid FROM test WHERE geometry && !BBOX!'

[[maps]]
name = "tegolamap"
center = [7.0982, 50.7374, 11.0]

  [[maps.layers]]
  provider_layer = "tegolamap.test"
AISuhasDattatreya commented 2 years ago

Thanks for the config, yes the data is in 4326.

AISuhasDattatreya commented 2 years ago

Using mvt_postgis just made the load a lot more faster. Thanks @ARolek . Also fixed the issue with patchy loading

ARolek commented 2 years ago

@AISuhasDattatreya were you able to get 4326 data rendering correctly?