postgis

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort    = 5432
	DefaultSRID    = tegola.WebMercator
	DefaultMaxConn = 100
)
View Source
const (
	ConfigKeyHost        = "host"
	ConfigKeyPort        = "port"
	ConfigKeyDB          = "database"
	ConfigKeyUser        = "user"
	ConfigKeyPassword    = "password"
	ConfigKeyMaxConn     = "max_connections"
	ConfigKeySRID        = "srid"
	ConfigKeyLayers      = "layers"
	ConfigKeyLayerName   = "name"
	ConfigKeyTablename   = "tablename"
	ConfigKeySQL         = "sql"
	ConfigKeyFields      = "fields"
	ConfigKeyGeomField   = "geometry_fieldname"
	ConfigKeyGeomIDField = "id_fieldname"
)
View Source
const Name = "postgis"

Variables

This section is empty.

Functions

func NewProvider

func NewProvider(config map[string]interface{}) (mvt.Provider, error)
	NewProvider Setups and returns a new postgis provider or an error; if something
	is wrong. The function will validate that the config object looks good before
	trying to create a driver. This means that the Provider expects the following
	fields to exists in the provided map[string]interface{} map:

		host (string) — the host to connect to.
		port (uint16) — the port to connect on.
		database (string) — the database name
		user (string) — the user name
		password (string) — the Password
		max_connections (*uint8) // Default is 100 if nil, 0 means no max.
		layers (map[string]struct{})  — This is map of layers keyed by the layer name.
    		tablename (string || sql string) — This is the sql to use or the tablename to use with the default query.
    		fields ([]string) — This is a list, if this is nil or empty we will get all fields.
    		geometry_fieldname (string) — This is the field name of the geometry, if it's an empty string or nil, it will defaults to 'geom'.
    		id_fieldname (string) — This is the field name for the id property, if it's an empty string or nil, it will defaults to 'gid'.

Types

type Layer added in v0.4.0

type Layer struct {
	// contains filtered or unexported fields
}

layer holds information about a query.

func (Layer) GeomFieldName added in v0.4.0

func (l Layer) GeomFieldName() string

func (Layer) GeomType added in v0.4.0

func (l Layer) GeomType() tegola.Geometry

func (Layer) IDFieldName added in v0.4.0

func (l Layer) IDFieldName() string

func (Layer) Name added in v0.4.0

func (l Layer) Name() string

func (Layer) SRID added in v0.4.0

func (l Layer) SRID() int

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider provides the postgis data provider.

func (*Provider) ForEachFeature added in v0.4.0

func (p *Provider) ForEachFeature(ctx context.Context, layerName string, tile tegola.Tile, fn func(layer Layer, gid uint64, geom wkb.Geometry, tags map[string]interface{}) error) error

func (*Provider) Layer added in v0.4.0

func (p *Provider) Layer(name string) (Layer, bool)

func (Provider) Layers added in v0.4.0

func (p Provider) Layers() ([]mvt.LayerInfo, error)

func (Provider) MVTLayer

func (p Provider) MVTLayer(ctx context.Context, layerName string, tile tegola.Tile, dtags map[string]interface{}) (layer *mvt.Layer, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL