gpkg

package
v0.0.0-...-252bcd3 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvelopeTypeNone    = envelopeType(0)
	EnvelopeTypeXY      = envelopeType(1)
	EnvelopeTypeXYZ     = envelopeType(2)
	EnvelopeTypeXYM     = envelopeType(3)
	EnvelopeTypeXYZM    = envelopeType(4)
	EnvelopeTypeInvalid = envelopeType(5)
)

Variables

View Source
var Magic = [2]byte{0x47, 0x50}

Magic is the magic number encode in the header. It should be 0x4750

Functions

This section is empty.

Types

type BinaryHeader

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

BinaryHeader is the gpkg header that accompainies every feature.

func NewBinaryHeader

func NewBinaryHeader(data []byte) (*BinaryHeader, error)

NewBinaryHeader decodes the data into the BinaryHeader

func (*BinaryHeader) Envelope

func (h *BinaryHeader) Envelope() []float64

Envelope is the bounding box of the feature, used for searching. If the EnvelopeType is EvelopeTypeNone, then there isn't a envelope encoded and a search without an index will need to be preformed. This is to save space.

func (*BinaryHeader) EnvelopeType

func (h *BinaryHeader) EnvelopeType() envelopeType

EnvelopeType is the type of the envelope that is provided.

func (*BinaryHeader) IsGeometryEmpty

func (h *BinaryHeader) IsGeometryEmpty() bool

IsGeometryEmpty tells us if the geometry should be considered empty.

func (*BinaryHeader) IsStandardGeometry

func (h *BinaryHeader) IsStandardGeometry() bool

IsStandardGeometery is the geometry a core/extended geometry type, or a user defined geometry type.

func (*BinaryHeader) Magic

func (h *BinaryHeader) Magic() [2]byte

Magic is the magic number encode in the header. It should be 0x4750

func (*BinaryHeader) SRSId

func (h *BinaryHeader) SRSId() int32

SRSId is the SRS id of the feature.

func (*BinaryHeader) Size

func (h *BinaryHeader) Size() int

Size is the size of the header in bytes.

func (*BinaryHeader) Version

func (h *BinaryHeader) Version() uint8

Version is the version number encode in the header.

type Content

type Content struct {
	ContentTableName         string     `sql:"type:text" gorm:"column:table_name;unique;not null;primary_key"`
	DataType                 string     `sql:"type:text" gorm:"column:data_type;not null"`
	Identifier               string     `sql:"type:text" gorm:"column:identifier;unique"`
	Description              string     `sql:"type:text" gorm:"column:description;default:''"`
	LastChange               *time.Time `gorm:"column:last_change;not null"`
	MinX                     float64    `gorm:"column:min_x"`
	MinY                     float64    `gorm:"column:min_y"`
	MaxX                     float64    `gorm:"column:max_x"`
	MaxY                     float64    `gorm:"column:max_y"`
	SpatialReferenceSystemId int        `sql:"type:integer REFERENCES gpkg_spatial_ref_sys(srs_id)" gorm:"column:srs_id"`
}

func (Content) TableName

func (Content) TableName() string

type CoordinateReferenceSystem

type CoordinateReferenceSystem struct {
	Type                      string                     `json:"type" bson:"type" yaml:"type" hcl:"type"`
	Properties                map[string]interface{}     `json:"properties" bson:"properties" yaml:"properties" hcl:"properties"`
	CoordinateReferenceSystem *CoordinateReferenceSystem `json:"crs,omitempty" bson:"crs,omitempty" yaml:"crs,omitempty" hcl:"crs"`
}

type Extension

type Extension struct {
	Table      string  `sql:"type:text" gorm:"column:table_name"`
	Column     *string `sql:"type:text" gorm:"column:column_name"`
	Extension  string  `sql:"type:text" gorm:"column:extension_name;not null"`
	Definition string  `sql:"type:text" gorm:"column:definition;not null"`
	Scope      string  `sql:"type:text" gorm:"column:scope;not null"`
}

func (Extension) TableName

func (Extension) TableName() string

type Extent

type Extent struct {
	MinX float64
	MinY float64
	MaxX float64
	MaxY float64
}

func (Extent) GetCenter

func (e Extent) GetCenter() []float64

func (Extent) GetCenterX

func (e Extent) GetCenterX() float64

func (Extent) GetCenterY

func (e Extent) GetCenterY() float64

type Feature

type Feature struct {
	Id           interface{}            `json:"id" bson:"id" yaml:"id" hcl:"id"`
	Type         string                 `json:"type" bson:"type" yaml:"type" hcl:"type"`
	Properties   map[string]interface{} `json:"properties" bson:"properties" yaml:"properties" hcl:"properties"`
	GeometryName string                 `json:"geometry_name" bson:"geometry_name" yaml:"geometry_name" hcl:"geometry_name"`
	Geometry     Geometry               `json:"geometry" bson:"geometry" yaml:"geometry" hcl:"geometry"`
}

func NewFeature

func NewFeature(id interface{}, properties map[string]interface{}, geom Geometry) Feature

type FeatureCollection

type FeatureCollection struct {
	Type                      string                     `json:"type" bson:"type" yaml:"type" hcl:"type"`
	TotalFeatures             int                        `json:"totalFeatures" bson:"totalFeatures" yaml:"totalFeatures" hcl:"totalFeatures"`
	Features                  []Feature                  `json:"features" bson:"features" yaml:"features" hcl:"features"`
	CoordinateReferenceSystem *CoordinateReferenceSystem `json:"crs,omitempty" bson:"crs,omitempty" yaml:"crs,omitempty" hcl:"crs"`
}

func NewFeatureCollection

func NewFeatureCollection(features []Feature) FeatureCollection

func (FeatureCollection) ToJson

func (fc FeatureCollection) ToJson() (string, error)

type GeoPackage

type GeoPackage struct {
	Uri string
	DB  *gorm.DB
}

func New

func New(uri string) *GeoPackage

func (*GeoPackage) AddGeomColumn

func (g *GeoPackage) AddGeomColumn(tableName, geomColumn, geomType string) error

AddGeomColumn geom type will be covert to upper case

func (*GeoPackage) AddSpatialIndex

func (g *GeoPackage) AddSpatialIndex(tabelName, geomColumn string) error

AddSpatialIndex ..

func (*GeoPackage) AutoMigrate

func (g *GeoPackage) AutoMigrate() error

func (*GeoPackage) AutoMigrateRelatedTables

func (g *GeoPackage) AutoMigrateRelatedTables() error

AutoMigrateRelatedTables creates tables used by the related tables extension.

func (*GeoPackage) Close

func (g *GeoPackage) Close() error

func (*GeoPackage) Exists

func (g *GeoPackage) Exists() bool

func (*GeoPackage) GetExtent

func (g *GeoPackage) GetExtent() (*Extent, error)

func (*GeoPackage) GetFeatureCollection

func (g *GeoPackage) GetFeatureCollection(table_name string) (*FeatureCollection, error)

func (*GeoPackage) GetGeometryType

func (g *GeoPackage) GetGeometryType(table_name string, column_name string) (string, error)

func (*GeoPackage) GetMaxZoom

func (g *GeoPackage) GetMaxZoom(table string) (int, error)

func (*GeoPackage) GetSpatialReferenceSystem

func (g *GeoPackage) GetSpatialReferenceSystem(srs_id int) (SpatialReferenceSystem, error)

func (*GeoPackage) GetSpatialReferenceSystemCode

func (g *GeoPackage) GetSpatialReferenceSystemCode(srs_id int) (string, error)

func (*GeoPackage) GetTile

func (g *GeoPackage) GetTile(table string, z int, x int, y int) ([]byte, error)

func (*GeoPackage) GetTileHeight

func (g *GeoPackage) GetTileHeight(table string) (int, error)

func (*GeoPackage) GetTileMatrixSets

func (g *GeoPackage) GetTileMatrixSets() ([]TileMatrixSet, error)

func (*GeoPackage) GetTileMatrixSetsAsIterator

func (g *GeoPackage) GetTileMatrixSetsAsIterator() (*TileMatrixSetIterator, error)

func (*GeoPackage) GetTileMatrixSetsAsList

func (g *GeoPackage) GetTileMatrixSetsAsList() (*TileMatrixSetList, error)

func (*GeoPackage) GetTileWith

func (g *GeoPackage) GetTileWith(table string) (int, error)

func (*GeoPackage) GetVectorLayers

func (g *GeoPackage) GetVectorLayers() ([]VectorLayer, error)

func (*GeoPackage) GetVectorLayersAsList

func (g *GeoPackage) GetVectorLayersAsList() (*VectorLayerList, error)

func (*GeoPackage) Init

func (g *GeoPackage) Init() error

func (*GeoPackage) InitSpatialRefSys

func (g *GeoPackage) InitSpatialRefSys() error

InitSpatialRefSys ..

func (*GeoPackage) QueryInt

func (g *GeoPackage) QueryInt(stmt string) (int, error)

func (*GeoPackage) Size

func (g *GeoPackage) Size() (int64, error)

type Geometry

type Geometry struct {
	Type        string      `json:"type" bson:"type" yaml:"type" hcl:"type"`
	Coordinates interface{} `json:"coordinates" bson:"coordinates" yaml:"coordinates" hcl:"coordinates"`
}

func NewLine

func NewLine(coordinates [][]float64) Geometry

func NewPoint

func NewPoint(lon float64, lat float64) Geometry

func NewPolygon

func NewPolygon(coordinates [][][2]float64) Geometry

type GeometryColumn

type GeometryColumn struct {
	GeometryColumnTableName  string `gorm:"column:table_name;unique;not null;primary_key"`
	ColumnName               string `gorm:"column:column_name;not null"`
	GeometryType             string `gorm:"column:geometry_type_name;not null"`
	SpatialReferenceSystemId int    `gorm:"column:srs_id"`
	Z                        int    `gorm:"column:z;not null"`
	M                        int    `gorm:"column:m;not null"`
}

func (GeometryColumn) TableName

func (GeometryColumn) TableName() string

type Metadata

type Metadata struct {
	Id            int    `gorm:"column:id;not null;primary_key"`
	MdScope       string `sql:"type:text" gorm:"column:md_scope;not null;default:'dataset'"`
	MdStandardUri string `sql:"type:text" gorm:"column:md_standard_uri;not null"`
	MimeType      string `sql:"type:text" gorm:"column:mime_type;not null;default:'text/xml'"`
	Metadata      string `sql:"type:text" gorm:"column:metadata;not null;default:''"`
}

func (Metadata) TableName

func (Metadata) TableName() string

type MetadataReference

type MetadataReference struct {
	ReferenceScope string     `sql:"type:text" gorm:"column:reference_scope;not null"`
	Name           string     `sql:"type:text" gorm:"column:table_name"`
	ColumnName     string     `sql:"type:text" gorm:"column:column_name"`
	RowIdValue     *int       `gorm:"column:row_id_value"`
	Timestamp      *time.Time `gorm:"column:timestamp;not null;"`
	MdFileId       int        `gorm:"column:md_file_id;not null"`
	MdParentId     *int       `gorm:"column:md_parent_id"`
}

func (MetadataReference) TableName

func (MetadataReference) TableName() string

type NullInt8

type NullInt8 struct {
	Int8  int8
	Valid bool // Valid is true if Int8 is not NULL
}

NullInt8 represents an int8 that may be null. NullInt8 implements the Scanner interface so it can be used as a scan destination, similar to NullString.

func (*NullInt8) Scan

func (n *NullInt8) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullInt8) Value

func (n NullInt8) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type RTree

type RTree struct {
	Table string  `gorm:"-"`
	Id    int     `gorm:"column:id;unique;not null;primary_key"`
	MinX  float64 `gorm:"column:minx;not null"`
	MaxX  float64 `gorm:"column:maxx;not null"`
	MinY  float64 `gorm:"column:miny;not null"`
	MaxY  float64 `gorm:"column:maxy;not null"`
}

func (RTree) ResourceName

func (rt RTree) ResourceName() string

func (RTree) TableName

func (rt RTree) TableName() string

type Relation

type Relation struct {
	Id                   int    `gorm:"column:id;uniqu;not null;primary_key"`
	BaseTableName        string `gorm:"column:base_table_name;not null"`
	BasePrimaryColumn    string `gorm:"column:base_primary_column;not null;default:'id'"`
	RelatedTableName     string `gorm:"column:related_table_name;not null"`
	RelatedPrimaryColumn string `gorm:"column:related_primary_column;not null;default:'id'"`
	RelationName         string `gorm:"column:relation_name;not null"`
	MappingTableName     string `gorm:"column:mapping_table_name;not null"`
}

func (Relation) TableName

func (Relation) TableName() string

type SQLiteSequence

type SQLiteSequence struct {
	Name  string `gorm:"column:name;unique;not null;primary_key"`
	Value int64  `gorm:"column:seq;not null"`
}

func (SQLiteSequence) TableName

func (SQLiteSequence) TableName() string

type SpatialReferenceSystem

type SpatialReferenceSystem struct {
	Name                           string `gorm:"column:srs_name;unique;not null;primary_key"`
	SpatialReferenceSystemId       *int   `gorm:"column:srs_id;unique;not null;primary_key"`
	Organization                   string `gorm:"column:organization;not null" json:"org"`
	OrganizationCoordinateSystemId *int   `gorm:"column:organization_coordsys_id;not null" json:"org_id"`
	Definition                     string `gorm:"column:definition;not null" json:"def"`
	Description                    string `gorm:"column:description" json:"description"`
}

func (*SpatialReferenceSystem) Code

func (srs *SpatialReferenceSystem) Code() string

func (SpatialReferenceSystem) TableName

func (SpatialReferenceSystem) TableName() string

type TileMatrix

type TileMatrix struct {
	Name string `sql:"type:text" gorm:"column:table_name;not null"`
	//ZoomLevel sql.NullInt64 `gorm:"column:zoom_level;not null"`
	ZoomLevel    NullInt8 `gorm:"column:zoom_level;not null"`
	MatrixWidth  uint64   `gorm:"column:matrix_width;not null"`
	MatrixHeight uint64   `gorm:"column:matrix_height;not null"`
	TileWidth    uint32   `gorm:"column:tile_width;not null"`
	TileHeight   uint32   `gorm:"column:tile_height;not null"`
	PixelXSize   float64  `gorm:"column:pixel_x_size;not null"`
	PixelYSize   float64  `gorm:"column:pixel_y_size;not null"`
}

func (TileMatrix) TableName

func (TileMatrix) TableName() string

type TileMatrixSet

type TileMatrixSet struct {
	Name                     string   `"type:text" gorm:"column:table_name;not null;primary_key"`
	SpatialReferenceSystemId *int     `gorm:"column:srs_id;not null"`
	MinX                     *float64 `gorm:"column:min_x;not null"`
	MinY                     *float64 `gorm:"column:min_y;not null"`
	MaxX                     *float64 `gorm:"column:max_x;not null"`
	MaxY                     *float64 `gorm:"column:max_y;not null"`
}

func (TileMatrixSet) GetSpatialReferenceSystemId

func (tms TileMatrixSet) GetSpatialReferenceSystemId() int

func (TileMatrixSet) TableName

func (TileMatrixSet) TableName() string

type TileMatrixSetIterator

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

func (*TileMatrixSetIterator) Next

func (it *TileMatrixSetIterator) Next() (*TileMatrixSet, error)

type TileMatrixSetList

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

func (*TileMatrixSetList) Item

func (l *TileMatrixSetList) Item(i int) *TileMatrixSet

func (*TileMatrixSetList) Size

func (l *TileMatrixSetList) Size() int

type VectorLayer

type VectorLayer struct {
	Name string
	Type string
}

type VectorLayerList

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

func (*VectorLayerList) Item

func (l *VectorLayerList) Item(i int) *VectorLayer

func (*VectorLayerList) Size

func (l *VectorLayerList) Size() int

Jump to

Keyboard shortcuts

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