Skip to content

Commit

Permalink
updated README and CHANGELOG with details about the new CLI. cleaned …
Browse files Browse the repository at this point in the history
…out some unused packages and moved tilejson package under the mapbox parent package.
  • Loading branch information
ARolek committed Dec 5, 2017
1 parent a7f2e6e commit 50e28fc
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 55 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.5.0 (2017-12-XX)
- Added: Command line `cache seed` and `cache purge` commands
- Added: More robust command line interface

Breaking changes:
- To use tegola as a web server, use the command `tegola serve --config=/path/to/config.toml`

## 0.4.2 (2017-11-28)
- Fixed: Performance affected by unused log statements (#197, @remster)

Expand Down
68 changes: 37 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,41 @@ Tegola is a vector tile server delivering [Mapbox Vector Tiles](https://github.c

## Features
- Native geometry processing (simplification, clipping, make valid, intersection, contains, scaling, translation)
- [Mapbox Vector Tile v2 specification](https://github.com/mapbox/vector-tile-spec) compliant .
- [Mapbox Vector Tile v2 specification](https://github.com/mapbox/vector-tile-spec) compliant.
- Embedded viewer with auto generated style for quick data visualization and inspection.
- Support for PostGIS as a data provider. Extensible to support additional data providers.
- Local filesystem caching. Extensible design to support additional cache backends.
- Cache seeding to fill the cache prior to web requests.
- Parallelized tile serving and geometry processing.
- Support for Web Mercator (3857) and WGS84 (4326) projections.

## Running Tegola
## Usage
```
tegola is a vector tile server
Version: v0.5.0
Usage:
tegola [command]
Available Commands:
cache Manipulate the tile cache
help Help about any command
serve Use tegola as a tile server
version Print the version number of tegola
Flags:
--config string path to config file (default "config.toml")
-h, --help help for tegola
Use "tegola [command] --help" for more information about a command.
```

## Running tegola as a vector tile server
1. Download the appropriate binary of tegola for your platform via the [release page](https://github.com/terranodo/tegola/releases).
2. Setup your config file and run. Tegola expects a `config.toml` to be in the same directory as the binary. You can set a different location for the `config.toml` using a command flag:

```
./tegola -config=/path/to/config.toml
./tegola sever --config=/path/to/config.toml
```

## Server Endpoints
Expand Down Expand Up @@ -74,14 +96,12 @@ Return [TileJSON](https://github.com/mapbox/tilejson-spec) details about the map

Return an auto generated [Mapbox GL Style](https://www.mapbox.com/mapbox-gl-js/style-spec/) for the configured map.


## Configuration
The tegola config file uses the [TOML](https://github.com/toml-lang/toml) format. The following example shows how to configure a PostGIS data provider with two layers. The first layer includes a `tablename`, `geometry_field` and an `id_field`. The second layer uses a custom `sql` statement instead of the `tablename` property.

Under the `maps` section, map layers are associated with data provider layers and their `min_zoom` and `max_zoom` values are defined. Optionally, `default_tags` can be setup which will be encoded into the layer. If the same tags are returned from a data provider, the data provider's values will take precedence.

```toml

[webserver]
port = ":9090" # port to bind the web server to. defaults ":8080"

Expand Down Expand Up @@ -116,9 +136,9 @@ max_connections = "50" # The max connections to maintain in the connection
fields = [ "class", "name" ] # Additional fields to include in the select statement.

[[providers.layers]]
name = "rivers" # will be encoded as the layer name in the tile
name = "rivers" # will be encoded as the layer name in the tile
geometry_fieldname = "geom" # geom field. default is geom
id_fieldname = "gid" # geom id field. default is gid
id_fieldname = "gid" # geom id field. default is gid
# Custom sql to be used for this layer. Note: that the geometery field is wraped
# in a ST_AsBinary, as tegola only understand wkb.
sql = """
Expand All @@ -140,7 +160,7 @@ name = "zoning" # used in the URL to reference this
min_zoom = 12 # minimum zoom level to include this layer
max_zoom = 16 # maximum zoom level to include this layer

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

[[maps.layers]]
Expand All @@ -155,43 +175,29 @@ The following tokens are supported in custom SQL queries for the PostGIS data pr
- `!BBOX!` - [required] Will convert the z/x/y values into a bounding box to query the feature table with.
- `!ZOOM!` - [optional] Pass in the zoom value for the request. Useful for filtering feature results by zoom.

## Command line flags
Tegola supports the following command flags:

- `config` - Location of config file in TOML format. Can be absolute, relative or remote over http(s).
- `port` - Port for the webserver to bind to. i.e. :8080
- `log-file` - Path to write webserver tile request logs
- `log-format` - The format that the logger will log with. Available fields:
- `{{.Time}}` : The current Date Time in RFC 2822 format.
- `{{.RequestIP}}` : The IP address of the the requester.
- `{{.Z}}` : The Zoom level.
- `{{.X}}` : The X Coordinate.
- `{{.Y}}` : The Y Coordinate.

## Debugging

### Environment Variables
## Environment Variables
The following environment variables can be used for debugging:

`SQL_DEBUG` specify the type of SQL debug information to output. Currently support two values:

- `LAYER_SQL`: print layer SQL as they are parsed from the config file.
- `EXECUTE_SQL`: print SQL that is executed for each tile request and the number of items it returns or an error.

#### Usage

```bash
$ SQL_DEBUG=LAYER_SQL tegola -config=/path/to/conf.toml
```

The following environment variables can be use to control various runtime options:

`TEGOLA_OPTIONS` specify a set of options comma (or space) seperated options.

- `DontSimplifyGeo` to turn off simplification for all layers.
- `SimplifyMaxZoom={{int}}` to set the max zoom that simplification will apply to. (14 is default)


#### Usage

```bash
$ SQL_DEBUG=LAYER_SQL tegola -config=/path/to/conf.toml
```

### Client side
## Client side debugging
When debugging client side, it's often helpful to to see an outline of a tile along with it's Z/X/Y values. To encode a debug layer into every tile add the query string variable `debug=true` to the URL template being used to request tiles. For example:

```
Expand Down
14 changes: 0 additions & 14 deletions debug/log/log.go

This file was deleted.

8 changes: 0 additions & 8 deletions debug/log/noop.go

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion server/handle_map_capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/dimfeld/httptreemux"
"github.com/terranodo/tegola"
"github.com/terranodo/tegola/atlas"
"github.com/terranodo/tegola/tilejson"
"github.com/terranodo/tegola/mapbox/tilejson"
)

type HandleMapCapabilities struct {
Expand Down
2 changes: 1 addition & 1 deletion server/handle_map_capabilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/dimfeld/httptreemux"

"github.com/terranodo/tegola/atlas"
"github.com/terranodo/tegola/mapbox/tilejson"
"github.com/terranodo/tegola/server"
"github.com/terranodo/tegola/tilejson"
)

func TestHandleMapCapabilities(t *testing.T) {
Expand Down

0 comments on commit 50e28fc

Please sign in to comment.