postgis

package
v0.0.0-...-8afb70f Latest Latest
Warning

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

Go to latest
Published: May 19, 2015 License: MIT, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Area

func Area(s Shape) aspect.Clause

Returns the area of the surface if it is a polygon or multi-polygon. For "geometry" type area is in SRID units. For "geography" area is in square meters.

func AreaOf

Returns the area of the given column For "geometry" type area is in SRID units. For "geography" area is in square meters.

func AsBinary

func AsBinary(c aspect.ColumnElem) aspect.ColumnElem

Return the Well-Known Binary (WKB) representation of the geometry/geography without SRID meta data

func AsEWKT

Return the Well-Known Text (WKT) representation of the geometry with SRID meta data

func AsGML

Return the geometry as a GML version 2 or 3 element

func AsGeoJSON

func AsGeoJSON(c aspect.ColumnElem) aspect.ColumnElem

Return the geometry as a GeoJSON element

func AsGeography

func AsGeography(c aspect.ColumnElem) aspect.ColumnElem

func AsGeometry

func AsGeometry(c aspect.ColumnElem) aspect.ColumnElem

func AsKML

Return the geometry as a KML element with default version=2 and precision=15

func AsKMLVersion

func AsKMLVersion(c aspect.ColumnElem, version, maxdigits int) aspect.ColumnElem

Return the geometry as a KML element.

func AsLatLon

func AsLatLon(c aspect.ColumnElem) aspect.ColumnElem

Return the Degrees, Minutes, Seconds representation of the given point

func AsSVG

Returns a Geometry in SVG path data given a geometry or geography object

func AsText

Return the Well-Known Text (WKT) representation of the geometry/geography without SRID metadata

func DWithin

func DWithin(c aspect.ColumnElem, s Shape, d int) aspect.Clause

func GeoHash

Return a GeoHash representation of the geometry.

func Intersects

func Intersects(c aspect.ColumnElem, s Shape) aspect.Clause

ST_Intersects — Returns TRUE if the Geometries/Geography "spatially intersect in 2D" - (share any portion of space) and FALSE if they don't (they are Disjoint). For geography -- tolerance is 0.00001 meters (so any points that close are considered to intersect)

func Within

func Within(c aspect.ColumnElem, s Shape) aspect.Clause

Within returns true if the given shape is completely inside the given column

Types

type Geometry

type Geometry struct {
	Geom Shape
	SRID int
}

func (Geometry) Create

func (g Geometry) Create(d aspect.Dialect) (string, error)

func (Geometry) IsPrimaryKey

func (g Geometry) IsPrimaryKey() bool

func (Geometry) IsRequired

func (g Geometry) IsRequired() bool

func (Geometry) IsUnique

func (g Geometry) IsUnique() bool

func (Geometry) Validate

func (g Geometry) Validate(i interface{}) (interface{}, error)

type LatLong

type LatLong struct {
	Latitude, Longitude float64
}

func (LatLong) Compile

func (p LatLong) Compile(d aspect.Dialect, params *aspect.Parameters) (string, error)

A point with the implied SRID of 4326 TODO parameterization

func (LatLong) Create

func (p LatLong) Create(d aspect.Dialect) (string, error)

func (LatLong) String

func (p LatLong) String() string

String returns the element's SQL using the default dialect.

type Linestring

type Linestring struct {
	Points []Point
}

func (Linestring) Compile

func (p Linestring) Compile(d aspect.Dialect, params *aspect.Parameters) (string, error)

func (Linestring) Create

func (p Linestring) Create(d aspect.Dialect) (string, error)

func (Linestring) String

func (p Linestring) String() string

String returns the element's SQL using the default dialect.

type MultiPoint

type MultiPoint struct {
	Points []Point
}

func (MultiPoint) Compile

func (p MultiPoint) Compile(d aspect.Dialect, params *aspect.Parameters) (string, error)

TODO

func (MultiPoint) Create

func (p MultiPoint) Create(d aspect.Dialect) (string, error)

func (MultiPoint) String

func (p MultiPoint) String() string

String returns the element's SQL using the default dialect.

type Point

type Point struct {
	X, Y float64
}

func (Point) Compile

func (p Point) Compile(d aspect.Dialect, params *aspect.Parameters) (string, error)

TODO parameterization

func (Point) Create

func (p Point) Create(d aspect.Dialect) (string, error)

func (Point) String

func (p Point) String() string

type Polygon

type Polygon struct {
	Exterior  Linestring
	Interiors []Linestring
}

func (Polygon) Compile

func (p Polygon) Compile(d aspect.Dialect, params *aspect.Parameters) (string, error)

func (Polygon) Create

func (p Polygon) Create(d aspect.Dialect) (string, error)

func (Polygon) String

func (p Polygon) String() string

String returns the element's SQL using the default dialect.

type Shape

type Shape interface {
	aspect.Compiles
	Create(aspect.Dialect) (string, error)
}

TODO Shapes implement both the Compiles interface and dbType (which is not exported but probably should be)

Jump to

Keyboard shortcuts

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