tegola 安装和使用

# 缺点是在小比例尺下,性能较差,很久都切不出瓦片。

官网:https://tegola.io/
github:https://github.com/go-spatial/tegola

直接下载二进制文件.zip,解压即可运行

./tegola serve --config=tegola_config.toml

1.配置文件 config.toml
参考:

https://tegola.io/documentation/

2.查看自动生成的样式

http://192.168.10.103:8882/

3.HTTP Endpoints

http://192.168.10.103:8882/capabilities/
http://192.168.10.103:8882/capabilities/gzpgis.json

4.如何与mapbox结合使用?

参考:https://tegola.io/tutorials/tegola-with-mapbox/

可以做到数据动态更新

config.toml样式:

tile_buffer = 64

[webserver]
port = ":8882"

[cache]
type="file"             # cache type
basepath="/tmp/tegola"  # cache specific config

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

    # Example data
    [[providers.layers]]
    name = "po"                      # will be encoded as the layer name in the tile
    tablename = "public.po"    # sql or table_name are required
    geometry_fieldname = "geom"           # geom field. default is geom
    id_fieldname = "id"                  # geom id field. default is gid
    srid = 4326                           # the SRID of the geometry field if different than

    [[providers.layers]]
    name = "xzqh"                         # will be encoded as the layer name in the tile
    tablename = "public.xzqh"	   # sql or table_name are required
    geometry_fieldname = "geom"            # geom field. default is geom
    id_fieldname = "id"                   # geom id field. default is gid
    fields = [ "mc", "dm" ]           # Additional fields to include in the select statement.


# maps are made up of layers
[[maps]]
name = "gis"                             # used in the URL to reference this map (/maps/:map_name)
tile_buffer = 0                             # number of pixels to extend a tile's clipping area

    [[maps.layers]]
    provider_layer = "test_postgis.po" # must match a data provider layer
    min_zoom = 4                           # minimum zoom level to include this layer
    max_zoom = 20                           # maximum zoom level to include this layer

        [maps.layers.default_tags]          # table of default tags to encode in the tile. SQL statements will override
        class = "park"

    [[maps.layers]]
    provider_layer = "test_postgis.xzqh"  # must match a data provider layer
    min_zoom = 6                           # minimum zoom level to include this layer
    max_zoom = 20                           # maximum zoom level to include this layer

 

 

你可能感兴趣的:(mapbox)