Documentation ¶
Index ¶
- func DouglasPeucker(path *geo.Path, threshold float64) *geo.Path
- func DouglasPeuckerGeoIndexMap(path *geo.Path, meters float64) (reduced *geo.Path, indexMap []int)
- func DouglasPeuckerIndexMap(path *geo.Path, threshold float64) (reduced *geo.Path, indexMap []int)
- func MergeIndexMaps(map1, map2 []int) []int
- func Radial(path *geo.Path, meters float64) *geo.Path
- func RadialGeo(path *geo.Path, meters float64) *geo.Path
- func RadialGeoIndexMap(path *geo.Path, meters float64) (*geo.Path, []int)
- func RadialIndexMap(path *geo.Path, meters float64) (*geo.Path, []int)
- func Visvalingam(path *geo.Path, threshold float64, minPointsToKeep int) *geo.Path
- func VisvalingamKeep(path *geo.Path, toKeep int) *geo.Path
- func VisvalingamThreshold(path *geo.Path, threshold float64) *geo.Path
- type DouglasPeuckerReducer
- type RadialGeoReducer
- type RadialReducer
- type VisvalingamReducer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DouglasPeucker ¶
func DouglasPeucker(path *geo.Path, threshold float64) *geo.Path
DouglasPeucker simplifies the path using the Douglas Peucker method. Returns a new path and DOES NOT modify the original.
func DouglasPeuckerGeoIndexMap ¶
DouglasPeuckerGeoIndexMap is similar to GeoReduce but returns an array that maps each new path index to its original path index. Returns a new path and DOES NOT modify the original.
func DouglasPeuckerIndexMap ¶
DouglasPeuckerIndexMap is similar to DouglasPeucker but returns an array that maps each new path index to its original path index. Returns a new path and DOES NOT modify the original.
func MergeIndexMaps ¶
MergeIndexMaps merges two index maps for use when chaining reducers. For example, to radially reduce and then DP, merge the index maps with this function to get a map from the original to the final path.
func Radial ¶
func Radial(path *geo.Path, meters float64) *geo.Path
Radial peforms a radial distance polyline simplification using a standard euclidean distance. Returns a new path and DOES NOT modify the original.
func RadialGeo ¶
func RadialGeo(path *geo.Path, meters float64) *geo.Path
RadialGeo peforms a radial distance polyline simplification using the GeoDistance. ie. the path points must be lng/lat points otherwise the behavior of this function is undefined. Returns a new path and DOES NOT modify the original.
func RadialGeoIndexMap ¶
RadialGeoIndexMap is similar to RadialGeo but returns an array that maps each new path index to its original path index. Returns a new path and DOES NOT modify the original.
func RadialIndexMap ¶
RadialIndexMap is similar to Radial but returns an array that maps each new path index to its original path index. Returns a new path and DOES NOT modify the original.
func Visvalingam ¶
Visvalingam computes the Visvalingam-Whyatt on the polyline. Returns a new path and DOES NOT modify the original.
Threshold is the max triangle area to keep around, ie. remove all triangles below this threshold. minPointsToKeep is the minimum number of points in the line.
To just use the threshold, set minPointsToKeep to zero To just use minPointsToKeep, set the threshold to something big like math.MaxFloat64
func VisvalingamKeep ¶
func VisvalingamKeep(path *geo.Path, toKeep int) *geo.Path
VisvalingamKeep runs the Visvalingam-Whyatt algorithm removing triangles of minimum area until we're down to `toKeep` number of points. Returns a new path and DOES NOT modify the original.
func VisvalingamThreshold ¶
func VisvalingamThreshold(path *geo.Path, threshold float64) *geo.Path
VisvalingamThreshold runs the Visvalingam-Whyatt algorithm removing triangles whose area is below the threshold. This function is here to simplify the interface. Returns a new path and DOES NOT modify the original.
Types ¶
type DouglasPeuckerReducer ¶
type DouglasPeuckerReducer struct {
Threshold float64
}
A DouglasPeuckerReducer wraps the DouglasPeucker function to fulfill the geo.Reducer and geo.GeoReducer interfaces.
func NewDouglasPeucker ¶
func NewDouglasPeucker(threshold float64) *DouglasPeuckerReducer
NewDouglasPeucker creates a new DouglasPeuckerReducer.
func (DouglasPeuckerReducer) GeoReduce ¶
func (r DouglasPeuckerReducer) GeoReduce(path *geo.Path) *geo.Path
GeoReduce runs the DouglasPeucker on a lng/lat path. The threshold is expected to be in meters.
func (DouglasPeuckerReducer) Reduce ¶
func (r DouglasPeuckerReducer) Reduce(path *geo.Path) *geo.Path
Reduce runs the DouglasPeucker using the threshold of the DouglasPeuckerReducer.
type RadialGeoReducer ¶
type RadialGeoReducer struct {
Threshold float64 // meters
}
A RadialGeoReducer wraps the RadialGeo function to fulfill the geo.Reducer and geo.GeoReducer interfaces.
func NewRadialGeoReducer ¶
func NewRadialGeoReducer(meters float64) *RadialGeoReducer
NewRadialGeoReducer creates a new RadialGeoReducer. This reducer should be used with EPSG:4326 (lng/lat) paths.
func (RadialGeoReducer) GeoReduce ¶
func (r RadialGeoReducer) GeoReduce(path *geo.Path) *geo.Path
GeoReduce runs the RadialGeo reduction. The path should be in lng/lat (EPSG:4326). The threshold is expected to be in meters.
func (RadialGeoReducer) Reduce ¶
func (r RadialGeoReducer) Reduce(path *geo.Path) *geo.Path
Reduce runs the RadialGeo reduction using the threshold of the RadialGeoReducer. The threshold is expected to be in meters.
type RadialReducer ¶
type RadialReducer struct {
Threshold float64 // euclidean distance
}
A RadialReducer wraps the Radial function to fulfill the geo.Reducer and geo.GeoReducer interfaces.
func NewRadialReducer ¶
func NewRadialReducer(threshold float64) *RadialReducer
NewRadialReducer creates a new RadialReducer.
func (RadialReducer) GeoReduce ¶
func (r RadialReducer) GeoReduce(path *geo.Path) *geo.Path
GeoReduce runs the RadialGeo reduction. The path should be in lng/lat (EPSG:4326). The threshold is expected to be in meters.
func (RadialReducer) Reduce ¶
func (r RadialReducer) Reduce(path *geo.Path) *geo.Path
Reduce runs the Radial reduction using the threshold of the RadialReducer.
type VisvalingamReducer ¶
A VisvalingamReducer wraps the Visvalingam function to fulfill the geo.Reducer and geo.GeoReducer interfaces.
func NewVisvalingamReducer ¶
func NewVisvalingamReducer(threshold float64, minPointsToKeep int) *VisvalingamReducer
NewVisvalingamReducer creates a new VisvalingamReducer.
func (VisvalingamReducer) GeoReduce ¶
func (r VisvalingamReducer) GeoReduce(path *geo.Path) *geo.Path
GeoReduce runs the Visvalingam reduction on a lng/lat path. The threshold is expected to be in meters squared.
func (VisvalingamReducer) Reduce ¶
func (r VisvalingamReducer) Reduce(path *geo.Path) *geo.Path
Reduce runs the Visvalingam reduction using the values of the Visvalingam.