You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mvtprovider/postgis/README.md
+55-50Lines changed: 55 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,48 @@
1
1
# PostGIS MVT Provider
2
2
3
-
The PostGIS MVT provider manages querying for tile requests against a Postgres database (version 12+) with the [PostGIS](http://postgis.net/)(version 3.0+) extension installed and leverages [ST_AsMVT](https://postgis.net/docs/ST_AsMVT.html) to handle the MVT encoding at the database.
3
+
The PostGIS MVT provider manages querying for tile requests against a Postgres database (version 12+) with the [PostGIS](http://postgis.net/)(version 3.0+) extension installed and leverages [ST_AsMVT](https://postgis.net/docs/ST_AsMVT.html) to handle the MVT encoding at the database.
4
4
5
5
The connection between tegola and PostGIS is configured in a `tegola.toml` file. An example minimum connection config:
6
6
7
-
8
7
```toml
9
8
[[providers]]
10
9
name = "test_postgis"# provider name is referenced from map layers (required)
11
10
type = "mvt_postgis"# the type of data provider must be "mvt_postgis" for this data provider (required)
-`pool_min_conns`: [Optional] The min connections to maintain in the connection pool. Defaults to 100. 0 means no max.
41
+
-`pool_max_conns`: [Optional] The max connections to maintain in the connection pool. Defaults to 100. 0 means no max.
42
+
-`pool_max_conn_idle_time`: [Optional] The maximum time an idle connection is kept alive. Defaults to "30m".
43
+
-`pool_max_connection_lifetime`[Optional] The maximum time a connection lives before it is terminated and recreated. Defaults to "1h".
44
+
-`pool_max_conn_lifetime_jitter`[Optional] Duration after `max_conn_lifetime` to randomly decide to close a connection.
45
+
-`pool_health_check_period`[Optional] Is the duration between checks of the health of idle connections. Defaults to 1m
30
46
31
47
## Provider Layers
32
48
@@ -37,41 +53,37 @@ In addition to the connection configuration above, Provider Layers need to be co
37
53
name = "landuse"
38
54
# MVT data provider must use SQL statements
39
55
# this table uses "geom" for the geometry_fieldname and "gid" for the id_fieldname so they don't need to be configured
40
-
# Wrapping the geom with ST_AsMVTGeom is required.
56
+
# Wrapping the geom with ST_AsMVTGeom is required.
41
57
sql = "SELECT ST_AsMVTGeom(geom,!BBOX!) AS geom, gid FROM gis.landuse WHERE geom && !BBOX!"
42
58
```
43
59
44
60
### Provider Layers Properties
45
61
46
-
-`name` (string): [Required] the name of the layer. This is used to reference this layer from map layers.
47
-
-`geometry_fieldname` (string): [Optional] the name of the filed which contains the geometry for the feature. defaults to `geom`.
48
-
-`id_fieldname` (string): [Optional] the name of the feature id field. defaults to `gid`.
49
-
-`geometry_type` (string): [Optional] the layer geometry type. If not set, the table will be inspected at startup to try and infer the gemetry type. Valid values are: `Point`, `LineString`, `Polygon`, `MultiPoint`, `MultiLineString`, `MultiPolygon`, `GeometryCollection`.
50
-
-`srid` (int): [Optional] the SRID of the layer. Supports `3857` (WebMercator) or `4326` (WGS84).
51
-
-`sql` (string): [Required] custom SQL to use use. Supports the following tokens:
52
-
-`!BBOX!` - [Required] will be replaced with the bounding box of the tile before the query is sent to the database. `!bbox!` and`!BOX!` are supported as well for compatibilitiy with queries from Mapnik and MapServer styles.
53
-
-`!X!` - [Optional] will replaced with the "X" value of the requested tile.
54
-
-`!Y!` - [Optional] will replaced with the "Y" value of the requested tile.
55
-
-`!Z!` - [Optional] will replaced with the "Z" value of the requested tile.
56
-
-`!ZOOM!` - [Optional] will be replaced with the "Z" (zoom) value of the requested tile.
-`!PIXEL_WIDTH!` - [Optional] the pixel width in meters, assuming 256x256 tiles
59
-
-`!PIXEL_HEIGHT!` - [Optional] the pixel height in meters, assuming 256x256 tiles
60
-
-`!ID_FIELD!` - [Optional] the id field name
61
-
-`!GEOM_FIELD!` - [Optional] the geom field name
62
-
-`!GEOM_TYPE!` - [Optional] the geom type if defined otherwise ""
62
+
-`name` (string): [Required] the name of the layer. This is used to reference this layer from map layers.
63
+
-`geometry_fieldname` (string): [Optional] the name of the filed which contains the geometry for the feature. defaults to `geom`.
64
+
-`id_fieldname` (string): [Optional] the name of the feature id field. defaults to `gid`.
65
+
-`geometry_type` (string): [Optional] the layer geometry type. If not set, the table will be inspected at startup to try and infer the gemetry type. Valid values are: `Point`, `LineString`, `Polygon`, `MultiPoint`, `MultiLineString`, `MultiPolygon`, `GeometryCollection`.
66
+
-`srid` (int): [Optional] the SRID of the layer. Supports `3857` (WebMercator) or `4326` (WGS84).
67
+
-`sql` (string): [Required] custom SQL to use use. Supports the following tokens:
68
+
-`!BBOX!` - [Required] will be replaced with the bounding box of the tile before the query is sent to the database. `!bbox!` and`!BOX!` are supported as well for compatibilitiy with queries from Mapnik and MapServer styles.
69
+
-`!X!` - [Optional] will replaced with the "X" value of the requested tile.
70
+
-`!Y!` - [Optional] will replaced with the "Y" value of the requested tile.
71
+
-`!Z!` - [Optional] will replaced with the "Z" value of the requested tile.
72
+
-`!ZOOM!` - [Optional] will be replaced with the "Z" (zoom) value of the requested tile.
$ export PGURI_NO_ACCESS="postgres://tegola_no_access:postgres@localhost:5432/tegola"# used for testing errors when user does not have read permissions on a table
$ export PGURI_NO_ACCESS="postgres://tegola_no_access:@localhost:5432/tegola"# used for testing errors when user does not have read permissions on a table
0 commit comments