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

pls example by use parameters in sql for filter sql #924

Open Hosseinpour6572 opened 1 year ago

Hosseinpour6572 commented 1 year ago

sql = "SELECT \"Id\" as osm_id,\"Name\", ST_asmvtgeom(\"Geom\",!BBOX!) AS geom FROM \"Provinces\" where \"Geom\" && !BBOX! !PARAMS!" .........

name = "province" provider_layer = "my_postgis.province"
min_zoom = 2
max_zoom = 18
[[maps.params]] name = "\"CodeSabti\"" token = "!PARAM!" type = "int" sql = " AND \"CodeSabti\" = 23 " default_value = "23"


ERROR: syntax error at or near "LIMIT" (SQLSTATE 42601)

ARolek commented 1 year ago

@Hosseinpour6572 can you set the geometry_type on your provider config? What's happening is that PostGIS is trying to form up SQL to inspect the database and get the geometry type and it's failing. If you set the geometry_type this step will be skipped. This is a common problem and should probably be added to a "Troubleshooting" section of the dataprovider: https://github.com/go-spatial/tegola/tree/master/mvtprovider/postgis