Documentation

Index

Constants

View Source
const HiPrecision = 0.000000001

HiPrecision is a high precision for comparator

Variables

View Source
var (
	NilPoint           = (*geom.Point)(nil)
	NilMultiPoint      = (*geom.MultiPoint)(nil)
	NilLineString      = (*geom.LineString)(nil)
	NilMultiLineString = (*geom.MultiLineString)(nil)
	NilPoly            = (*geom.Polygon)(nil)
	NilMultiPoly       = (*geom.MultiPolygon)(nil)
	NilCollection      = (*geom.Collection)(nil)
)
View Source
var BitTolerance = DefaultCompare().BitTolerance

BitTolerance is only here for compability reasons

View Source
var HiCMP = New(HiPrecision)

HiCMP is a high precision comparator

View Source
var Tolerance = DefaultCompare().Tolerance

Tolerance is only here for compability reasons

Functions

func BitToleranceFor

func BitToleranceFor(tol float64) int64

BitToleranceFor returns the BitToleranceFor the given tolerance

func CollectionerEqual

func CollectionerEqual(col1, col2 geom.Collectioner) bool

CollectionerEqual will check if the two collections are equal based on length then if each geometry inside is equal. Therefor order matters.

func Extent

func Extent(extent1, extent2 [4]float64) bool

Extent will check to see if the Extents's are the same.

func FindMinIdx

func FindMinIdx(ln Lesser) (min int)

FindMinIdx given a slice will return the min index accourding to the Less function.

func FindMinPointIdx

func FindMinPointIdx(ln [][2]float64) (min int)

FindMinPointIdx given a slice of points, it will return the index to the smallest point according to XYLessPoint

func Float

func Float(f1, f2 float64) bool

Float compares two floats to see if they are within 0.00001 from each other. This is the best way to compare floats.

func Float64

func Float64(f1, f2, tolerance float64, bitTolerance int64) bool

Float64 compares two floats to see if they are within the given tolerance.

func Float64Slice

func Float64Slice(f1, f2 []float64, tolerance float64, bitTolerance int64) bool

Float64Slice compares two sets of float64 slices within the given tolerance.

func FloatSlice

func FloatSlice(f1, f2 []float64) bool

FloatSlice compare two sets of float slices.

func GeomExtent

func GeomExtent(extent1, extent2 geom.Extenter) bool

GeomExtent will check to see if geom.BoundingBox's are the same.

func GeomPointEqual

func GeomPointEqual(p1, p2 geom.Point) bool

GeomPointEqual returns weather both points have the same value for x,y.

func GeometryEqual

func GeometryEqual(g1, g2 geom.Geometry) bool

GeometryEqual checks if the two geometries are of the same type and then calls the type method to check if they are equal

func IsEmptyGeo

func IsEmptyGeo(geo geom.Geometry) (isEmpty bool, err error)

func IsEmptyLines

func IsEmptyLines(lns [][][2]float64) bool

func IsEmptyPoint

func IsEmptyPoint(pt [2]float64) bool

func IsEmptyPoints

func IsEmptyPoints(pts [][2]float64) bool

func IsNil

func IsNil(a interface{}) bool

func LineStringEqual

func LineStringEqual(v1, v2 [][2]float64) bool

LineStringEqual given two LineStrings it will check to see if the line strings have the same points in the same order.

func LineStringerEqual

func LineStringerEqual(geo1, geo2 geom.LineStringer) bool

LineStringerEqual will check to see if the two linestrings passed to it are equal, if there lengths are both the same, and the sequence of points are in the same order. The points don't have to be in the same index point in both line strings.

func MultiLineEqual

func MultiLineEqual(ml1, ml2 [][][2]float64) bool

MultiLineEqual will return if the two multilines are equal.

func MultiLineStringerEqual

func MultiLineStringerEqual(geo1, geo2 geom.MultiLineStringer) bool

MultiLineStringerEqual will check to see if the 2 MultiLineStrings pass to it are equal. This is done by converting them to lineStrings and using MultiLineEqual

func MultiPointEqual

func MultiPointEqual(p1, p2 [][2]float64) bool

MultiPointEqual will check to see see if the given slices are the same.

func MultiPointerEqual

func MultiPointerEqual(geo1, geo2 geom.MultiPointer) bool

MultiPointerEqual will check to see if the provided multipoints have the same points.

func MultiPolygonerEqual

func MultiPolygonerEqual(geo1, geo2 geom.MultiPolygoner) bool

MultiPolygonerEqual will check to see if the given multipolygoners are the same, by check each of the constitute polygons to see if they match.

func PointEqual

func PointEqual(p1, p2 [2]float64) bool

PointEqual returns weather both points have the same value for x,y.

func PointLess

func PointLess(p1, p2 [2]float64) bool

PointLess returns weather p1 is < p2 by first comparing the X values, and if they are the same the Y values.

func PointerEqual

func PointerEqual(geo1, geo2 geom.Pointer) bool

PointerEqual will check to see if the x and y of both points are the same.

func PointerLess

func PointerLess(p1, p2 geom.Pointer) bool

PointerLess returns weather p1 is < p2 by first comparing the X values, and if they are the same the Y values.

func PolygonEqual

func PolygonEqual(ply1, ply2 [][][2]float64) bool

PolygonEqual will return weather the two polygons are the same.

func PolygonerEqual

func PolygonerEqual(geo1, geo2 geom.Polygoner) bool

PolygonerEqual will check to see if the Polygoners are the same, by checking if the linearRings are equal.

func RotateToIdx

func RotateToIdx(idx int, ln [][2]float64)

RotateToIdx modifies the ln to be rotated by idx

func RotateToLeftMostPoint

func RotateToLeftMostPoint(ln [][2]float64)

RotateToLeftMostPoint will rotate the points in the linestring so that the smallest point (as defined by XYLessPoint) is the first point in the linestring.

func Tolerances

func Tolerances() (float64, int64)

Tolerances returns the default tolerance values

func XYLessPoint

func XYLessPoint(pt1, pt2 [2]float64) bool

XYLessPoint compares the x then y points to see if pt1 is less than pt2

Types

type ByXY

type ByXY [][2]float64

func (ByXY) Len

func (xy ByXY) Len() int

func (ByXY) Less

func (xy ByXY) Less(i, j int) bool

func (ByXY) Swap

func (xy ByXY) Swap(i, j int)

type Compare

type Compare struct {
	// Tolerance is the epsilon value used in comparing floats with zero
	Tolerance float64
	// BitTolerance is the epsilon value for comaparing float bit-patterns.
	BitTolerance int64
}

Compare holds the tolerances for the comparsion functions

func DefaultCompare

func DefaultCompare() Compare

DefaultCompare returns the current default compare

func New

func New(tolerance float64) Compare

New returns a new Compare object for the tolerance level, with a computed BitTolerance value

func NewForNumPrecision

func NewForNumPrecision(prec int) Compare

NewForNumPrecision will return a comparator with the given number of precision digits

func SetDefault

func SetDefault(cmp Compare) Compare

SetDefault will set the default for the package.

func (Compare) CollectionerEqual

func (cmp Compare) CollectionerEqual(col1, col2 geom.Collectioner) bool

CollectionerEqual will check if the two collections are equal based on length then if each geometry inside is equal. Therefor order matters.

func (Compare) Extent

func (cmp Compare) Extent(extent1, extent2 [4]float64) bool

Extent will check to see if the Extents's are the same.

func (Compare) Float

func (cmp Compare) Float(f1, f2 float64) bool

Float compares two floats to see if they are within the cmp tolerance of each other

func (Compare) FloatSlice

func (cmp Compare) FloatSlice(f1, f2 []float64) bool

FloatSlice compares two sets of float64 slices within the given tolerance.

func (Compare) GeomExtent

func (cmp Compare) GeomExtent(extent1, extent2 geom.Extenter) bool

GeomExtent will check to see if geom.BoundingBox's are the same.

func (Compare) GeomPointEqual

func (cmp Compare) GeomPointEqual(p1, p2 geom.Point) bool

GeomPointEqual returns weather both points have the same value for x,y.

func (Compare) GeometryEqual

func (cmp Compare) GeometryEqual(g1, g2 geom.Geometry) bool

GeometryEqual checks if the two geometries are of the same type and then calls the type method to check if they are equal

func (Compare) LineEqual

func (cmp Compare) LineEqual(ln1, ln2 geom.Line) bool

LineEqual will check to see if the two lines passed to it are equal: 1. start points are equal 2. end points are equal

func (Compare) LineStringEqual

func (cmp Compare) LineStringEqual(v1, v2 [][2]float64) bool

LineStringEqual given two LineStrings it will check to see if the line strings have the same points in the same order.

func (Compare) LineStringerEqual

func (cmp Compare) LineStringerEqual(geo1, geo2 geom.LineStringer) bool

LineStringerEqual will check to see if the two linestrings passed to it are equal: 1. lengths of both the same 2. the sequence of points are in the same order. The points don't have to be in the same index point in both line strings.

func (Compare) MultiLineEqual

func (cmp Compare) MultiLineEqual(ml1, ml2 [][][2]float64) bool

MultiLineEqual will return if the two multilines are equal.

func (Compare) MultiLineStringerEqual

func (cmp Compare) MultiLineStringerEqual(geo1, geo2 geom.MultiLineStringer) bool

MultiLineStringerEqual will check to see if the 2 MultiLineStrings pass to it are equal. This is done by converting them to lineStrings and using MultiLineEqual

func (Compare) MultiPointEqual

func (cmp Compare) MultiPointEqual(p1, p2 [][2]float64) bool

MultiPointEqual will check to see see if the given slices are the same.

func (Compare) MultiPointerEqual

func (cmp Compare) MultiPointerEqual(geo1, geo2 geom.MultiPointer) bool

MultiPointerEqual will check to see if the provided multipoints have the same points.

func (Compare) MultiPolygonerEqual

func (cmp Compare) MultiPolygonerEqual(geo1, geo2 geom.MultiPolygoner) bool

MultiPolygonerEqual will check to see if the given multipolygoners are the same, by check each of the constitute polygons to see if they match.

func (Compare) PointEqual

func (cmp Compare) PointEqual(p1, p2 [2]float64) bool

PointEqual returns weather both points have the same value for x,y.

func (Compare) PointLess

func (cmp Compare) PointLess(p1, p2 [2]float64) bool

PointLess returns weather p1 is < p2 by first comparing the X values, and if they are the same the Y values.

func (Compare) PointerEqual

func (cmp Compare) PointerEqual(geo1, geo2 geom.Pointer) bool

PointerEqual will check to see if the x and y of both points are the same.

func (Compare) PointerLess

func (cmp Compare) PointerLess(p1, p2 geom.Pointer) bool

PointerLess returns weather p1 is < p2 by first comparing the X values, and if they are the same the Y values.

func (Compare) PolygonEqual

func (cmp Compare) PolygonEqual(ply1, ply2 [][][2]float64) bool

PolygonEqual will return weather the two polygons are the same.

func (Compare) PolygonerEqual

func (cmp Compare) PolygonerEqual(geo1, geo2 geom.Polygoner) bool

PolygonerEqual will check to see if the Polygoners are the same, by checking if the linearRings are equal.

func (Compare) Tolerances

func (cmp Compare) Tolerances() (float64, int64)

Tolerances returns the tolerances of the comparator

type Lesser

type Lesser interface {
	// Is the number of elements in an Element
	Len() int

	// Less reports whether the element with
	// index i should sort before the element with index j.
	Less(i, j int) bool
}

Lesser used to check if the object is less than

type PointByXY

type PointByXY []geom.Point

func (PointByXY) Len

func (xy PointByXY) Len() int

func (PointByXY) Less

func (xy PointByXY) Less(i, j int) bool

func (PointByXY) Swap

func (xy PointByXY) Swap(i, j int)