Công nghệ GIS Sói's Tutorials WebGIS

Hướng dẫn Tileserver T-rex

Table of Content

Hướng dẫn Tileserver T-rex

image

Cài đặt

https://t-rex.tileserver.ch/doc/setup/#installation

Đối với Window

Download và cài file t-rex-v0.12.0.msi

https://github.com/t-rex-tileserver/t-rex/releases/download/v0.12.0/t-rex-v0.12.0.msi

Cấu hình đường dẫn thư viện

set GDAL_DATA=%programfiles%\t-rex\gdal-data

"%programfiles%\t-rex\t_rex"

Đối với Linux

curl -O -L https://github.com/t-rex-tileserver/t-rex/releases/download/v0.12.0/t-rex-v0.12.0-x86_64-linux-gnu.tar.gz && sudo tar xf t-rex-v0.12.0-x86_64-linux-gnu.tar.gz -C /usr/local/bin

# Giải nén
tar xvzf PACKAGENAME.tar.gz

https://sourcedigit.com/20839-extract-install-tar-gz-files-ubuntu/

Sử dụng

PostgreSQL Data Source (mặc định)

t_rex serve --dbconn postgresql://user:[email protected]/osm2vectortiles

t_rex serve --dbconn postgresql://user:[email protected]/osm2vectortiles

t_rex serve --dbconn postgresql://postgres:*******@localhost:5433/thuyloibentre

t_rex serve \
--dbconn postgresql://postgres:****@localhost:5432/atlas_vietnam \
--bind 0.0.0.0 \
--cache /webdir/Tileserver_T_rex/mvtcache

Tiles are then served at http://localhost:6767/{layer}/{z}/{x}/{y}.pbf

GDAL Data Source

t_rex serve --datasource natural_earth.gpkg
t_rex serve --datasource ne_110m_coastline.shp
t_rex serve --datasource liechtenstein-latest.osm.pbf
t_rex serve --datasource route.gpx
t_rex serve --datasource spreadsheet.vrt

Use a tile cache

t_rex serve --dbconn postgresql://user:[email protected]/dbname --cache /tmp/mvtcache

Run server with configuration file:

t_rex serve --config config.toml

Server options

USAGE:
    t_rex serve [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --bind <IPADDRESS>                          Bind web server to this address (0.0.0.0 for all)
        --cache <DIR>                               Use tile cache in DIR
        --clip <true|false>                         Clip geometries
    -c, --config <FILE>                             Load from custom config file
        --datasource <FILE_OR_GDAL_DS>              GDAL datasource specification
        --dbconn <SPEC>                             PostGIS connection postgresql://[email protected]/DBNAME
        --detect-geometry-types <true|false>        Detect geometry types when undefined
        --loglevel <error|warn|info|debug|trace>    Log level (Default: info)
        --no-transform <true|false>                 Do not transform to grid SRS
        --openbrowser <true|false>                  Open backend URL in browser
        --port <PORT>                               Bind web server to this port
        --qgs <FILE>                                QGIS project file
        --simplify <true|false>                     Simplify geometries

image

Tham khảo

https://t-rex.tileserver.ch/doc/serve/

https://t-rex.tileserver.ch/doc/configuration/#layer-configuration

Leave a Reply

Your email address will not be published. Required fields are marked *