geoskeleton

package module
v0.0.0-...-e2485f8 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2017 License: MIT Imports: 11 Imported by: 0

README

GoDoc Go Report Card License MIT License

GeoSkeletonDB

Simple wrapper for BoltDB to store GeoJSON data

Documentation

https://godoc.org/github.com/sjsafranek/GeoSkeletonDB

ToDo

Documentation

Index

Constants

View Source
const (
	// DEFAULT_PRECISION decimal decimal for storing latitude and longitude.
	DEFAULT_PRECISION int = 6 //8

	// DEFAULT_DATABASE_TABLE Database table used to store data.
	DEFAULT_DATABASE_TABLE string = "GeoJsonDatasources"
)

Variables

View Source
var (
	// COMMIT_LOG_FILE database commit log file path
	COMMIT_LOG_FILE string = "geo_skeleton_commit.log"
)

Functions

func NewUUID

func NewUUID() (string, error)

NewUUID generates and returns url friendly uuid. Source: http://play.golang.org/p/4FkNSiUDMg.

func NewUUID2

func NewUUID2() (string, error)

NewUUID2 generates and returns a uuid.

func Round

func Round(f float64) float64

Round float64. Source: https://gist.github.com/DavidVaini/10308388

func RoundToPrecision

func RoundToPrecision(f float64, places int) float64

RoundToPrecision rounds float64 to specified decimal precision. Source: https://gist.github.com/DavidVaini/10308388

Types

type Database

type Database struct {
	Table string
	File  string

	Precision int
	DB        skeleton.Database
	// contains filtered or unexported fields
}

Database struct for application.

func NewGeoSkeletonDB

func NewGeoSkeletonDB(db_file string) Database

Creates a GeoSkeletonDB

func (*Database) CommitQueueLength

func (self *Database) CommitQueueLength() int

CommitQueueLength returns length of database commit_log_queue.

func (*Database) DeleteLayer

func (self *Database) DeleteLayer(datasource_id string) error

DeleteLayer deletes geojson layer from database

func (*Database) EditFeature

func (self *Database) EditFeature(datasource_id string, geo_id string, feat *geojson.Feature) error

EditFeature edits geojson feature within geojson layer. Updates geojson layer in Database

func (*Database) GetLayer

func (self *Database) GetLayer(datasource_id string) (*geojson.FeatureCollection, error)

GetLayer returns geojson layer from database TODO: Switch to timeseries datasource

func (*Database) GetLayers

func (self *Database) GetLayers() ([]string, error)

GetLayers returns all datasource_ids from database

func (*Database) Init

func (self *Database) Init()

Initiates database. Creates required database tables and starts commit log.

func (*Database) InsertFeature

func (self *Database) InsertFeature(datasource_id string, feat *geojson.Feature) error

InsertFeature adds geojson feature to geojson layer. Updates layer in database

func (*Database) InsertLayer

func (self *Database) InsertLayer(datasource_id string, geojs *geojson.FeatureCollection) error

InsertLayer inserts geojson layer into database TODO: Switch to timeseries datasource

func (*Database) InsertTimeseriesDatasource

func (self *Database) InsertTimeseriesDatasource(datasource_id string, ddata diffstore.DiffStore) error

InsertTimeseriesDatasource inserts timeseries geojson layer to database

func (*Database) NewLayer

func (self *Database) NewLayer() (string, error)

NewLayer creates new geojson layer. Writes new layer to database. TODO: RENAME TO NewDatasource

func (*Database) SelectTimeseriesDatasource

func (self *Database) SelectTimeseriesDatasource(datasource_id string) (diffstore.DiffStore, error)

SelectTimeseriesDatasource selects timeseries geojson layer from database

func (*Database) StartCommitLog

func (self *Database) StartCommitLog()

Starts Database commit log.

func (*Database) UpdateTimeseriesDatasource

func (self *Database) UpdateTimeseriesDatasource(datasource_id string, value []byte) error

UpdateTimeseriesDatasource updates timeseries geojson layer and saves to database.

Jump to

Keyboard shortcuts

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