Documentation ¶
Overview ¶
Package geo contains the base types for spatial data type operations.
Index ¶
- Constants
- Variables
- func AdjustGeomTSRID(t geom.T, srid geopb.SRID)
- func GeomTContainsEmpty(g geom.T) bool
- func IsEmptyGeometryError(err error) bool
- func IsLinearRingCCW(linearRing *geom.LinearRing) bool
- func NewMismatchingSRIDsError(a geopb.SpatialObject, b geopb.SpatialObject) error
- func NormalizeLatitudeDegrees(lat float64) float64
- func NormalizeLongitudeDegrees(lng float64) float64
- func S2RegionsFromGeomT(geomRepr geom.T, emptyBehavior EmptyBehavior) ([]s2.Region, error)
- func SpatialObjectFitsColumnMetadata(so geopb.SpatialObject, srid geopb.SRID, shapeType geopb.ShapeType) error
- func SpatialObjectToEWKT(so geopb.SpatialObject, maxDecimalDigits int) (geopb.EWKT, error)
- func SpatialObjectToGeoHash(so geopb.SpatialObject, p int) (string, error)
- func SpatialObjectToGeoJSON(so geopb.SpatialObject, maxDecimalDigits int, flag SpatialObjectToGeoJSONFlag) ([]byte, error)
- func SpatialObjectToKML(so geopb.SpatialObject) (string, error)
- func SpatialObjectToWKB(so geopb.SpatialObject, byteOrder binary.ByteOrder) (geopb.WKB, error)
- func SpatialObjectToWKBHex(so geopb.SpatialObject) (string, error)
- func SpatialObjectToWKT(so geopb.SpatialObject, maxDecimalDigits int) (geopb.WKT, error)
- func StringToByteOrder(s string) binary.ByteOrder
- func Summary(t geom.T, hasBoundingBox bool, shape geopb.ShapeType, isGeography bool) (string, error)
- func ToLowerSingleByte(b byte) byte
- type CartesianBoundingBox
- func (b *CartesianBoundingBox) AddPoint(x, y float64) *CartesianBoundingBox
- func (b *CartesianBoundingBox) Buffer(deltaX, deltaY float64) *CartesianBoundingBox
- func (b *CartesianBoundingBox) Combine(o *CartesianBoundingBox) *CartesianBoundingBox
- func (b *CartesianBoundingBox) Compare(o *CartesianBoundingBox) int
- func (b *CartesianBoundingBox) Covers(o *CartesianBoundingBox) bool
- func (b *CartesianBoundingBox) Intersects(o *CartesianBoundingBox) bool
- func (b *CartesianBoundingBox) Repr() string
- func (b *CartesianBoundingBox) ToGeomT(srid geopb.SRID) geom.T
- func (b *CartesianBoundingBox) WithPoint(x, y float64) *CartesianBoundingBox
- type EmptyBehavior
- type EmptyGeometryError
- func (w *EmptyGeometryError) Cause() error
- func (w *EmptyGeometryError) Error() string
- func (w *EmptyGeometryError) Format(s fmt.State, verb rune)
- func (w *EmptyGeometryError) FormatError(p errors.Printer) (next error)
- func (w *EmptyGeometryError) SafeDetails() []string
- func (w *EmptyGeometryError) Unwrap() error
- type FnExclusivity
- type Geography
- func MakeGeography(spatialObject geopb.SpatialObject) (Geography, error)
- func MakeGeographyFromGeomT(g geom.T) (Geography, error)
- func MakeGeographyUnsafe(spatialObject geopb.SpatialObject) Geography
- func MustMakeGeographyFromGeomT(g geom.T) Geography
- func MustParseGeography(str string) Geography
- func MustParseGeographyFromEWKB(ewkb geopb.EWKB) Geography
- func ParseGeography(str string) (Geography, error)
- func ParseGeographyFromEWKB(ewkb geopb.EWKB) (Geography, error)
- func ParseGeographyFromEWKBAndSRID(ewkb geopb.EWKB, srid geopb.SRID) (Geography, error)
- func ParseGeographyFromEWKBUnsafe(ewkb geopb.EWKB) (Geography, error)
- func ParseGeographyFromEWKT(ewkt geopb.EWKT, srid geopb.SRID, ...) (Geography, error)
- func ParseGeographyFromGeoJSON(json []byte) (Geography, error)
- func (g *Geography) AsGeomT() (geom.T, error)
- func (g *Geography) AsGeometry() (Geometry, error)
- func (g *Geography) AsS2(emptyBehavior EmptyBehavior) ([]s2.Region, error)
- func (g *Geography) BoundingCap() s2.Cap
- func (g *Geography) BoundingRect() s2.Rect
- func (g *Geography) CloneWithSRID(srid geopb.SRID) (Geography, error)
- func (g *Geography) Compare(o Geography) int
- func (g *Geography) EWKB() geopb.EWKB
- func (g *Geography) EWKBHex() string
- func (g *Geography) SRID() geopb.SRID
- func (g *Geography) ShapeType() geopb.ShapeType
- func (g *Geography) SpaceCurveIndex() uint64
- func (g *Geography) SpatialObject() geopb.SpatialObject
- func (g *Geography) SpatialObjectRef() *geopb.SpatialObject
- func (g *Geography) Spheroid() (*geographiclib.Spheroid, error)
- type GeomTIterator
- type Geometry
- func MakeGeometry(spatialObject geopb.SpatialObject) (Geometry, error)
- func MakeGeometryFromGeomT(g geom.T) (Geometry, error)
- func MakeGeometryFromPointCoords(x, y float64) (Geometry, error)
- func MakeGeometryUnsafe(spatialObject geopb.SpatialObject) Geometry
- func MustParseGeometry(str string) Geometry
- func MustParseGeometryFromEWKB(ewkb geopb.EWKB) Geometry
- func ParseGeometry(str string) (Geometry, error)
- func ParseGeometryFromEWKB(ewkb geopb.EWKB) (Geometry, error)
- func ParseGeometryFromEWKBAndSRID(ewkb geopb.EWKB, srid geopb.SRID) (Geometry, error)
- func ParseGeometryFromEWKBUnsafe(ewkb geopb.EWKB) (Geometry, error)
- func ParseGeometryFromEWKT(ewkt geopb.EWKT, srid geopb.SRID, ...) (Geometry, error)
- func ParseGeometryFromGeoJSON(json []byte) (Geometry, error)
- func ParseGeometryPointFromGeoHash(g string, precision int) (Geometry, error)
- func (g *Geometry) AsGeography() (Geography, error)
- func (g *Geometry) AsGeomT() (geom.T, error)
- func (g *Geometry) CartesianBoundingBox() *CartesianBoundingBox
- func (g *Geometry) CloneWithSRID(srid geopb.SRID) (Geometry, error)
- func (g *Geometry) Compare(o Geometry) int
- func (g *Geometry) EWKB() geopb.EWKB
- func (g *Geometry) EWKBHex() string
- func (g *Geometry) Empty() bool
- func (g *Geometry) SRID() geopb.SRID
- func (g *Geometry) ShapeType() geopb.ShapeType
- func (g *Geometry) SpaceCurveIndex() uint64
- func (g *Geometry) SpatialObject() geopb.SpatialObject
- func (g *Geometry) SpatialObjectRef() *geopb.SpatialObject
- type SpatialObjectToGeoJSONFlag
Constants ¶
const ( // DefaultSRIDShouldOverwrite implies the parsing function should overwrite // the SRID with the defaultSRID. DefaultSRIDShouldOverwrite defaultSRIDOverwriteSetting = true // DefaultSRIDIsHint implies that the default SRID is only a hint // and if the SRID is provided by the given EWKT/EWKB, it should be // used instead. DefaultSRIDIsHint defaultSRIDOverwriteSetting = false )
const DefaultGeoJSONDecimalDigits = 9
DefaultGeoJSONDecimalDigits is the default number of digits coordinates in GeoJSON.
const GeoHashAutoPrecision = 0
GeoHashAutoPrecision means to calculate the precision of SpatialObjectToGeoHash based on input, up to 32 characters.
const GeoHashMaxPrecision = 20
GeoHashMaxPrecision is the maximum precision for GeoHashes. 20 is picked as doubles have 51 decimals of precision, and each base32 position can contain 5 bits of data. As we have two points, we use floor((2 * 51) / 5) = 20.
Variables ¶
var DefaultEWKBEncodingFormat = binary.LittleEndian
DefaultEWKBEncodingFormat is the default encoding format for EWKB.
Functions ¶
func AdjustGeomTSRID ¶
AdjustGeomTSRID adjusts the SRID of a given geom.T. Ideally SetSRID is an interface of geom.T, but that is not the case.
func GeomTContainsEmpty ¶
func GeomTContainsEmpty(g geom.T) bool
GeomTContainsEmpty returns whether a geom.T contains any empty element.
func IsEmptyGeometryError ¶
IsEmptyGeometryError returns true if the error is of type EmptyGeometryError.
func IsLinearRingCCW ¶
func IsLinearRingCCW(linearRing *geom.LinearRing) bool
IsLinearRingCCW returns whether a given linear ring is counter clock wise. See 2.07 of http://www.faqs.org/faqs/graphics/algorithms-faq/. "Find the lowest vertex (or, if there is more than one vertex with the same lowest coordinate,
the rightmost of those vertices) and then take the cross product of the edges fore and aft of it."
func NewMismatchingSRIDsError ¶
func NewMismatchingSRIDsError(a geopb.SpatialObject, b geopb.SpatialObject) error
NewMismatchingSRIDsError returns the error message for SRIDs of GeospatialTypes a and b being a mismatch.
func NormalizeLatitudeDegrees ¶
NormalizeLatitudeDegrees normalizes latitudes to the range [-90, 90].
func NormalizeLongitudeDegrees ¶
NormalizeLongitudeDegrees normalizes longitude to the range [-180, 180].
func S2RegionsFromGeomT ¶
func S2RegionsFromGeomT(geomRepr geom.T, emptyBehavior EmptyBehavior) ([]s2.Region, error)
S2RegionsFromGeomT converts an geom representation of an object to s2 regions. As S2 does not really handle empty geometries well, we need to ingest emptyBehavior and react appropriately.
func SpatialObjectFitsColumnMetadata ¶
func SpatialObjectFitsColumnMetadata( so geopb.SpatialObject, srid geopb.SRID, shapeType geopb.ShapeType, ) error
SpatialObjectFitsColumnMetadata determines whether a GeospatialType is compatible with the given SRID and Shape. Returns an error if the types does not fit.
func SpatialObjectToEWKT ¶
SpatialObjectToEWKT transforms a given SpatialObject to EWKT.
func SpatialObjectToGeoHash ¶
func SpatialObjectToGeoHash(so geopb.SpatialObject, p int) (string, error)
SpatialObjectToGeoHash transforms a given SpatialObject to a GeoHash.
func SpatialObjectToGeoJSON ¶
func SpatialObjectToGeoJSON( so geopb.SpatialObject, maxDecimalDigits int, flag SpatialObjectToGeoJSONFlag, ) ([]byte, error)
SpatialObjectToGeoJSON transforms a given SpatialObject to GeoJSON.
func SpatialObjectToKML ¶
func SpatialObjectToKML(so geopb.SpatialObject) (string, error)
SpatialObjectToKML transforms a given SpatialObject to KML.
func SpatialObjectToWKB ¶
SpatialObjectToWKB transforms a given SpatialObject to WKB.
func SpatialObjectToWKBHex ¶
func SpatialObjectToWKBHex(so geopb.SpatialObject) (string, error)
SpatialObjectToWKBHex transforms a given SpatialObject to WKBHex.
func SpatialObjectToWKT ¶
SpatialObjectToWKT transforms a given SpatialObject to WKT.
func StringToByteOrder ¶
StringToByteOrder returns the byte order of string.
func Summary ¶
func Summary( t geom.T, hasBoundingBox bool, shape geopb.ShapeType, isGeography bool, ) (string, error)
Summary returns a text summary of the contents of the geometry type.
Flags shown square brackets after the geometry type have the following meaning: M: has M coordinate Z: has Z coordinate B: has a cached bounding box G: is geography S: has spatial reference system
func ToLowerSingleByte ¶
ToLowerSingleByte returns the lowercase of a given single ASCII byte. A non ASCII byte is returned unchanged.
Types ¶
type CartesianBoundingBox ¶
type CartesianBoundingBox struct {
geopb.BoundingBox
}
CartesianBoundingBox is the cartesian BoundingBox representation, meant for use for GEOMETRY types.
func BoundingBoxFromGeomTGeometryType ¶
func BoundingBoxFromGeomTGeometryType(g geom.T) *CartesianBoundingBox
BoundingBoxFromGeomTGeometryType returns an appropriate bounding box for a Geometry type.
func NewCartesianBoundingBox ¶
func NewCartesianBoundingBox() *CartesianBoundingBox
NewCartesianBoundingBox returns a properly initialized empty bounding box for carestian plane types.
func ParseCartesianBoundingBox ¶
func ParseCartesianBoundingBox(s string) (CartesianBoundingBox, error)
ParseCartesianBoundingBox parses a box2d string into a bounding box.
func ParseCartesianBoundingBoxFromGeoHash ¶
func ParseCartesianBoundingBoxFromGeoHash(g string, precision int) (CartesianBoundingBox, error)
ParseCartesianBoundingBoxFromGeoHash converts a GeoHash to a CartesianBoundingBox.
func (*CartesianBoundingBox) AddPoint ¶
func (b *CartesianBoundingBox) AddPoint(x, y float64) *CartesianBoundingBox
AddPoint adds a point to the CartesianBoundingBox coordinates. Returns a copy of the CartesianBoundingBox.
func (*CartesianBoundingBox) Buffer ¶
func (b *CartesianBoundingBox) Buffer(deltaX, deltaY float64) *CartesianBoundingBox
Buffer adds deltaX and deltaY to the bounding box on both the Lo and Hi side.
func (*CartesianBoundingBox) Combine ¶
func (b *CartesianBoundingBox) Combine(o *CartesianBoundingBox) *CartesianBoundingBox
Combine combines two bounding boxes together. Returns a copy of the CartesianBoundingBox.
func (*CartesianBoundingBox) Compare ¶
func (b *CartesianBoundingBox) Compare(o *CartesianBoundingBox) int
Compare returns the comparison between two bounding boxes. Compare lower dimensions before higher ones, i.e. X, then Y.
func (*CartesianBoundingBox) Covers ¶
func (b *CartesianBoundingBox) Covers(o *CartesianBoundingBox) bool
Covers returns whether the BoundingBox covers the other bounding box. Empty bounding boxes never cover.
func (*CartesianBoundingBox) Intersects ¶
func (b *CartesianBoundingBox) Intersects(o *CartesianBoundingBox) bool
Intersects returns whether the BoundingBoxes intersect. Empty bounding boxes never intersect.
func (*CartesianBoundingBox) Repr ¶
func (b *CartesianBoundingBox) Repr() string
Repr is the string representation of the CartesianBoundingBox.
func (*CartesianBoundingBox) ToGeomT ¶
func (b *CartesianBoundingBox) ToGeomT(srid geopb.SRID) geom.T
ToGeomT converts a BoundingBox to a GeomT.
func (*CartesianBoundingBox) WithPoint ¶
func (b *CartesianBoundingBox) WithPoint(x, y float64) *CartesianBoundingBox
WithPoint includes a new point to the CartesianBoundingBox. It will edit any bounding box in place.
type EmptyBehavior ¶
type EmptyBehavior uint8
EmptyBehavior is the behavior to adopt when an empty Geometry is encountered.
const ( // EmptyBehaviorError will error with EmptyGeometryError when an empty geometry // is encountered. EmptyBehaviorError EmptyBehavior = 0 // EmptyBehaviorOmit will omit an entry when an empty geometry is encountered. EmptyBehaviorOmit EmptyBehavior = 1 )
type EmptyGeometryError ¶
type EmptyGeometryError struct {
// contains filtered or unexported fields
}
EmptyGeometryError is an error that is returned when the Geometry or any parts of its subgeometries are empty.
func NewEmptyGeometryError ¶
func NewEmptyGeometryError() *EmptyGeometryError
NewEmptyGeometryError returns an error indicating an empty geometry has been found.
func (*EmptyGeometryError) Cause ¶
func (w *EmptyGeometryError) Cause() error
Cause implements the errors.SafeDetailer interface.
func (*EmptyGeometryError) Error ¶
func (w *EmptyGeometryError) Error() string
Error implements the error interface.
func (*EmptyGeometryError) Format ¶
func (w *EmptyGeometryError) Format(s fmt.State, verb rune)
Format implements the errors.Formatter interface.
func (*EmptyGeometryError) FormatError ¶
func (w *EmptyGeometryError) FormatError(p errors.Printer) (next error)
FormatError implements the errors.Formatter interface.
func (*EmptyGeometryError) SafeDetails ¶
func (w *EmptyGeometryError) SafeDetails() []string
SafeDetails implements the SafeDetailer interface.
func (*EmptyGeometryError) Unwrap ¶
func (w *EmptyGeometryError) Unwrap() error
Unwrap implements the SafeDetailer interface.
type FnExclusivity ¶
type FnExclusivity bool
FnExclusivity is used to indicate whether a geo function should have inclusive or exclusive semantics. For example, DWithin == (Distance <= x), while DWithinExclusive == (Distance < x).
const ( // FnExclusive indicates that the corresponding geo function should have // exclusive semantics. FnExclusive FnExclusivity = true // FnInclusive indicates that the corresponding geo function should have // inclusive semantics. FnInclusive FnExclusivity = false )
type Geography ¶
type Geography struct {
// contains filtered or unexported fields
}
Geography is a spherical spatial object.
func MakeGeography ¶
func MakeGeography(spatialObject geopb.SpatialObject) (Geography, error)
MakeGeography returns a new Geography. Assumes the input EWKB is validated and in little endian.
func MakeGeographyFromGeomT ¶
MakeGeographyFromGeomT creates a new Geography from a geom.T object.
func MakeGeographyUnsafe ¶
func MakeGeographyUnsafe(spatialObject geopb.SpatialObject) Geography
MakeGeographyUnsafe creates a geometry object that assumes spatialObject is from the DB. It assumes the spatialObject underneath is safe.
func MustMakeGeographyFromGeomT ¶
func MustMakeGeographyFromGeomT(g geom.T) Geography
MustMakeGeographyFromGeomT enforces no error from MakeGeographyFromGeomT.
func MustParseGeography ¶
MustParseGeography behaves as ParseGeography, but panics if there is an error.
func MustParseGeographyFromEWKB ¶
MustParseGeographyFromEWKB behaves as ParseGeographyFromEWKB, but panics if an error occurs.
func ParseGeography ¶
ParseGeography parses a Geography from a given text.
func ParseGeographyFromEWKB ¶
ParseGeographyFromEWKB parses the EWKB into a Geography.
func ParseGeographyFromEWKBAndSRID ¶
ParseGeographyFromEWKBAndSRID parses the EWKB into a given Geography with the given SRID set.
func ParseGeographyFromEWKBUnsafe ¶
ParseGeographyFromEWKBUnsafe returns a new Geography from an EWKB, without any SRID checks. You should only do this if you trust the EWKB is setup correctly. You most likely want ParseGeographyFromEWKB instead.
func ParseGeographyFromEWKT ¶
func ParseGeographyFromEWKT( ewkt geopb.EWKT, srid geopb.SRID, defaultSRIDOverwriteSetting defaultSRIDOverwriteSetting, ) (Geography, error)
ParseGeographyFromEWKT parses the EWKT into a Geography.
func ParseGeographyFromGeoJSON ¶
ParseGeographyFromGeoJSON parses the GeoJSON into a given Geography.
func (*Geography) AsGeometry ¶
AsGeometry converts a given Geography to its Geometry form.
func (*Geography) AsS2 ¶
func (g *Geography) AsS2(emptyBehavior EmptyBehavior) ([]s2.Region, error)
AsS2 converts a given Geography into it's S2 form.
func (*Geography) BoundingCap ¶
BoundingCap returns the bounding s2.Cap of the given Geography.
func (*Geography) BoundingRect ¶
BoundingRect returns the bounding s2.Rect of the given Geography.
func (*Geography) CloneWithSRID ¶
CloneWithSRID sets a given Geography's SRID to another, without any transformations. Returns a new Geography object.
func (*Geography) Compare ¶
Compare compares a Geography against another. It compares using SpaceCurveIndex, followed by the byte representation of the Geography. This must produce the same ordering as the index mechanism.
func (*Geography) SpaceCurveIndex ¶
SpaceCurveIndex returns an uint64 index to use representing an index into a space-filling curve. This will return 0 for empty spatial objects.
func (*Geography) SpatialObject ¶
func (g *Geography) SpatialObject() geopb.SpatialObject
SpatialObject returns the SpatialObject representation of the Geography.
func (*Geography) SpatialObjectRef ¶
func (g *Geography) SpatialObjectRef() *geopb.SpatialObject
SpatialObjectRef returns a pointer to the SpatialObject representation of the Geography.
type GeomTIterator ¶
type GeomTIterator struct {
// contains filtered or unexported fields
}
GeomTIterator decomposes geom.T objects into individual components (i.e. either a POINT, LINESTRING or POLYGON) and presents them as an iterator. It automatically decomposes MULTI-* and GEOMETRYCOLLECTION objects. This prevents an allocation compared to decomposing the objects into a geom.T array.
func NewGeomTIterator ¶
func NewGeomTIterator(g geom.T, emptyBehavior EmptyBehavior) GeomTIterator
NewGeomTIterator returns a new GeomTIterator.
func (*GeomTIterator) Next ¶
func (it *GeomTIterator) Next() (geom.T, bool, error)
Next returns the next geom.T object, a bool as to whether there is an entry and an error if any.
type Geometry ¶
type Geometry struct {
// contains filtered or unexported fields
}
Geometry is planar spatial object.
func MakeGeometry ¶
func MakeGeometry(spatialObject geopb.SpatialObject) (Geometry, error)
MakeGeometry returns a new Geometry. Assumes the input EWKB is validated and in little endian.
func MakeGeometryFromGeomT ¶
MakeGeometryFromGeomT creates a new Geometry object from a geom.T object.
func MakeGeometryFromPointCoords ¶
MakeGeometryFromPointCoords makes a point from x, y coordinates.
func MakeGeometryUnsafe ¶
func MakeGeometryUnsafe(spatialObject geopb.SpatialObject) Geometry
MakeGeometryUnsafe creates a geometry object that assumes spatialObject is from the DB. It assumes the spatialObject underneath is safe.
func MustParseGeometry ¶
MustParseGeometry behaves as ParseGeometry, but panics if there is an error.
func MustParseGeometryFromEWKB ¶
MustParseGeometryFromEWKB behaves as ParseGeometryFromEWKB, but panics if an error occurs.
func ParseGeometry ¶
ParseGeometry parses a Geometry from a given text.
func ParseGeometryFromEWKB ¶
ParseGeometryFromEWKB parses the EWKB into a Geometry.
func ParseGeometryFromEWKBAndSRID ¶
ParseGeometryFromEWKBAndSRID parses the EWKB into a given Geometry with the given SRID set.
func ParseGeometryFromEWKBUnsafe ¶
ParseGeometryFromEWKBUnsafe returns a new Geometry from an EWKB, without any SRID checks. You should only do this if you trust the EWKB is setup correctly. You most likely want geo.ParseGeometryFromEWKB instead.
func ParseGeometryFromEWKT ¶
func ParseGeometryFromEWKT( ewkt geopb.EWKT, srid geopb.SRID, defaultSRIDOverwriteSetting defaultSRIDOverwriteSetting, ) (Geometry, error)
ParseGeometryFromEWKT parses the EWKT into a Geometry.
func ParseGeometryFromGeoJSON ¶
ParseGeometryFromGeoJSON parses the GeoJSON into a given Geometry.
func ParseGeometryPointFromGeoHash ¶
ParseGeometryPointFromGeoHash converts a GeoHash to a Geometry Point using a Lng/Lat Point representation of the GeoHash.
func (*Geometry) AsGeography ¶
AsGeography converts a given Geometry to its Geography form.
func (*Geometry) CartesianBoundingBox ¶
func (g *Geometry) CartesianBoundingBox() *CartesianBoundingBox
CartesianBoundingBox returns a Cartesian bounding box.
func (*Geometry) CloneWithSRID ¶
CloneWithSRID sets a given Geometry's SRID to another, without any transformations. Returns a new Geometry object.
func (*Geometry) Compare ¶
Compare compares a Geometry against another. It compares using SpaceCurveIndex, followed by the byte representation of the Geometry. This must produce the same ordering as the index mechanism.
func (*Geometry) SpaceCurveIndex ¶
SpaceCurveIndex returns an uint64 index to use representing an index into a space-filling curve. This will return 0 for empty spatial objects, and math.MaxUint64 for any object outside the defined bounds of the given SRID projection.
func (*Geometry) SpatialObject ¶
func (g *Geometry) SpatialObject() geopb.SpatialObject
SpatialObject returns the SpatialObject representation of the Geometry.
func (*Geometry) SpatialObjectRef ¶
func (g *Geometry) SpatialObjectRef() *geopb.SpatialObject
SpatialObjectRef return a pointer to the SpatialObject representation of the Geometry.
type SpatialObjectToGeoJSONFlag ¶
type SpatialObjectToGeoJSONFlag int
SpatialObjectToGeoJSONFlag maps to the ST_AsGeoJSON flags for PostGIS.
const ( SpatialObjectToGeoJSONFlagIncludeBBox SpatialObjectToGeoJSONFlag = 1 << (iota) SpatialObjectToGeoJSONFlagShortCRS SpatialObjectToGeoJSONFlagLongCRS SpatialObjectToGeoJSONFlagShortCRSIfNot4326 SpatialObjectToGeoJSONFlagZero = 0 )
These should be kept with ST_AsGeoJSON in PostGIS. 0: means no option 1: GeoJSON BBOX 2: GeoJSON Short CRS (e.g EPSG:4326) 4: GeoJSON Long CRS (e.g urn:ogc:def:crs:EPSG::4326) 8: GeoJSON Short CRS if not EPSG:4326 (default)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package geographiclib is a wrapper around the GeographicLib library.
|
Package geographiclib is a wrapper around the GeographicLib library. |
Package geoprojbase is a minimal dependency package that contains basic metadata and data structures for SRIDs and their CRS transformations.
|
Package geoprojbase is a minimal dependency package that contains basic metadata and data structures for SRIDs and their CRS transformations. |
Package geos is a wrapper around the spatial data types between the geo package and the GEOS C library.
|
Package geos is a wrapper around the spatial data types between the geo package and the GEOS C library. |