id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
29,000
paulmach/orb
geojson/bbox.go
Valid
func (bb BBox) Valid() bool { if bb == nil { return false } return len(bb) >= 4 && len(bb)%2 == 0 }
go
func (bb BBox) Valid() bool { if bb == nil { return false } return len(bb) >= 4 && len(bb)%2 == 0 }
[ "func", "(", "bb", "BBox", ")", "Valid", "(", ")", "bool", "{", "if", "bb", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "return", "len", "(", "bb", ")", ">=", "4", "&&", "len", "(", "bb", ")", "%", "2", "==", "0", "\n", "}" ]
// Valid checks if the bbox is present and has at least 4 elements.
[ "Valid", "checks", "if", "the", "bbox", "is", "present", "and", "has", "at", "least", "4", "elements", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/bbox.go#L18-L24
29,001
paulmach/orb
geojson/bbox.go
Bound
func (bb BBox) Bound() orb.Bound { if !bb.Valid() { return orb.Bound{} } mid := len(bb) / 2 return orb.Bound{ Min: orb.Point{bb[0], bb[1]}, Max: orb.Point{bb[mid], bb[mid+1]}, } }
go
func (bb BBox) Bound() orb.Bound { if !bb.Valid() { return orb.Bound{} } mid := len(bb) / 2 return orb.Bound{ Min: orb.Point{bb[0], bb[1]}, Max: orb.Point{bb[mid], bb[mid+1]}, } }
[ "func", "(", "bb", "BBox", ")", "Bound", "(", ")", "orb", ".", "Bound", "{", "if", "!", "bb", ".", "Valid", "(", ")", "{", "return", "orb", ".", "Bound", "{", "}", "\n", "}", "\n\n", "mid", ":=", "len", "(", "bb", ")", "/", "2", "\n\n", "re...
// Bound returns the orb.Bound for the BBox.
[ "Bound", "returns", "the", "orb", ".", "Bound", "for", "the", "BBox", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/bbox.go#L27-L38
29,002
paulmach/orb
encoding/mvt/simplify.go
Simplify
func (ls Layers) Simplify(s orb.Simplifier) { for _, l := range ls { l.Simplify(s) } }
go
func (ls Layers) Simplify(s orb.Simplifier) { for _, l := range ls { l.Simplify(s) } }
[ "func", "(", "ls", "Layers", ")", "Simplify", "(", "s", "orb", ".", "Simplifier", ")", "{", "for", "_", ",", "l", ":=", "range", "ls", "{", "l", ".", "Simplify", "(", "s", ")", "\n", "}", "\n", "}" ]
// Simplify will run all the geometry of all the layers through the provided simplifer.
[ "Simplify", "will", "run", "all", "the", "geometry", "of", "all", "the", "layers", "through", "the", "provided", "simplifer", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/simplify.go#L9-L13
29,003
paulmach/orb
encoding/mvt/simplify.go
Simplify
func (l *Layer) Simplify(s orb.Simplifier) { count := 0 for _, f := range l.Features { g := s.Simplify(f.Geometry) if g == nil { continue } f.Geometry = g l.Features[count] = f count++ } l.Features = l.Features[:count] }
go
func (l *Layer) Simplify(s orb.Simplifier) { count := 0 for _, f := range l.Features { g := s.Simplify(f.Geometry) if g == nil { continue } f.Geometry = g l.Features[count] = f count++ } l.Features = l.Features[:count] }
[ "func", "(", "l", "*", "Layer", ")", "Simplify", "(", "s", "orb", ".", "Simplifier", ")", "{", "count", ":=", "0", "\n", "for", "_", ",", "f", ":=", "range", "l", ".", "Features", "{", "g", ":=", "s", ".", "Simplify", "(", "f", ".", "Geometry",...
// Simplify will run the layer geometries through the simplifier.
[ "Simplify", "will", "run", "the", "layer", "geometries", "through", "the", "simplifier", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/simplify.go#L16-L30
29,004
paulmach/orb
quadtree/quadtree.go
Add
func (q *Quadtree) Add(p orb.Pointer) error { if p == nil { return nil } point := p.Point() if !q.bound.Contains(point) { return ErrPointOutsideOfBounds } if q.root == nil { q.root = &node{ Value: p, } return nil } q.add(q.root, p, p.Point(), // q.bound.Left(), q.bound.Right(), // q.bound.Bo...
go
func (q *Quadtree) Add(p orb.Pointer) error { if p == nil { return nil } point := p.Point() if !q.bound.Contains(point) { return ErrPointOutsideOfBounds } if q.root == nil { q.root = &node{ Value: p, } return nil } q.add(q.root, p, p.Point(), // q.bound.Left(), q.bound.Right(), // q.bound.Bo...
[ "func", "(", "q", "*", "Quadtree", ")", "Add", "(", "p", "orb", ".", "Pointer", ")", "error", "{", "if", "p", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "point", ":=", "p", ".", "Point", "(", ")", "\n", "if", "!", "q", ".", "bound"...
// Add puts an object into the quad tree, must be within the quadtree bounds. // This function is not thread-safe, ie. multiple goroutines cannot insert into // a single quadtree.
[ "Add", "puts", "an", "object", "into", "the", "quad", "tree", "must", "be", "within", "the", "quadtree", "bounds", ".", "This", "function", "is", "not", "thread", "-", "safe", "ie", ".", "multiple", "goroutines", "cannot", "insert", "into", "a", "single", ...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/quadtree/quadtree.go#L53-L78
29,005
paulmach/orb
quadtree/quadtree.go
add
func (q *Quadtree) add(n *node, p orb.Pointer, point orb.Point, left, right, bottom, top float64) { i := 0 // figure which child of this internal node the point is in. if cy := (bottom + top) / 2.0; point[1] <= cy { top = cy i = 2 } else { bottom = cy } if cx := (left + right) / 2.0; point[0] >= cx { le...
go
func (q *Quadtree) add(n *node, p orb.Pointer, point orb.Point, left, right, bottom, top float64) { i := 0 // figure which child of this internal node the point is in. if cy := (bottom + top) / 2.0; point[1] <= cy { top = cy i = 2 } else { bottom = cy } if cx := (left + right) / 2.0; point[0] >= cx { le...
[ "func", "(", "q", "*", "Quadtree", ")", "add", "(", "n", "*", "node", ",", "p", "orb", ".", "Pointer", ",", "point", "orb", ".", "Point", ",", "left", ",", "right", ",", "bottom", ",", "top", "float64", ")", "{", "i", ":=", "0", "\n\n", "// fig...
// add is the recursive search to find a place to add the point
[ "add", "is", "the", "recursive", "search", "to", "find", "a", "place", "to", "add", "the", "point" ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/quadtree/quadtree.go#L81-L106
29,006
paulmach/orb
quadtree/quadtree.go
removeNode
func removeNode(n *node) { var i int for { i = -1 if n.Children[0] != nil { i = 0 } else if n.Children[1] != nil { i = 1 } else if n.Children[2] != nil { i = 2 } else if n.Children[3] != nil { i = 3 } if i == -1 { n.Value = nil return } if n.Children[i].Value == nil { n.Childr...
go
func removeNode(n *node) { var i int for { i = -1 if n.Children[0] != nil { i = 0 } else if n.Children[1] != nil { i = 1 } else if n.Children[2] != nil { i = 2 } else if n.Children[3] != nil { i = 3 } if i == -1 { n.Value = nil return } if n.Children[i].Value == nil { n.Childr...
[ "func", "removeNode", "(", "n", "*", "node", ")", "{", "var", "i", "int", "\n", "for", "{", "i", "=", "-", "1", "\n", "if", "n", ".", "Children", "[", "0", "]", "!=", "nil", "{", "i", "=", "0", "\n", "}", "else", "if", "n", ".", "Children",...
// removeNode is the recursive fixing up of the tree when we remove a node.
[ "removeNode", "is", "the", "recursive", "fixing", "up", "of", "the", "tree", "when", "we", "remove", "a", "node", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/quadtree/quadtree.go#L146-L175
29,007
paulmach/orb
quadtree/quadtree.go
InBoundMatching
func (q *Quadtree) InBoundMatching(buf []orb.Pointer, b orb.Bound, f FilterFunc) []orb.Pointer { if q.root == nil { return nil } var p []orb.Pointer if len(buf) > 0 { p = buf[:0] } v := &inBoundVisitor{ bound: &b, pointers: p, filter: f, } newVisit(v).Visit(q.root, // q.bound.Left(), q.bound....
go
func (q *Quadtree) InBoundMatching(buf []orb.Pointer, b orb.Bound, f FilterFunc) []orb.Pointer { if q.root == nil { return nil } var p []orb.Pointer if len(buf) > 0 { p = buf[:0] } v := &inBoundVisitor{ bound: &b, pointers: p, filter: f, } newVisit(v).Visit(q.root, // q.bound.Left(), q.bound....
[ "func", "(", "q", "*", "Quadtree", ")", "InBoundMatching", "(", "buf", "[", "]", "orb", ".", "Pointer", ",", "b", "orb", ".", "Bound", ",", "f", "FilterFunc", ")", "[", "]", "orb", ".", "Pointer", "{", "if", "q", ".", "root", "==", "nil", "{", ...
// InBoundMatching returns a slice with all the pointers in the quadtree that are // within the given bound and matching the give filter function. An optional buffer // parameter is provided to allow for the reuse of result slice memory. This function // is thread safe. Multiple goroutines can read from a pre-created ...
[ "InBoundMatching", "returns", "a", "slice", "with", "all", "the", "pointers", "in", "the", "quadtree", "that", "are", "within", "the", "given", "bound", "and", "matching", "the", "give", "filter", "function", ".", "An", "optional", "buffer", "parameter", "is",...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/quadtree/quadtree.go#L274-L297
29,008
paulmach/orb
planar/contains.go
RingContains
func RingContains(r orb.Ring, point orb.Point) bool { if !r.Bound().Contains(point) { return false } c, on := rayIntersect(point, r[0], r[len(r)-1]) if on { return true } for i := 0; i < len(r)-1; i++ { inter, on := rayIntersect(point, r[i], r[i+1]) if on { return true } if inter { c = !c }...
go
func RingContains(r orb.Ring, point orb.Point) bool { if !r.Bound().Contains(point) { return false } c, on := rayIntersect(point, r[0], r[len(r)-1]) if on { return true } for i := 0; i < len(r)-1; i++ { inter, on := rayIntersect(point, r[i], r[i+1]) if on { return true } if inter { c = !c }...
[ "func", "RingContains", "(", "r", "orb", ".", "Ring", ",", "point", "orb", ".", "Point", ")", "bool", "{", "if", "!", "r", ".", "Bound", "(", ")", ".", "Contains", "(", "point", ")", "{", "return", "false", "\n", "}", "\n\n", "c", ",", "on", ":...
// RingContains returns true if the point is inside the ring. // Points on the boundary are considered in.
[ "RingContains", "returns", "true", "if", "the", "point", "is", "inside", "the", "ring", ".", "Points", "on", "the", "boundary", "are", "considered", "in", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/planar/contains.go#L11-L33
29,009
paulmach/orb
planar/contains.go
PolygonContains
func PolygonContains(p orb.Polygon, point orb.Point) bool { if !RingContains(p[0], point) { return false } for i := 1; i < len(p); i++ { if RingContains(p[i], point) { return false } } return true }
go
func PolygonContains(p orb.Polygon, point orb.Point) bool { if !RingContains(p[0], point) { return false } for i := 1; i < len(p); i++ { if RingContains(p[i], point) { return false } } return true }
[ "func", "PolygonContains", "(", "p", "orb", ".", "Polygon", ",", "point", "orb", ".", "Point", ")", "bool", "{", "if", "!", "RingContains", "(", "p", "[", "0", "]", ",", "point", ")", "{", "return", "false", "\n", "}", "\n\n", "for", "i", ":=", "...
// PolygonContains checks if the point is within the polygon. // Points on the boundary are considered in.
[ "PolygonContains", "checks", "if", "the", "point", "is", "within", "the", "polygon", ".", "Points", "on", "the", "boundary", "are", "considered", "in", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/planar/contains.go#L37-L49
29,010
paulmach/orb
planar/contains.go
MultiPolygonContains
func MultiPolygonContains(mp orb.MultiPolygon, point orb.Point) bool { for _, p := range mp { if PolygonContains(p, point) { return true } } return false }
go
func MultiPolygonContains(mp orb.MultiPolygon, point orb.Point) bool { for _, p := range mp { if PolygonContains(p, point) { return true } } return false }
[ "func", "MultiPolygonContains", "(", "mp", "orb", ".", "MultiPolygon", ",", "point", "orb", ".", "Point", ")", "bool", "{", "for", "_", ",", "p", ":=", "range", "mp", "{", "if", "PolygonContains", "(", "p", ",", "point", ")", "{", "return", "true", "...
// MultiPolygonContains checks if the point is within the multi-polygon. // Points on the boundary are considered in.
[ "MultiPolygonContains", "checks", "if", "the", "point", "is", "within", "the", "multi", "-", "polygon", ".", "Points", "on", "the", "boundary", "are", "considered", "in", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/planar/contains.go#L53-L61
29,011
paulmach/orb
resample/line_string.go
Resample
func Resample(ls orb.LineString, df orb.DistanceFunc, totalPoints int) orb.LineString { if totalPoints <= 0 { return nil } ls, ret := resampleEdgeCases(ls, totalPoints) if ret { return ls } // precomputes the total distance and intermediate distances total, dists := precomputeDistances(ls, df) return resa...
go
func Resample(ls orb.LineString, df orb.DistanceFunc, totalPoints int) orb.LineString { if totalPoints <= 0 { return nil } ls, ret := resampleEdgeCases(ls, totalPoints) if ret { return ls } // precomputes the total distance and intermediate distances total, dists := precomputeDistances(ls, df) return resa...
[ "func", "Resample", "(", "ls", "orb", ".", "LineString", ",", "df", "orb", ".", "DistanceFunc", ",", "totalPoints", "int", ")", "orb", ".", "LineString", "{", "if", "totalPoints", "<=", "0", "{", "return", "nil", "\n", "}", "\n\n", "ls", ",", "ret", ...
// Resample converts the line string into totalPoints-1 evenly spaced segments. // This function will modify the linestring input.
[ "Resample", "converts", "the", "line", "string", "into", "totalPoints", "-", "1", "evenly", "spaced", "segments", ".", "This", "function", "will", "modify", "the", "linestring", "input", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/resample/line_string.go#L11-L24
29,012
paulmach/orb
resample/line_string.go
ToInterval
func ToInterval(ls orb.LineString, df orb.DistanceFunc, dist float64) orb.LineString { if dist <= 0 { return nil } // precomputes the total distance and intermediate distances total, dists := precomputeDistances(ls, df) totalPoints := int(total/dist) + 1 ls, ret := resampleEdgeCases(ls, totalPoints) if ret {...
go
func ToInterval(ls orb.LineString, df orb.DistanceFunc, dist float64) orb.LineString { if dist <= 0 { return nil } // precomputes the total distance and intermediate distances total, dists := precomputeDistances(ls, df) totalPoints := int(total/dist) + 1 ls, ret := resampleEdgeCases(ls, totalPoints) if ret {...
[ "func", "ToInterval", "(", "ls", "orb", ".", "LineString", ",", "df", "orb", ".", "DistanceFunc", ",", "dist", "float64", ")", "orb", ".", "LineString", "{", "if", "dist", "<=", "0", "{", "return", "nil", "\n", "}", "\n\n", "// precomputes the total distan...
// ToInterval coverts the line string into evenly spaced points of // about the given distance. // This function will modify the linestring input.
[ "ToInterval", "coverts", "the", "line", "string", "into", "evenly", "spaced", "points", "of", "about", "the", "given", "distance", ".", "This", "function", "will", "modify", "the", "linestring", "input", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/resample/line_string.go#L29-L44
29,013
paulmach/orb
resample/line_string.go
resampleEdgeCases
func resampleEdgeCases(ls orb.LineString, totalPoints int) (orb.LineString, bool) { // degenerate case if len(ls) <= 1 { return ls, true } // if all the points are the same, treat as special case. equal := true for _, point := range ls { if !ls[0].Equal(point) { equal = false break } } if equal { ...
go
func resampleEdgeCases(ls orb.LineString, totalPoints int) (orb.LineString, bool) { // degenerate case if len(ls) <= 1 { return ls, true } // if all the points are the same, treat as special case. equal := true for _, point := range ls { if !ls[0].Equal(point) { equal = false break } } if equal { ...
[ "func", "resampleEdgeCases", "(", "ls", "orb", ".", "LineString", ",", "totalPoints", "int", ")", "(", "orb", ".", "LineString", ",", "bool", ")", "{", "// degenerate case", "if", "len", "(", "ls", ")", "<=", "1", "{", "return", "ls", ",", "true", "\n"...
// resampleEdgeCases is used to handle edge case for // resampling like not enough points and the line string is all the same point. // will return nil if there are no edge cases. If return true if // one of these edge cases was found and handled.
[ "resampleEdgeCases", "is", "used", "to", "handle", "edge", "case", "for", "resampling", "like", "not", "enough", "points", "and", "the", "line", "string", "is", "all", "the", "same", "point", ".", "will", "return", "nil", "if", "there", "are", "no", "edge"...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/resample/line_string.go#L95-L126
29,014
paulmach/orb
encoding/wkb/wkb.go
MustMarshal
func MustMarshal(geom orb.Geometry, byteOrder ...binary.ByteOrder) []byte { d, err := Marshal(geom, byteOrder...) if err != nil { panic(err) } return d }
go
func MustMarshal(geom orb.Geometry, byteOrder ...binary.ByteOrder) []byte { d, err := Marshal(geom, byteOrder...) if err != nil { panic(err) } return d }
[ "func", "MustMarshal", "(", "geom", "orb", ".", "Geometry", ",", "byteOrder", "...", "binary", ".", "ByteOrder", ")", "[", "]", "byte", "{", "d", ",", "err", ":=", "Marshal", "(", "geom", ",", "byteOrder", "...", ")", "\n", "if", "err", "!=", "nil", ...
// MustMarshal will encode the geometry and panic on error. // Currently there is no reason to error during geometry marshalling.
[ "MustMarshal", "will", "encode", "the", "geometry", "and", "panic", "on", "error", ".", "Currently", "there", "is", "no", "reason", "to", "error", "during", "geometry", "marshalling", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/wkb/wkb.go#L45-L52
29,015
paulmach/orb
encoding/wkb/wkb.go
Marshal
func Marshal(geom orb.Geometry, byteOrder ...binary.ByteOrder) ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0, geomLength(geom))) e := NewEncoder(buf) if len(byteOrder) > 0 { e.SetByteOrder(byteOrder[0]) } err := e.Encode(geom) if err != nil { return nil, err } if buf.Len() == 0 { return nil,...
go
func Marshal(geom orb.Geometry, byteOrder ...binary.ByteOrder) ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0, geomLength(geom))) e := NewEncoder(buf) if len(byteOrder) > 0 { e.SetByteOrder(byteOrder[0]) } err := e.Encode(geom) if err != nil { return nil, err } if buf.Len() == 0 { return nil,...
[ "func", "Marshal", "(", "geom", "orb", ".", "Geometry", ",", "byteOrder", "...", "binary", ".", "ByteOrder", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "buf", ":=", "bytes", ".", "NewBuffer", "(", "make", "(", "[", "]", "byte", ",", "0", ...
// Marshal encodes the geometry with the given byte order.
[ "Marshal", "encodes", "the", "geometry", "with", "the", "given", "byte", "order", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/wkb/wkb.go#L55-L74
29,016
paulmach/orb
encoding/wkb/wkb.go
NewEncoder
func NewEncoder(w io.Writer) *Encoder { return &Encoder{ w: w, order: DefaultByteOrder, } }
go
func NewEncoder(w io.Writer) *Encoder { return &Encoder{ w: w, order: DefaultByteOrder, } }
[ "func", "NewEncoder", "(", "w", "io", ".", "Writer", ")", "*", "Encoder", "{", "return", "&", "Encoder", "{", "w", ":", "w", ",", "order", ":", "DefaultByteOrder", ",", "}", "\n", "}" ]
// NewEncoder creates a new Encoder for the given writer
[ "NewEncoder", "creates", "a", "new", "Encoder", "for", "the", "given", "writer" ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/wkb/wkb.go#L77-L82
29,017
paulmach/orb
encoding/wkb/wkb.go
Encode
func (e *Encoder) Encode(geom orb.Geometry) error { if geom == nil { return nil } switch g := geom.(type) { // nil values should not write any data. Empty sizes will still // write and empty version of that type. case orb.MultiPoint: if g == nil { return nil } case orb.LineString: if g == nil { re...
go
func (e *Encoder) Encode(geom orb.Geometry) error { if geom == nil { return nil } switch g := geom.(type) { // nil values should not write any data. Empty sizes will still // write and empty version of that type. case orb.MultiPoint: if g == nil { return nil } case orb.LineString: if g == nil { re...
[ "func", "(", "e", "*", "Encoder", ")", "Encode", "(", "geom", "orb", ".", "Geometry", ")", "error", "{", "if", "geom", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "switch", "g", ":=", "geom", ".", "(", "type", ")", "{", "// nil values sho...
// Encode will write the geometry encoded as WKB to the given writer.
[ "Encode", "will", "write", "the", "geometry", "encoded", "as", "WKB", "to", "the", "given", "writer", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/wkb/wkb.go#L91-L167
29,018
paulmach/orb
encoding/wkb/wkb.go
Unmarshal
func Unmarshal(b []byte) (orb.Geometry, error) { g, err := NewDecoder(bytes.NewReader(b)).Decode() if err == io.EOF || err == io.ErrUnexpectedEOF { return nil, ErrNotWKB } return g, err }
go
func Unmarshal(b []byte) (orb.Geometry, error) { g, err := NewDecoder(bytes.NewReader(b)).Decode() if err == io.EOF || err == io.ErrUnexpectedEOF { return nil, ErrNotWKB } return g, err }
[ "func", "Unmarshal", "(", "b", "[", "]", "byte", ")", "(", "orb", ".", "Geometry", ",", "error", ")", "{", "g", ",", "err", ":=", "NewDecoder", "(", "bytes", ".", "NewReader", "(", "b", ")", ")", ".", "Decode", "(", ")", "\n", "if", "err", "=="...
// Unmarshal will decode the type into a Geometry.
[ "Unmarshal", "will", "decode", "the", "type", "into", "a", "Geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/wkb/wkb.go#L175-L182
29,019
paulmach/orb
encoding/wkb/wkb.go
Decode
func (d *Decoder) Decode() (orb.Geometry, error) { byteOrder, typ, err := readByteOrderType(d.r) if err != nil { return nil, err } switch typ { case pointType: return readPoint(d.r, byteOrder) case multiPointType: return readMultiPoint(d.r, byteOrder) case lineStringType: return readLineString(d.r, byte...
go
func (d *Decoder) Decode() (orb.Geometry, error) { byteOrder, typ, err := readByteOrderType(d.r) if err != nil { return nil, err } switch typ { case pointType: return readPoint(d.r, byteOrder) case multiPointType: return readMultiPoint(d.r, byteOrder) case lineStringType: return readLineString(d.r, byte...
[ "func", "(", "d", "*", "Decoder", ")", "Decode", "(", ")", "(", "orb", ".", "Geometry", ",", "error", ")", "{", "byteOrder", ",", "typ", ",", "err", ":=", "readByteOrderType", "(", "d", ".", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return"...
// Decode will decode the next geometry off of the steam.
[ "Decode", "will", "decode", "the", "next", "geometry", "off", "of", "the", "steam", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/wkb/wkb.go#L192-L216
29,020
paulmach/orb
encoding/wkb/wkb.go
geomLength
func geomLength(geom orb.Geometry) int { switch g := geom.(type) { case orb.Point: return 21 case orb.MultiPoint: return 9 + 21*len(g) case orb.LineString: return 9 + 16*len(g) case orb.MultiLineString: sum := 0 for _, ls := range g { sum += 9 + 16*len(ls) } return 9 + sum case orb.Polygon: su...
go
func geomLength(geom orb.Geometry) int { switch g := geom.(type) { case orb.Point: return 21 case orb.MultiPoint: return 9 + 21*len(g) case orb.LineString: return 9 + 16*len(g) case orb.MultiLineString: sum := 0 for _, ls := range g { sum += 9 + 16*len(ls) } return 9 + sum case orb.Polygon: su...
[ "func", "geomLength", "(", "geom", "orb", ".", "Geometry", ")", "int", "{", "switch", "g", ":=", "geom", ".", "(", "type", ")", "{", "case", "orb", ".", "Point", ":", "return", "21", "\n", "case", "orb", ".", "MultiPoint", ":", "return", "9", "+", ...
// geomLength helps to do preallocation during a marshal.
[ "geomLength", "helps", "to", "do", "preallocation", "during", "a", "marshal", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/wkb/wkb.go#L247-L286
29,021
paulmach/orb
geojson/geometry.go
NewGeometry
func NewGeometry(g orb.Geometry) *Geometry { jg := &Geometry{} switch g := g.(type) { case orb.Ring: jg.Coordinates = orb.Polygon{g} case orb.Bound: jg.Coordinates = g.ToPolygon() case orb.Collection: for _, c := range g { jg.Geometries = append(jg.Geometries, NewGeometry(c)) } jg.Type = g.GeoJSONType...
go
func NewGeometry(g orb.Geometry) *Geometry { jg := &Geometry{} switch g := g.(type) { case orb.Ring: jg.Coordinates = orb.Polygon{g} case orb.Bound: jg.Coordinates = g.ToPolygon() case orb.Collection: for _, c := range g { jg.Geometries = append(jg.Geometries, NewGeometry(c)) } jg.Type = g.GeoJSONType...
[ "func", "NewGeometry", "(", "g", "orb", ".", "Geometry", ")", "*", "Geometry", "{", "jg", ":=", "&", "Geometry", "{", "}", "\n", "switch", "g", ":=", "g", ".", "(", "type", ")", "{", "case", "orb", ".", "Ring", ":", "jg", ".", "Coordinates", "=",...
// NewGeometry will create a Geometry object but will convert // the input into a GoeJSON geometry. For example, it will convert // Rings and Bounds into Polygons.
[ "NewGeometry", "will", "create", "a", "Geometry", "object", "but", "will", "convert", "the", "input", "into", "a", "GoeJSON", "geometry", ".", "For", "example", "it", "will", "convert", "Rings", "and", "Bounds", "into", "Polygons", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/geometry.go#L20-L40
29,022
paulmach/orb
geojson/geometry.go
Geometry
func (g Geometry) Geometry() orb.Geometry { if g.Coordinates != nil { return g.Coordinates } c := make(orb.Collection, 0, len(g.Geometries)) for _, geom := range g.Geometries { c = append(c, geom.Geometry()) } return c }
go
func (g Geometry) Geometry() orb.Geometry { if g.Coordinates != nil { return g.Coordinates } c := make(orb.Collection, 0, len(g.Geometries)) for _, geom := range g.Geometries { c = append(c, geom.Geometry()) } return c }
[ "func", "(", "g", "Geometry", ")", "Geometry", "(", ")", "orb", ".", "Geometry", "{", "if", "g", ".", "Coordinates", "!=", "nil", "{", "return", "g", ".", "Coordinates", "\n", "}", "\n\n", "c", ":=", "make", "(", "orb", ".", "Collection", ",", "0",...
// Geometry returns the orb.Geometry for the geojson Geometry. // This will convert the "Geometries" into a orb.Collection if applicable.
[ "Geometry", "returns", "the", "orb", ".", "Geometry", "for", "the", "geojson", "Geometry", ".", "This", "will", "convert", "the", "Geometries", "into", "a", "orb", ".", "Collection", "if", "applicable", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/geometry.go#L44-L54
29,023
paulmach/orb
geojson/geometry.go
MarshalJSON
func (g Geometry) MarshalJSON() ([]byte, error) { if g.Coordinates == nil && len(g.Geometries) == 0 { return []byte(`null`), nil } ng := &jsonGeometryMarshall{} switch g := g.Coordinates.(type) { case orb.Ring: ng.Coordinates = orb.Polygon{g} case orb.Bound: ng.Coordinates = g.ToPolygon() case orb.Collect...
go
func (g Geometry) MarshalJSON() ([]byte, error) { if g.Coordinates == nil && len(g.Geometries) == 0 { return []byte(`null`), nil } ng := &jsonGeometryMarshall{} switch g := g.Coordinates.(type) { case orb.Ring: ng.Coordinates = orb.Polygon{g} case orb.Bound: ng.Coordinates = g.ToPolygon() case orb.Collect...
[ "func", "(", "g", "Geometry", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "g", ".", "Coordinates", "==", "nil", "&&", "len", "(", "g", ".", "Geometries", ")", "==", "0", "{", "return", "[", "]", "byte", "(...
// MarshalJSON will marshal the geometry into the correct json structure.
[ "MarshalJSON", "will", "marshal", "the", "geometry", "into", "the", "correct", "json", "structure", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/geometry.go#L57-L87
29,024
paulmach/orb
geojson/geometry.go
UnmarshalJSON
func (g *Geometry) UnmarshalJSON(data []byte) error { jg := &jsonGeometry{} err := json.Unmarshal(data, &jg) if err != nil { return err } switch jg.Type { case "Point": p := orb.Point{} err = json.Unmarshal(jg.Coordinates, &p) g.Coordinates = p case "MultiPoint": mp := orb.MultiPoint{} err = json.Unm...
go
func (g *Geometry) UnmarshalJSON(data []byte) error { jg := &jsonGeometry{} err := json.Unmarshal(data, &jg) if err != nil { return err } switch jg.Type { case "Point": p := orb.Point{} err = json.Unmarshal(jg.Coordinates, &p) g.Coordinates = p case "MultiPoint": mp := orb.MultiPoint{} err = json.Unm...
[ "func", "(", "g", "*", "Geometry", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "jg", ":=", "&", "jsonGeometry", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "jg", ")", "\n", "if", "err"...
// UnmarshalJSON will unmarshal the correct geometry from the json structure.
[ "UnmarshalJSON", "will", "unmarshal", "the", "correct", "geometry", "from", "the", "json", "structure", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/geometry.go#L102-L140
29,025
paulmach/orb
geojson/geometry.go
MarshalJSON
func (mp MultiPoint) MarshalJSON() ([]byte, error) { return json.Marshal(Geometry{Coordinates: orb.MultiPoint(mp)}) }
go
func (mp MultiPoint) MarshalJSON() ([]byte, error) { return json.Marshal(Geometry{Coordinates: orb.MultiPoint(mp)}) }
[ "func", "(", "mp", "MultiPoint", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "Geometry", "{", "Coordinates", ":", "orb", ".", "MultiPoint", "(", "mp", ")", "}", ")", "\n", "}" ...
// MarshalJSON will convert the MultiPoint into a GeoJSON MultiPoint geometry.
[ "MarshalJSON", "will", "convert", "the", "MultiPoint", "into", "a", "GeoJSON", "MultiPoint", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/geometry.go#L181-L183
29,026
paulmach/orb
geojson/geometry.go
MarshalJSON
func (ls LineString) MarshalJSON() ([]byte, error) { return json.Marshal(Geometry{Coordinates: orb.LineString(ls)}) }
go
func (ls LineString) MarshalJSON() ([]byte, error) { return json.Marshal(Geometry{Coordinates: orb.LineString(ls)}) }
[ "func", "(", "ls", "LineString", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "Geometry", "{", "Coordinates", ":", "orb", ".", "LineString", "(", "ls", ")", "}", ")", "\n", "}" ...
// MarshalJSON will convert the LineString into a GeoJSON LineString geometry.
[ "MarshalJSON", "will", "convert", "the", "LineString", "into", "a", "GeoJSON", "LineString", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/geometry.go#L211-L213
29,027
paulmach/orb
geojson/geometry.go
MarshalJSON
func (mls MultiLineString) MarshalJSON() ([]byte, error) { return json.Marshal(Geometry{Coordinates: orb.MultiLineString(mls)}) }
go
func (mls MultiLineString) MarshalJSON() ([]byte, error) { return json.Marshal(Geometry{Coordinates: orb.MultiLineString(mls)}) }
[ "func", "(", "mls", "MultiLineString", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "Geometry", "{", "Coordinates", ":", "orb", ".", "MultiLineString", "(", "mls", ")", "}", ")", ...
// MarshalJSON will convert the MultiLineString into a GeoJSON MultiLineString geometry.
[ "MarshalJSON", "will", "convert", "the", "MultiLineString", "into", "a", "GeoJSON", "MultiLineString", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/geometry.go#L241-L243
29,028
paulmach/orb
geojson/geometry.go
MarshalJSON
func (p Polygon) MarshalJSON() ([]byte, error) { return json.Marshal(Geometry{Coordinates: orb.Polygon(p)}) }
go
func (p Polygon) MarshalJSON() ([]byte, error) { return json.Marshal(Geometry{Coordinates: orb.Polygon(p)}) }
[ "func", "(", "p", "Polygon", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "Geometry", "{", "Coordinates", ":", "orb", ".", "Polygon", "(", "p", ")", "}", ")", "\n", "}" ]
// MarshalJSON will convert the Polygon into a GeoJSON Polygon geometry.
[ "MarshalJSON", "will", "convert", "the", "Polygon", "into", "a", "GeoJSON", "Polygon", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/geometry.go#L271-L273
29,029
paulmach/orb
geojson/geometry.go
UnmarshalJSON
func (p *Polygon) UnmarshalJSON(data []byte) error { g := &Geometry{} err := json.Unmarshal(data, &g) if err != nil { return err } polygon, ok := g.Coordinates.(orb.Polygon) if !ok { return errors.New("geojson: not a Polygon type") } *p = Polygon(polygon) return nil }
go
func (p *Polygon) UnmarshalJSON(data []byte) error { g := &Geometry{} err := json.Unmarshal(data, &g) if err != nil { return err } polygon, ok := g.Coordinates.(orb.Polygon) if !ok { return errors.New("geojson: not a Polygon type") } *p = Polygon(polygon) return nil }
[ "func", "(", "p", "*", "Polygon", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "g", ":=", "&", "Geometry", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "g", ")", "\n", "if", "err", "!=...
// UnmarshalJSON will unmarshal the GeoJSON Polygon geometry.
[ "UnmarshalJSON", "will", "unmarshal", "the", "GeoJSON", "Polygon", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/geometry.go#L276-L290
29,030
paulmach/orb
clip/clip.go
ring
func ring(box orb.Bound, in orb.Ring) orb.Ring { var out orb.Ring if len(in) == 0 { return in } f := in[0] l := in[len(in)-1] initClosed := false if f == l { initClosed = true } for edge := 1; edge <= 8; edge <<= 1 { out = out[:0] loopTo := len(in) // if we're not a nice closed ring, don't impli...
go
func ring(box orb.Bound, in orb.Ring) orb.Ring { var out orb.Ring if len(in) == 0 { return in } f := in[0] l := in[len(in)-1] initClosed := false if f == l { initClosed = true } for edge := 1; edge <= 8; edge <<= 1 { out = out[:0] loopTo := len(in) // if we're not a nice closed ring, don't impli...
[ "func", "ring", "(", "box", "orb", ".", "Bound", ",", "in", "orb", ".", "Ring", ")", "orb", ".", "Ring", "{", "var", "out", "orb", ".", "Ring", "\n", "if", "len", "(", "in", ")", "==", "0", "{", "return", "in", "\n", "}", "\n\n", "f", ":=", ...
// ring will clip the Ring into a smaller ring around the bounding box boundary.
[ "ring", "will", "clip", "the", "Ring", "into", "a", "smaller", "ring", "around", "the", "bounding", "box", "boundary", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/clip.go#L85-L150
29,031
paulmach/orb
clip/clip.go
intersect
func intersect(box orb.Bound, edge int, a, b orb.Point) orb.Point { if edge&8 != 0 { // top return orb.Point{a[0] + (b[0]-a[0])*(box.Max[1]-a[1])/(b[1]-a[1]), box.Max[1]} } else if edge&4 != 0 { // bottom return orb.Point{a[0] + (b[0]-a[0])*(box.Min[1]-a[1])/(b[1]-a[1]), box.Min[1]} } else if edge&2 != 0 { ...
go
func intersect(box orb.Bound, edge int, a, b orb.Point) orb.Point { if edge&8 != 0 { // top return orb.Point{a[0] + (b[0]-a[0])*(box.Max[1]-a[1])/(b[1]-a[1]), box.Max[1]} } else if edge&4 != 0 { // bottom return orb.Point{a[0] + (b[0]-a[0])*(box.Min[1]-a[1])/(b[1]-a[1]), box.Min[1]} } else if edge&2 != 0 { ...
[ "func", "intersect", "(", "box", "orb", ".", "Bound", ",", "edge", "int", ",", "a", ",", "b", "orb", ".", "Point", ")", "orb", ".", "Point", "{", "if", "edge", "&", "8", "!=", "0", "{", "// top", "return", "orb", ".", "Point", "{", "a", "[", ...
// intersect a segment against one of the 4 lines that make up the bbox
[ "intersect", "a", "segment", "against", "one", "of", "the", "4", "lines", "that", "make", "up", "the", "bbox" ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/clip.go#L192-L208
29,032
paulmach/orb
simplify/visvalingam.go
Visvalingam
func Visvalingam(threshold float64, minPointsToKeep int) *VisvalingamSimplifier { return &VisvalingamSimplifier{ Threshold: threshold, ToKeep: minPointsToKeep, } }
go
func Visvalingam(threshold float64, minPointsToKeep int) *VisvalingamSimplifier { return &VisvalingamSimplifier{ Threshold: threshold, ToKeep: minPointsToKeep, } }
[ "func", "Visvalingam", "(", "threshold", "float64", ",", "minPointsToKeep", "int", ")", "*", "VisvalingamSimplifier", "{", "return", "&", "VisvalingamSimplifier", "{", "Threshold", ":", "threshold", ",", "ToKeep", ":", "minPointsToKeep", ",", "}", "\n", "}" ]
// Visvalingam creates a new VisvalingamSimplifier.
[ "Visvalingam", "creates", "a", "new", "VisvalingamSimplifier", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/simplify/visvalingam.go#L19-L24
29,033
paulmach/orb
multi_point.go
Clone
func (mp MultiPoint) Clone() MultiPoint { if mp == nil { return nil } points := make([]Point, len(mp)) copy(points, mp) return MultiPoint(points) }
go
func (mp MultiPoint) Clone() MultiPoint { if mp == nil { return nil } points := make([]Point, len(mp)) copy(points, mp) return MultiPoint(points) }
[ "func", "(", "mp", "MultiPoint", ")", "Clone", "(", ")", "MultiPoint", "{", "if", "mp", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "points", ":=", "make", "(", "[", "]", "Point", ",", "len", "(", "mp", ")", ")", "\n", "copy", "(", "p...
// Clone returns a new copy of the points.
[ "Clone", "returns", "a", "new", "copy", "of", "the", "points", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_point.go#L17-L26
29,034
paulmach/orb
multi_point.go
Bound
func (mp MultiPoint) Bound() Bound { if len(mp) == 0 { return emptyBound } b := Bound{mp[0], mp[0]} for _, p := range mp { b = b.Extend(p) } return b }
go
func (mp MultiPoint) Bound() Bound { if len(mp) == 0 { return emptyBound } b := Bound{mp[0], mp[0]} for _, p := range mp { b = b.Extend(p) } return b }
[ "func", "(", "mp", "MultiPoint", ")", "Bound", "(", ")", "Bound", "{", "if", "len", "(", "mp", ")", "==", "0", "{", "return", "emptyBound", "\n", "}", "\n\n", "b", ":=", "Bound", "{", "mp", "[", "0", "]", ",", "mp", "[", "0", "]", "}", "\n", ...
// Bound returns a bound around the points. Uses rectangular coordinates.
[ "Bound", "returns", "a", "bound", "around", "the", "points", ".", "Uses", "rectangular", "coordinates", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_point.go#L29-L40
29,035
paulmach/orb
multi_point.go
Equal
func (mp MultiPoint) Equal(multiPoint MultiPoint) bool { if len(mp) != len(multiPoint) { return false } for i := range mp { if !mp[i].Equal(multiPoint[i]) { return false } } return true }
go
func (mp MultiPoint) Equal(multiPoint MultiPoint) bool { if len(mp) != len(multiPoint) { return false } for i := range mp { if !mp[i].Equal(multiPoint[i]) { return false } } return true }
[ "func", "(", "mp", "MultiPoint", ")", "Equal", "(", "multiPoint", "MultiPoint", ")", "bool", "{", "if", "len", "(", "mp", ")", "!=", "len", "(", "multiPoint", ")", "{", "return", "false", "\n", "}", "\n\n", "for", "i", ":=", "range", "mp", "{", "if...
// Equal compares two MultiPoint objects. Returns true if lengths are the same // and all points are Equal, and in the same order.
[ "Equal", "compares", "two", "MultiPoint", "objects", ".", "Returns", "true", "if", "lengths", "are", "the", "same", "and", "all", "points", "are", "Equal", "and", "in", "the", "same", "order", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_point.go#L44-L56
29,036
paulmach/orb
ring.go
Orientation
func (r Ring) Orientation() Orientation { area := 0.0 // This is a fast planar area computation, which is okay for this use. // implicitly move everything to near the origin to help with roundoff offsetX := r[0][0] offsetY := r[0][1] for i := 1; i < len(r)-1; i++ { area += (r[i][0]-offsetX)*(r[i+1][1]-offsetY)...
go
func (r Ring) Orientation() Orientation { area := 0.0 // This is a fast planar area computation, which is okay for this use. // implicitly move everything to near the origin to help with roundoff offsetX := r[0][0] offsetY := r[0][1] for i := 1; i < len(r)-1; i++ { area += (r[i][0]-offsetX)*(r[i+1][1]-offsetY)...
[ "func", "(", "r", "Ring", ")", "Orientation", "(", ")", "Orientation", "{", "area", ":=", "0.0", "\n\n", "// This is a fast planar area computation, which is okay for this use.", "// implicitly move everything to near the origin to help with roundoff", "offsetX", ":=", "r", "["...
// Orientation returns 1 if the the ring is in couter-clockwise order, // return -1 if the ring is the clockwise order and 0 if the ring is // degenerate and had no area.
[ "Orientation", "returns", "1", "if", "the", "the", "ring", "is", "in", "couter", "-", "clockwise", "order", "return", "-", "1", "if", "the", "ring", "is", "the", "clockwise", "order", "and", "0", "if", "the", "ring", "is", "degenerate", "and", "had", "...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/ring.go#L38-L60
29,037
paulmach/orb
ring.go
Equal
func (r Ring) Equal(ring Ring) bool { return MultiPoint(r).Equal(MultiPoint(ring)) }
go
func (r Ring) Equal(ring Ring) bool { return MultiPoint(r).Equal(MultiPoint(ring)) }
[ "func", "(", "r", "Ring", ")", "Equal", "(", "ring", "Ring", ")", "bool", "{", "return", "MultiPoint", "(", "r", ")", ".", "Equal", "(", "MultiPoint", "(", "ring", ")", ")", "\n", "}" ]
// Equal compares two rings. Returns true if lengths are the same // and all points are Equal.
[ "Equal", "compares", "two", "rings", ".", "Returns", "true", "if", "lengths", "are", "the", "same", "and", "all", "points", "are", "Equal", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/ring.go#L64-L66
29,038
paulmach/orb
ring.go
Clone
func (r Ring) Clone() Ring { if r == nil { return nil } ps := MultiPoint(r) return Ring(ps.Clone()) }
go
func (r Ring) Clone() Ring { if r == nil { return nil } ps := MultiPoint(r) return Ring(ps.Clone()) }
[ "func", "(", "r", "Ring", ")", "Clone", "(", ")", "Ring", "{", "if", "r", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "ps", ":=", "MultiPoint", "(", "r", ")", "\n", "return", "Ring", "(", "ps", ".", "Clone", "(", ")", ")", "\n", "}"...
// Clone returns a new copy of the ring.
[ "Clone", "returns", "a", "new", "copy", "of", "the", "ring", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/ring.go#L69-L76
29,039
paulmach/orb
geojson/properties.go
Clone
func (p Properties) Clone() Properties { n := make(Properties, len(p)) for k, v := range p { n[k] = v } return n }
go
func (p Properties) Clone() Properties { n := make(Properties, len(p)) for k, v := range p { n[k] = v } return n }
[ "func", "(", "p", "Properties", ")", "Clone", "(", ")", "Properties", "{", "n", ":=", "make", "(", "Properties", ",", "len", "(", "p", ")", ")", "\n", "for", "k", ",", "v", ":=", "range", "p", "{", "n", "[", "k", "]", "=", "v", "\n", "}", "...
// Clone returns a shallow copy of the properties.
[ "Clone", "returns", "a", "shallow", "copy", "of", "the", "properties", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/properties.go#L105-L112
29,040
paulmach/orb
planar/distance_from.go
DistanceFrom
func DistanceFrom(g orb.Geometry, p orb.Point) float64 { d, _ := DistanceFromWithIndex(g, p) return d }
go
func DistanceFrom(g orb.Geometry, p orb.Point) float64 { d, _ := DistanceFromWithIndex(g, p) return d }
[ "func", "DistanceFrom", "(", "g", "orb", ".", "Geometry", ",", "p", "orb", ".", "Point", ")", "float64", "{", "d", ",", "_", ":=", "DistanceFromWithIndex", "(", "g", ",", "p", ")", "\n", "return", "d", "\n", "}" ]
// DistanceFrom returns the distance from the boundary of the geometry in // the units of the geometry.
[ "DistanceFrom", "returns", "the", "distance", "from", "the", "boundary", "of", "the", "geometry", "in", "the", "units", "of", "the", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/planar/distance_from.go#L42-L45
29,041
paulmach/orb
planar/distance_from.go
DistanceFromWithIndex
func DistanceFromWithIndex(g orb.Geometry, p orb.Point) (float64, int) { if g == nil { return math.Inf(1), -1 } switch g := g.(type) { case orb.Point: return Distance(g, p), 0 case orb.MultiPoint: return multiPointDistanceFrom(g, p) case orb.LineString: return lineStringDistanceFrom(g, p) case orb.Multi...
go
func DistanceFromWithIndex(g orb.Geometry, p orb.Point) (float64, int) { if g == nil { return math.Inf(1), -1 } switch g := g.(type) { case orb.Point: return Distance(g, p), 0 case orb.MultiPoint: return multiPointDistanceFrom(g, p) case orb.LineString: return lineStringDistanceFrom(g, p) case orb.Multi...
[ "func", "DistanceFromWithIndex", "(", "g", "orb", ".", "Geometry", ",", "p", "orb", ".", "Point", ")", "(", "float64", ",", "int", ")", "{", "if", "g", "==", "nil", "{", "return", "math", ".", "Inf", "(", "1", ")", ",", "-", "1", "\n", "}", "\n...
// DistanceFromWithIndex returns the minimum euclidean distance // from the boundary of the geometry plus the index of the sub-geometry // that was the match.
[ "DistanceFromWithIndex", "returns", "the", "minimum", "euclidean", "distance", "from", "the", "boundary", "of", "the", "geometry", "plus", "the", "index", "of", "the", "sub", "-", "geometry", "that", "was", "the", "match", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/planar/distance_from.go#L50-L104
29,042
paulmach/orb
point.go
Equal
func (p Point) Equal(point Point) bool { return p[0] == point[0] && p[1] == point[1] }
go
func (p Point) Equal(point Point) bool { return p[0] == point[0] && p[1] == point[1] }
[ "func", "(", "p", "Point", ")", "Equal", "(", "point", "Point", ")", "bool", "{", "return", "p", "[", "0", "]", "==", "point", "[", "0", "]", "&&", "p", "[", "1", "]", "==", "point", "[", "1", "]", "\n", "}" ]
// Equal checks if the point represents the same point or vector.
[ "Equal", "checks", "if", "the", "point", "represents", "the", "same", "point", "or", "vector", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/point.go#L49-L51
29,043
paulmach/orb
project/helpers.go
Geometry
func Geometry(g orb.Geometry, proj orb.Projection) orb.Geometry { if g == nil { return nil } switch g := g.(type) { case orb.Point: return Point(g, proj) case orb.MultiPoint: return MultiPoint(g, proj) case orb.LineString: return LineString(g, proj) case orb.MultiLineString: return MultiLineString(g, ...
go
func Geometry(g orb.Geometry, proj orb.Projection) orb.Geometry { if g == nil { return nil } switch g := g.(type) { case orb.Point: return Point(g, proj) case orb.MultiPoint: return MultiPoint(g, proj) case orb.LineString: return LineString(g, proj) case orb.MultiLineString: return MultiLineString(g, ...
[ "func", "Geometry", "(", "g", "orb", ".", "Geometry", ",", "proj", "orb", ".", "Projection", ")", "orb", ".", "Geometry", "{", "if", "g", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "switch", "g", ":=", "g", ".", "(", "type", ")", "{", ...
// Geometry is a helper to project any geomtry.
[ "Geometry", "is", "a", "helper", "to", "project", "any", "geomtry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/project/helpers.go#L8-L35
29,044
paulmach/orb
project/helpers.go
Point
func Point(p orb.Point, proj orb.Projection) orb.Point { return proj(p) }
go
func Point(p orb.Point, proj orb.Projection) orb.Point { return proj(p) }
[ "func", "Point", "(", "p", "orb", ".", "Point", ",", "proj", "orb", ".", "Projection", ")", "orb", ".", "Point", "{", "return", "proj", "(", "p", ")", "\n", "}" ]
// Point is a helper to project an a point
[ "Point", "is", "a", "helper", "to", "project", "an", "a", "point" ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/project/helpers.go#L38-L40
29,045
paulmach/orb
project/helpers.go
MultiPoint
func MultiPoint(mp orb.MultiPoint, proj orb.Projection) orb.MultiPoint { for i := range mp { mp[i] = proj(mp[i]) } return mp }
go
func MultiPoint(mp orb.MultiPoint, proj orb.Projection) orb.MultiPoint { for i := range mp { mp[i] = proj(mp[i]) } return mp }
[ "func", "MultiPoint", "(", "mp", "orb", ".", "MultiPoint", ",", "proj", "orb", ".", "Projection", ")", "orb", ".", "MultiPoint", "{", "for", "i", ":=", "range", "mp", "{", "mp", "[", "i", "]", "=", "proj", "(", "mp", "[", "i", "]", ")", "\n", "...
// MultiPoint is a helper to project an entire multi point.
[ "MultiPoint", "is", "a", "helper", "to", "project", "an", "entire", "multi", "point", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/project/helpers.go#L43-L49
29,046
paulmach/orb
project/helpers.go
LineString
func LineString(ls orb.LineString, proj orb.Projection) orb.LineString { return orb.LineString(MultiPoint(orb.MultiPoint(ls), proj)) }
go
func LineString(ls orb.LineString, proj orb.Projection) orb.LineString { return orb.LineString(MultiPoint(orb.MultiPoint(ls), proj)) }
[ "func", "LineString", "(", "ls", "orb", ".", "LineString", ",", "proj", "orb", ".", "Projection", ")", "orb", ".", "LineString", "{", "return", "orb", ".", "LineString", "(", "MultiPoint", "(", "orb", ".", "MultiPoint", "(", "ls", ")", ",", "proj", ")"...
// LineString is a helper to project an entire line string.
[ "LineString", "is", "a", "helper", "to", "project", "an", "entire", "line", "string", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/project/helpers.go#L52-L54
29,047
paulmach/orb
project/helpers.go
MultiLineString
func MultiLineString(mls orb.MultiLineString, proj orb.Projection) orb.MultiLineString { for i := range mls { mls[i] = LineString(mls[i], proj) } return mls }
go
func MultiLineString(mls orb.MultiLineString, proj orb.Projection) orb.MultiLineString { for i := range mls { mls[i] = LineString(mls[i], proj) } return mls }
[ "func", "MultiLineString", "(", "mls", "orb", ".", "MultiLineString", ",", "proj", "orb", ".", "Projection", ")", "orb", ".", "MultiLineString", "{", "for", "i", ":=", "range", "mls", "{", "mls", "[", "i", "]", "=", "LineString", "(", "mls", "[", "i", ...
// MultiLineString is a helper to project an entire multi linestring.
[ "MultiLineString", "is", "a", "helper", "to", "project", "an", "entire", "multi", "linestring", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/project/helpers.go#L57-L63
29,048
paulmach/orb
project/helpers.go
Ring
func Ring(r orb.Ring, proj orb.Projection) orb.Ring { return orb.Ring(LineString(orb.LineString(r), proj)) }
go
func Ring(r orb.Ring, proj orb.Projection) orb.Ring { return orb.Ring(LineString(orb.LineString(r), proj)) }
[ "func", "Ring", "(", "r", "orb", ".", "Ring", ",", "proj", "orb", ".", "Projection", ")", "orb", ".", "Ring", "{", "return", "orb", ".", "Ring", "(", "LineString", "(", "orb", ".", "LineString", "(", "r", ")", ",", "proj", ")", ")", "\n", "}" ]
// Ring is a helper to project an entire ring.
[ "Ring", "is", "a", "helper", "to", "project", "an", "entire", "ring", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/project/helpers.go#L66-L68
29,049
paulmach/orb
project/helpers.go
Polygon
func Polygon(p orb.Polygon, proj orb.Projection) orb.Polygon { for i := range p { p[i] = Ring(p[i], proj) } return p }
go
func Polygon(p orb.Polygon, proj orb.Projection) orb.Polygon { for i := range p { p[i] = Ring(p[i], proj) } return p }
[ "func", "Polygon", "(", "p", "orb", ".", "Polygon", ",", "proj", "orb", ".", "Projection", ")", "orb", ".", "Polygon", "{", "for", "i", ":=", "range", "p", "{", "p", "[", "i", "]", "=", "Ring", "(", "p", "[", "i", "]", ",", "proj", ")", "\n",...
// Polygon is a helper to project an entire polygon.
[ "Polygon", "is", "a", "helper", "to", "project", "an", "entire", "polygon", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/project/helpers.go#L71-L77
29,050
paulmach/orb
project/helpers.go
MultiPolygon
func MultiPolygon(mp orb.MultiPolygon, proj orb.Projection) orb.MultiPolygon { for i := range mp { mp[i] = Polygon(mp[i], proj) } return mp }
go
func MultiPolygon(mp orb.MultiPolygon, proj orb.Projection) orb.MultiPolygon { for i := range mp { mp[i] = Polygon(mp[i], proj) } return mp }
[ "func", "MultiPolygon", "(", "mp", "orb", ".", "MultiPolygon", ",", "proj", "orb", ".", "Projection", ")", "orb", ".", "MultiPolygon", "{", "for", "i", ":=", "range", "mp", "{", "mp", "[", "i", "]", "=", "Polygon", "(", "mp", "[", "i", "]", ",", ...
// MultiPolygon is a helper to project an entire multi polygon.
[ "MultiPolygon", "is", "a", "helper", "to", "project", "an", "entire", "multi", "polygon", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/project/helpers.go#L80-L86
29,051
paulmach/orb
project/helpers.go
Collection
func Collection(c orb.Collection, proj orb.Projection) orb.Collection { for i := range c { c[i] = Geometry(c[i], proj) } return c }
go
func Collection(c orb.Collection, proj orb.Projection) orb.Collection { for i := range c { c[i] = Geometry(c[i], proj) } return c }
[ "func", "Collection", "(", "c", "orb", ".", "Collection", ",", "proj", "orb", ".", "Projection", ")", "orb", ".", "Collection", "{", "for", "i", ":=", "range", "c", "{", "c", "[", "i", "]", "=", "Geometry", "(", "c", "[", "i", "]", ",", "proj", ...
// Collection is a helper to project a rectangle.
[ "Collection", "is", "a", "helper", "to", "project", "a", "rectangle", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/project/helpers.go#L89-L95
29,052
paulmach/orb
project/helpers.go
Bound
func Bound(bound orb.Bound, proj orb.Projection) orb.Bound { min := proj(bound.Min) return orb.Bound{Min: min, Max: min}.Extend(proj(bound.Max)) }
go
func Bound(bound orb.Bound, proj orb.Projection) orb.Bound { min := proj(bound.Min) return orb.Bound{Min: min, Max: min}.Extend(proj(bound.Max)) }
[ "func", "Bound", "(", "bound", "orb", ".", "Bound", ",", "proj", "orb", ".", "Projection", ")", "orb", ".", "Bound", "{", "min", ":=", "proj", "(", "bound", ".", "Min", ")", "\n", "return", "orb", ".", "Bound", "{", "Min", ":", "min", ",", "Max",...
// Bound is a helper to project a rectangle.
[ "Bound", "is", "a", "helper", "to", "project", "a", "rectangle", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/project/helpers.go#L98-L101
29,053
paulmach/orb
geojson/feature_collection.go
Append
func (fc *FeatureCollection) Append(feature *Feature) *FeatureCollection { fc.Features = append(fc.Features, feature) return fc }
go
func (fc *FeatureCollection) Append(feature *Feature) *FeatureCollection { fc.Features = append(fc.Features, feature) return fc }
[ "func", "(", "fc", "*", "FeatureCollection", ")", "Append", "(", "feature", "*", "Feature", ")", "*", "FeatureCollection", "{", "fc", ".", "Features", "=", "append", "(", "fc", ".", "Features", ",", "feature", ")", "\n", "return", "fc", "\n", "}" ]
// Append appends a feature to the collection.
[ "Append", "appends", "a", "feature", "to", "the", "collection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/feature_collection.go#L31-L34
29,054
paulmach/orb
multi_line_string.go
Bound
func (mls MultiLineString) Bound() Bound { if len(mls) == 0 { return emptyBound } bound := mls[0].Bound() for i := 1; i < len(mls); i++ { bound = bound.Union(mls[i].Bound()) } return bound }
go
func (mls MultiLineString) Bound() Bound { if len(mls) == 0 { return emptyBound } bound := mls[0].Bound() for i := 1; i < len(mls); i++ { bound = bound.Union(mls[i].Bound()) } return bound }
[ "func", "(", "mls", "MultiLineString", ")", "Bound", "(", ")", "Bound", "{", "if", "len", "(", "mls", ")", "==", "0", "{", "return", "emptyBound", "\n", "}", "\n\n", "bound", ":=", "mls", "[", "0", "]", ".", "Bound", "(", ")", "\n", "for", "i", ...
// Bound returns a bound around all the line strings.
[ "Bound", "returns", "a", "bound", "around", "all", "the", "line", "strings", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_line_string.go#L17-L28
29,055
paulmach/orb
multi_line_string.go
Equal
func (mls MultiLineString) Equal(multiLineString MultiLineString) bool { if len(mls) != len(multiLineString) { return false } for i, ls := range mls { if !ls.Equal(multiLineString[i]) { return false } } return true }
go
func (mls MultiLineString) Equal(multiLineString MultiLineString) bool { if len(mls) != len(multiLineString) { return false } for i, ls := range mls { if !ls.Equal(multiLineString[i]) { return false } } return true }
[ "func", "(", "mls", "MultiLineString", ")", "Equal", "(", "multiLineString", "MultiLineString", ")", "bool", "{", "if", "len", "(", "mls", ")", "!=", "len", "(", "multiLineString", ")", "{", "return", "false", "\n", "}", "\n\n", "for", "i", ",", "ls", ...
// Equal compares two multi line strings. Returns true if lengths are the same // and all points are Equal.
[ "Equal", "compares", "two", "multi", "line", "strings", ".", "Returns", "true", "if", "lengths", "are", "the", "same", "and", "all", "points", "are", "Equal", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_line_string.go#L32-L44
29,056
paulmach/orb
multi_line_string.go
Clone
func (mls MultiLineString) Clone() MultiLineString { if mls == nil { return nil } nmls := make(MultiLineString, 0, len(mls)) for _, ls := range mls { nmls = append(nmls, ls.Clone()) } return nmls }
go
func (mls MultiLineString) Clone() MultiLineString { if mls == nil { return nil } nmls := make(MultiLineString, 0, len(mls)) for _, ls := range mls { nmls = append(nmls, ls.Clone()) } return nmls }
[ "func", "(", "mls", "MultiLineString", ")", "Clone", "(", ")", "MultiLineString", "{", "if", "mls", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "nmls", ":=", "make", "(", "MultiLineString", ",", "0", ",", "len", "(", "mls", ")", ")", "\n", ...
// Clone returns a new deep copy of the multi line string.
[ "Clone", "returns", "a", "new", "deep", "copy", "of", "the", "multi", "line", "string", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_line_string.go#L47-L58
29,057
paulmach/orb
encoding/mvt/clip.go
Clip
func (ls Layers) Clip(box orb.Bound) { for _, l := range ls { l.Clip(box) } }
go
func (ls Layers) Clip(box orb.Bound) { for _, l := range ls { l.Clip(box) } }
[ "func", "(", "ls", "Layers", ")", "Clip", "(", "box", "orb", ".", "Bound", ")", "{", "for", "_", ",", "l", ":=", "range", "ls", "{", "l", ".", "Clip", "(", "box", ")", "\n", "}", "\n", "}" ]
// Clip will clip all geometries in all layers to the given bounds.
[ "Clip", "will", "clip", "all", "geometries", "in", "all", "layers", "to", "the", "given", "bounds", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/clip.go#L18-L22
29,058
paulmach/orb
encoding/mvt/clip.go
Clip
func (l *Layer) Clip(box orb.Bound) { for _, f := range l.Features { g := clip.Geometry(box, f.Geometry) f.Geometry = g } }
go
func (l *Layer) Clip(box orb.Bound) { for _, f := range l.Features { g := clip.Geometry(box, f.Geometry) f.Geometry = g } }
[ "func", "(", "l", "*", "Layer", ")", "Clip", "(", "box", "orb", ".", "Bound", ")", "{", "for", "_", ",", "f", ":=", "range", "l", ".", "Features", "{", "g", ":=", "clip", ".", "Geometry", "(", "box", ",", "f", ".", "Geometry", ")", "\n", "f",...
// Clip will clip all geometries in this layer to the given bounds.
[ "Clip", "will", "clip", "all", "geometries", "in", "this", "layer", "to", "the", "given", "bounds", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/clip.go#L25-L30
29,059
paulmach/orb
clip/smartclip/around_bound.go
aroundBound
func aroundBound( box orb.Bound, in orb.Ring, o orb.Orientation, ) orb.Ring { if o != orb.CCW && o != orb.CW { panic("invalid orientation") } if len(in) == 0 { return nil } next := nexts[o] f := in[0] l := in[len(in)-1] target := bitCodeOpen(box, f) current := bitCodeOpen(box, l) if target == 0 ||...
go
func aroundBound( box orb.Bound, in orb.Ring, o orb.Orientation, ) orb.Ring { if o != orb.CCW && o != orb.CW { panic("invalid orientation") } if len(in) == 0 { return nil } next := nexts[o] f := in[0] l := in[len(in)-1] target := bitCodeOpen(box, f) current := bitCodeOpen(box, l) if target == 0 ||...
[ "func", "aroundBound", "(", "box", "orb", ".", "Bound", ",", "in", "orb", ".", "Ring", ",", "o", "orb", ".", "Orientation", ",", ")", "orb", ".", "Ring", "{", "if", "o", "!=", "orb", ".", "CCW", "&&", "o", "!=", "orb", ".", "CW", "{", "panic", ...
// aroundBound will connect the endpoints of the linestring provided // by wrapping the line around the bounds in the direction provided. // Will append to the input.
[ "aroundBound", "will", "connect", "the", "endpoints", "of", "the", "linestring", "provided", "by", "wrapping", "the", "line", "around", "the", "bounds", "in", "the", "direction", "provided", ".", "Will", "append", "to", "the", "input", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/around_bound.go#L12-L84
29,060
paulmach/orb
clip/smartclip/around_bound.go
pointFor
func pointFor(b orb.Bound, code int) orb.Point { switch code { case 1: return orb.Point{b.Min[0], (b.Max[1] + b.Min[1]) / 2} case 2: return orb.Point{b.Max[0], (b.Max[1] + b.Min[1]) / 2} case 4: return orb.Point{(b.Max[0] + b.Min[0]) / 2, b.Min[1]} case 5: return orb.Point{b.Min[0], b.Min[1]} case 6: re...
go
func pointFor(b orb.Bound, code int) orb.Point { switch code { case 1: return orb.Point{b.Min[0], (b.Max[1] + b.Min[1]) / 2} case 2: return orb.Point{b.Max[0], (b.Max[1] + b.Min[1]) / 2} case 4: return orb.Point{(b.Max[0] + b.Min[0]) / 2, b.Min[1]} case 5: return orb.Point{b.Min[0], b.Min[1]} case 6: re...
[ "func", "pointFor", "(", "b", "orb", ".", "Bound", ",", "code", "int", ")", "orb", ".", "Point", "{", "switch", "code", "{", "case", "1", ":", "return", "orb", ".", "Point", "{", "b", ".", "Min", "[", "0", "]", ",", "(", "b", ".", "Max", "[",...
// pointFor returns a representative point for the side of the given bitCode.
[ "pointFor", "returns", "a", "representative", "point", "for", "the", "side", "of", "the", "given", "bitCode", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/around_bound.go#L110-L131
29,061
paulmach/orb
line_string.go
Reverse
func (ls LineString) Reverse() { l := len(ls) - 1 for i := 0; i <= l/2; i++ { ls[i], ls[l-i] = ls[l-i], ls[i] } }
go
func (ls LineString) Reverse() { l := len(ls) - 1 for i := 0; i <= l/2; i++ { ls[i], ls[l-i] = ls[l-i], ls[i] } }
[ "func", "(", "ls", "LineString", ")", "Reverse", "(", ")", "{", "l", ":=", "len", "(", "ls", ")", "-", "1", "\n", "for", "i", ":=", "0", ";", "i", "<=", "l", "/", "2", ";", "i", "++", "{", "ls", "[", "i", "]", ",", "ls", "[", "l", "-", ...
// Reverse will reverse the line string. // This is done inplace, ie. it modifies the original data.
[ "Reverse", "will", "reverse", "the", "line", "string", ".", "This", "is", "done", "inplace", "ie", ".", "it", "modifies", "the", "original", "data", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/line_string.go#L18-L23
29,062
paulmach/orb
line_string.go
Equal
func (ls LineString) Equal(lineString LineString) bool { return MultiPoint(ls).Equal(MultiPoint(lineString)) }
go
func (ls LineString) Equal(lineString LineString) bool { return MultiPoint(ls).Equal(MultiPoint(lineString)) }
[ "func", "(", "ls", "LineString", ")", "Equal", "(", "lineString", "LineString", ")", "bool", "{", "return", "MultiPoint", "(", "ls", ")", ".", "Equal", "(", "MultiPoint", "(", "lineString", ")", ")", "\n", "}" ]
// Equal compares two line strings. Returns true if lengths are the same // and all points are Equal.
[ "Equal", "compares", "two", "line", "strings", ".", "Returns", "true", "if", "lengths", "are", "the", "same", "and", "all", "points", "are", "Equal", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/line_string.go#L32-L34
29,063
paulmach/orb
line_string.go
Clone
func (ls LineString) Clone() LineString { ps := MultiPoint(ls) return LineString(ps.Clone()) }
go
func (ls LineString) Clone() LineString { ps := MultiPoint(ls) return LineString(ps.Clone()) }
[ "func", "(", "ls", "LineString", ")", "Clone", "(", ")", "LineString", "{", "ps", ":=", "MultiPoint", "(", "ls", ")", "\n", "return", "LineString", "(", "ps", ".", "Clone", "(", ")", ")", "\n", "}" ]
// Clone returns a new copy of the line string.
[ "Clone", "returns", "a", "new", "copy", "of", "the", "line", "string", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/line_string.go#L37-L40
29,064
paulmach/orb
geo/distance.go
Distance
func Distance(p1, p2 orb.Point) float64 { dLat := deg2rad(p1[1] - p2[1]) dLon := deg2rad(p1[0] - p2[0]) dLon = math.Abs(dLon) if dLon > math.Pi { dLon = 2*math.Pi - dLon } // fast way using pythagorean theorem on an equirectangular projection x := dLon * math.Cos(deg2rad((p1[1]+p2[1])/2.0)) return math.Sqrt...
go
func Distance(p1, p2 orb.Point) float64 { dLat := deg2rad(p1[1] - p2[1]) dLon := deg2rad(p1[0] - p2[0]) dLon = math.Abs(dLon) if dLon > math.Pi { dLon = 2*math.Pi - dLon } // fast way using pythagorean theorem on an equirectangular projection x := dLon * math.Cos(deg2rad((p1[1]+p2[1])/2.0)) return math.Sqrt...
[ "func", "Distance", "(", "p1", ",", "p2", "orb", ".", "Point", ")", "float64", "{", "dLat", ":=", "deg2rad", "(", "p1", "[", "1", "]", "-", "p2", "[", "1", "]", ")", "\n", "dLon", ":=", "deg2rad", "(", "p1", "[", "0", "]", "-", "p2", "[", "...
// Distance returns the distance between two points on the earth.
[ "Distance", "returns", "the", "distance", "between", "two", "points", "on", "the", "earth", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geo/distance.go#L10-L22
29,065
paulmach/orb
geo/distance.go
DistanceHaversine
func DistanceHaversine(p1, p2 orb.Point) float64 { dLat := deg2rad(p1[1] - p2[1]) dLon := deg2rad(p1[0] - p2[0]) dLat2Sin := math.Sin(dLat / 2) dLon2Sin := math.Sin(dLon / 2) a := dLat2Sin*dLat2Sin + math.Cos(deg2rad(p2[1]))*math.Cos(deg2rad(p1[1]))*dLon2Sin*dLon2Sin return 2.0 * orb.EarthRadius * math.Atan2(ma...
go
func DistanceHaversine(p1, p2 orb.Point) float64 { dLat := deg2rad(p1[1] - p2[1]) dLon := deg2rad(p1[0] - p2[0]) dLat2Sin := math.Sin(dLat / 2) dLon2Sin := math.Sin(dLon / 2) a := dLat2Sin*dLat2Sin + math.Cos(deg2rad(p2[1]))*math.Cos(deg2rad(p1[1]))*dLon2Sin*dLon2Sin return 2.0 * orb.EarthRadius * math.Atan2(ma...
[ "func", "DistanceHaversine", "(", "p1", ",", "p2", "orb", ".", "Point", ")", "float64", "{", "dLat", ":=", "deg2rad", "(", "p1", "[", "1", "]", "-", "p2", "[", "1", "]", ")", "\n", "dLon", ":=", "deg2rad", "(", "p1", "[", "0", "]", "-", "p2", ...
// DistanceHaversine computes the distance on the earth using the // more accurate haversine formula.
[ "DistanceHaversine", "computes", "the", "distance", "on", "the", "earth", "using", "the", "more", "accurate", "haversine", "formula", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geo/distance.go#L26-L35
29,066
paulmach/orb
geo/distance.go
Bearing
func Bearing(from, to orb.Point) float64 { dLon := deg2rad(to[0] - from[0]) fromLatRad := deg2rad(from[1]) toLatRad := deg2rad(to[1]) y := math.Sin(dLon) * math.Cos(toLatRad) x := math.Cos(fromLatRad)*math.Sin(toLatRad) - math.Sin(fromLatRad)*math.Cos(toLatRad)*math.Cos(dLon) return rad2deg(math.Atan2(y, x)) }
go
func Bearing(from, to orb.Point) float64 { dLon := deg2rad(to[0] - from[0]) fromLatRad := deg2rad(from[1]) toLatRad := deg2rad(to[1]) y := math.Sin(dLon) * math.Cos(toLatRad) x := math.Cos(fromLatRad)*math.Sin(toLatRad) - math.Sin(fromLatRad)*math.Cos(toLatRad)*math.Cos(dLon) return rad2deg(math.Atan2(y, x)) }
[ "func", "Bearing", "(", "from", ",", "to", "orb", ".", "Point", ")", "float64", "{", "dLon", ":=", "deg2rad", "(", "to", "[", "0", "]", "-", "from", "[", "0", "]", ")", "\n\n", "fromLatRad", ":=", "deg2rad", "(", "from", "[", "1", "]", ")", "\n...
// Bearing computes the direction one must start traveling on earth // to be heading from, to the given points.
[ "Bearing", "computes", "the", "direction", "one", "must", "start", "traveling", "on", "earth", "to", "be", "heading", "from", "to", "the", "given", "points", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geo/distance.go#L39-L49
29,067
paulmach/orb
geo/distance.go
Midpoint
func Midpoint(p, p2 orb.Point) orb.Point { dLon := deg2rad(p2[0] - p[0]) aLatRad := deg2rad(p[1]) bLatRad := deg2rad(p2[1]) x := math.Cos(bLatRad) * math.Cos(dLon) y := math.Cos(bLatRad) * math.Sin(dLon) r := orb.Point{ deg2rad(p[0]) + math.Atan2(y, math.Cos(aLatRad)+x), math.Atan2(math.Sin(aLatRad)+math.S...
go
func Midpoint(p, p2 orb.Point) orb.Point { dLon := deg2rad(p2[0] - p[0]) aLatRad := deg2rad(p[1]) bLatRad := deg2rad(p2[1]) x := math.Cos(bLatRad) * math.Cos(dLon) y := math.Cos(bLatRad) * math.Sin(dLon) r := orb.Point{ deg2rad(p[0]) + math.Atan2(y, math.Cos(aLatRad)+x), math.Atan2(math.Sin(aLatRad)+math.S...
[ "func", "Midpoint", "(", "p", ",", "p2", "orb", ".", "Point", ")", "orb", ".", "Point", "{", "dLon", ":=", "deg2rad", "(", "p2", "[", "0", "]", "-", "p", "[", "0", "]", ")", "\n\n", "aLatRad", ":=", "deg2rad", "(", "p", "[", "1", "]", ")", ...
// Midpoint returns the half-way point along a great circle path between the two points.
[ "Midpoint", "returns", "the", "half", "-", "way", "point", "along", "a", "great", "circle", "path", "between", "the", "two", "points", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geo/distance.go#L52-L71
29,068
paulmach/orb
maptile/set.go
ToFeatureCollection
func (s Set) ToFeatureCollection() *geojson.FeatureCollection { fc := geojson.NewFeatureCollection() fc.Features = make([]*geojson.Feature, 0, len(s)) for t := range s { fc.Append(geojson.NewFeature(t.Bound().ToPolygon())) } return fc }
go
func (s Set) ToFeatureCollection() *geojson.FeatureCollection { fc := geojson.NewFeatureCollection() fc.Features = make([]*geojson.Feature, 0, len(s)) for t := range s { fc.Append(geojson.NewFeature(t.Bound().ToPolygon())) } return fc }
[ "func", "(", "s", "Set", ")", "ToFeatureCollection", "(", ")", "*", "geojson", ".", "FeatureCollection", "{", "fc", ":=", "geojson", ".", "NewFeatureCollection", "(", ")", "\n", "fc", ".", "Features", "=", "make", "(", "[", "]", "*", "geojson", ".", "F...
// ToFeatureCollection converts a set of tiles into a feature collection. // This method is mostly useful for debugging output.
[ "ToFeatureCollection", "converts", "a", "set", "of", "tiles", "into", "a", "feature", "collection", ".", "This", "method", "is", "mostly", "useful", "for", "debugging", "output", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/set.go#L12-L20
29,069
paulmach/orb
maptile/set.go
Merge
func (s Set) Merge(set Set) { for t, v := range set { if v { s[t] = true } } }
go
func (s Set) Merge(set Set) { for t, v := range set { if v { s[t] = true } } }
[ "func", "(", "s", "Set", ")", "Merge", "(", "set", "Set", ")", "{", "for", "t", ",", "v", ":=", "range", "set", "{", "if", "v", "{", "s", "[", "t", "]", "=", "true", "\n", "}", "\n", "}", "\n", "}" ]
// Merge will merge the given set into the existing set.
[ "Merge", "will", "merge", "the", "given", "set", "into", "the", "existing", "set", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/set.go#L23-L29
29,070
paulmach/orb
maptile/tilecover/line_string.go
LineString
func LineString(ls orb.LineString, z maptile.Zoom) maptile.Set { set := make(maptile.Set) line(set, ls, z, nil) return set }
go
func LineString(ls orb.LineString, z maptile.Zoom) maptile.Set { set := make(maptile.Set) line(set, ls, z, nil) return set }
[ "func", "LineString", "(", "ls", "orb", ".", "LineString", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "set", ":=", "make", "(", "maptile", ".", "Set", ")", "\n", "line", "(", "set", ",", "ls", ",", "z", ",", "nil", ")", ...
// LineString creates a tile cover for the line string.
[ "LineString", "creates", "a", "tile", "cover", "for", "the", "line", "string", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/line_string.go#L11-L16
29,071
paulmach/orb
maptile/tilecover/line_string.go
MultiLineString
func MultiLineString(mls orb.MultiLineString, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, ls := range mls { line(set, ls, z, nil) } return set }
go
func MultiLineString(mls orb.MultiLineString, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, ls := range mls { line(set, ls, z, nil) } return set }
[ "func", "MultiLineString", "(", "mls", "orb", ".", "MultiLineString", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "set", ":=", "make", "(", "maptile", ".", "Set", ")", "\n", "for", "_", ",", "ls", ":=", "range", "mls", "{", "...
// MultiLineString creates a tile cover for the line strings.
[ "MultiLineString", "creates", "a", "tile", "cover", "for", "the", "line", "strings", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/line_string.go#L19-L26
29,072
paulmach/orb
maptile/tile.go
ToFeatureCollection
func (ts Tiles) ToFeatureCollection() *geojson.FeatureCollection { fc := geojson.NewFeatureCollection() fc.Features = make([]*geojson.Feature, 0, len(ts)) for _, t := range ts { fc.Append(geojson.NewFeature(t.Bound().ToPolygon())) } return fc }
go
func (ts Tiles) ToFeatureCollection() *geojson.FeatureCollection { fc := geojson.NewFeatureCollection() fc.Features = make([]*geojson.Feature, 0, len(ts)) for _, t := range ts { fc.Append(geojson.NewFeature(t.Bound().ToPolygon())) } return fc }
[ "func", "(", "ts", "Tiles", ")", "ToFeatureCollection", "(", ")", "*", "geojson", ".", "FeatureCollection", "{", "fc", ":=", "geojson", ".", "NewFeatureCollection", "(", ")", "\n", "fc", ".", "Features", "=", "make", "(", "[", "]", "*", "geojson", ".", ...
// ToFeatureCollection converts the tiles into a feature collection. // This method is mostly useful for debugging output.
[ "ToFeatureCollection", "converts", "the", "tiles", "into", "a", "feature", "collection", ".", "This", "method", "is", "mostly", "useful", "for", "debugging", "output", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tile.go#L19-L27
29,073
paulmach/orb
maptile/tile.go
New
func New(x, y uint32, z Zoom) Tile { return Tile{x, y, z} }
go
func New(x, y uint32, z Zoom) Tile { return Tile{x, y, z} }
[ "func", "New", "(", "x", ",", "y", "uint32", ",", "z", "Zoom", ")", "Tile", "{", "return", "Tile", "{", "x", ",", "y", ",", "z", "}", "\n", "}" ]
// New creates a new tile with the given coordinates.
[ "New", "creates", "a", "new", "tile", "with", "the", "given", "coordinates", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tile.go#L39-L41
29,074
paulmach/orb
maptile/tile.go
FromQuadkey
func FromQuadkey(k uint64, z Zoom) Tile { t := Tile{Z: z} for i := Zoom(0); i < z; i++ { t.X |= uint32((k & (1 << (2 * i))) >> i) t.Y |= uint32((k & (1 << (2*i + 1))) >> (i + 1)) } return t }
go
func FromQuadkey(k uint64, z Zoom) Tile { t := Tile{Z: z} for i := Zoom(0); i < z; i++ { t.X |= uint32((k & (1 << (2 * i))) >> i) t.Y |= uint32((k & (1 << (2*i + 1))) >> (i + 1)) } return t }
[ "func", "FromQuadkey", "(", "k", "uint64", ",", "z", "Zoom", ")", "Tile", "{", "t", ":=", "Tile", "{", "Z", ":", "z", "}", "\n\n", "for", "i", ":=", "Zoom", "(", "0", ")", ";", "i", "<", "z", ";", "i", "++", "{", "t", ".", "X", "|=", "uin...
// FromQuadkey creates the tile from the quadkey.
[ "FromQuadkey", "creates", "the", "tile", "from", "the", "quadkey", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tile.go#L59-L68
29,075
paulmach/orb
maptile/tile.go
Parent
func (t Tile) Parent() Tile { if t.Z == 0 { return t } return Tile{ X: t.X >> 1, Y: t.Y >> 1, Z: t.Z - 1, } }
go
func (t Tile) Parent() Tile { if t.Z == 0 { return t } return Tile{ X: t.X >> 1, Y: t.Y >> 1, Z: t.Z - 1, } }
[ "func", "(", "t", "Tile", ")", "Parent", "(", ")", "Tile", "{", "if", "t", ".", "Z", "==", "0", "{", "return", "t", "\n", "}", "\n\n", "return", "Tile", "{", "X", ":", "t", ".", "X", ">>", "1", ",", "Y", ":", "t", ".", "Y", ">>", "1", "...
// Parent returns the parent of the tile.
[ "Parent", "returns", "the", "parent", "of", "the", "tile", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tile.go#L129-L139
29,076
paulmach/orb
maptile/tile.go
Fraction
func Fraction(ll orb.Point, z Zoom) orb.Point { var p orb.Point factor := uint32(1 << z) maxtiles := float64(factor) lng := ll[0]/360.0 + 0.5 p[0] = lng * maxtiles // bound it because we have a top of the world problem if ll[1] < -85.0511 { p[1] = maxtiles - 1 } else if ll[1] > 85.0511 { p[1] = 0 } else...
go
func Fraction(ll orb.Point, z Zoom) orb.Point { var p orb.Point factor := uint32(1 << z) maxtiles := float64(factor) lng := ll[0]/360.0 + 0.5 p[0] = lng * maxtiles // bound it because we have a top of the world problem if ll[1] < -85.0511 { p[1] = maxtiles - 1 } else if ll[1] > 85.0511 { p[1] = 0 } else...
[ "func", "Fraction", "(", "ll", "orb", ".", "Point", ",", "z", "Zoom", ")", "orb", ".", "Point", "{", "var", "p", "orb", ".", "Point", "\n\n", "factor", ":=", "uint32", "(", "1", "<<", "z", ")", "\n", "maxtiles", ":=", "float64", "(", "factor", ")...
// Fraction returns the precise tile fraction at the given zoom. // Will return 2^zoom-1 if the point is below 85.0511 S.
[ "Fraction", "returns", "the", "precise", "tile", "fraction", "at", "the", "given", "zoom", ".", "Will", "return", "2^zoom", "-", "1", "if", "the", "point", "is", "below", "85", ".", "0511", "S", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tile.go#L143-L164
29,077
paulmach/orb
maptile/tile.go
SharedParent
func (t Tile) SharedParent(tile Tile) Tile { // bring both tiles to the lowest zoom. if t.Z != tile.Z { if t.Z < tile.Z { tile = tile.toZoom(t.Z) } else { t = t.toZoom(tile.Z) } } if t == tile { return t } // go version < 1.9 // bit package usage was about 10% faster // // TODO: use build flags...
go
func (t Tile) SharedParent(tile Tile) Tile { // bring both tiles to the lowest zoom. if t.Z != tile.Z { if t.Z < tile.Z { tile = tile.toZoom(t.Z) } else { t = t.toZoom(tile.Z) } } if t == tile { return t } // go version < 1.9 // bit package usage was about 10% faster // // TODO: use build flags...
[ "func", "(", "t", "Tile", ")", "SharedParent", "(", "tile", "Tile", ")", "Tile", "{", "// bring both tiles to the lowest zoom.", "if", "t", ".", "Z", "!=", "tile", ".", "Z", "{", "if", "t", ".", "Z", "<", "tile", ".", "Z", "{", "tile", "=", "tile", ...
// SharedParent returns the tile that contains both the tiles.
[ "SharedParent", "returns", "the", "tile", "that", "contains", "both", "the", "tiles", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tile.go#L167-L217
29,078
paulmach/orb
maptile/tile.go
Children
func (t Tile) Children() Tiles { return Tiles{ Tile{t.X << 1, t.Y << 1, t.Z + 1}, Tile{(t.X << 1) + 1, t.Y << 1, t.Z + 1}, Tile{(t.X << 1) + 1, (t.Y << 1) + 1, t.Z + 1}, Tile{t.X << 1, (t.Y << 1) + 1, t.Z + 1}, } }
go
func (t Tile) Children() Tiles { return Tiles{ Tile{t.X << 1, t.Y << 1, t.Z + 1}, Tile{(t.X << 1) + 1, t.Y << 1, t.Z + 1}, Tile{(t.X << 1) + 1, (t.Y << 1) + 1, t.Z + 1}, Tile{t.X << 1, (t.Y << 1) + 1, t.Z + 1}, } }
[ "func", "(", "t", "Tile", ")", "Children", "(", ")", "Tiles", "{", "return", "Tiles", "{", "Tile", "{", "t", ".", "X", "<<", "1", ",", "t", ".", "Y", "<<", "1", ",", "t", ".", "Z", "+", "1", "}", ",", "Tile", "{", "(", "t", ".", "X", "<...
// Children returns the 4 children of the tile.
[ "Children", "returns", "the", "4", "children", "of", "the", "tile", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tile.go#L220-L227
29,079
paulmach/orb
maptile/tile.go
Quadkey
func (t Tile) Quadkey() uint64 { var i, result uint64 for i = 0; i < uint64(t.Z); i++ { result |= (uint64(t.X) & (1 << i)) << i result |= (uint64(t.Y) & (1 << i)) << (i + 1) } return result }
go
func (t Tile) Quadkey() uint64 { var i, result uint64 for i = 0; i < uint64(t.Z); i++ { result |= (uint64(t.X) & (1 << i)) << i result |= (uint64(t.Y) & (1 << i)) << (i + 1) } return result }
[ "func", "(", "t", "Tile", ")", "Quadkey", "(", ")", "uint64", "{", "var", "i", ",", "result", "uint64", "\n", "for", "i", "=", "0", ";", "i", "<", "uint64", "(", "t", ".", "Z", ")", ";", "i", "++", "{", "result", "|=", "(", "uint64", "(", "...
// Quadkey returns the quad key for the tile.
[ "Quadkey", "returns", "the", "quad", "key", "for", "the", "tile", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tile.go#L235-L243
29,080
paulmach/orb
maptile/tile.go
Range
func (t Tile) Range(z Zoom) (min, max Tile) { if z < t.Z { t = t.toZoom(z) return t, t } offset := z - t.Z return Tile{ X: t.X << offset, Y: t.Y << offset, Z: z, }, Tile{ X: ((t.X + 1) << offset) - 1, Y: ((t.Y + 1) << offset) - 1, Z: z, } }
go
func (t Tile) Range(z Zoom) (min, max Tile) { if z < t.Z { t = t.toZoom(z) return t, t } offset := z - t.Z return Tile{ X: t.X << offset, Y: t.Y << offset, Z: z, }, Tile{ X: ((t.X + 1) << offset) - 1, Y: ((t.Y + 1) << offset) - 1, Z: z, } }
[ "func", "(", "t", "Tile", ")", "Range", "(", "z", "Zoom", ")", "(", "min", ",", "max", "Tile", ")", "{", "if", "z", "<", "t", ".", "Z", "{", "t", "=", "t", ".", "toZoom", "(", "z", ")", "\n", "return", "t", ",", "t", "\n", "}", "\n\n", ...
// Range returns the min and max tile "range" to cover the tile // at the given zoom.
[ "Range", "returns", "the", "min", "and", "max", "tile", "range", "to", "cover", "the", "tile", "at", "the", "given", "zoom", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tile.go#L247-L263
29,081
paulmach/orb
geo/area.go
Area
func Area(g orb.Geometry) float64 { if g == nil { return 0 } switch g := g.(type) { case orb.Point, orb.MultiPoint, orb.LineString, orb.MultiLineString: return 0 case orb.Ring: return math.Abs(ringArea(g)) case orb.Polygon: return polygonArea(g) case orb.MultiPolygon: return multiPolygonArea(g) case ...
go
func Area(g orb.Geometry) float64 { if g == nil { return 0 } switch g := g.(type) { case orb.Point, orb.MultiPoint, orb.LineString, orb.MultiLineString: return 0 case orb.Ring: return math.Abs(ringArea(g)) case orb.Polygon: return polygonArea(g) case orb.MultiPolygon: return multiPolygonArea(g) case ...
[ "func", "Area", "(", "g", "orb", ".", "Geometry", ")", "float64", "{", "if", "g", "==", "nil", "{", "return", "0", "\n", "}", "\n\n", "switch", "g", ":=", "g", ".", "(", "type", ")", "{", "case", "orb", ".", "Point", ",", "orb", ".", "MultiPoin...
// Area returns the area of the geometry on the earth.
[ "Area", "returns", "the", "area", "of", "the", "geometry", "on", "the", "earth", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geo/area.go#L12-L33
29,082
paulmach/orb
geojson/feature.go
UnmarshalJSON
func (f *Feature) UnmarshalJSON(data []byte) error { jf := &jsonFeature{} err := json.Unmarshal(data, &jf) if err != nil { return err } if jf.Type != "Feature" { return fmt.Errorf("geojson: not a feature: type=%s", jf.Type) } *f = Feature{ ID: jf.ID, Type: jf.Type, Properties: jf.Proper...
go
func (f *Feature) UnmarshalJSON(data []byte) error { jf := &jsonFeature{} err := json.Unmarshal(data, &jf) if err != nil { return err } if jf.Type != "Feature" { return fmt.Errorf("geojson: not a feature: type=%s", jf.Type) } *f = Feature{ ID: jf.ID, Type: jf.Type, Properties: jf.Proper...
[ "func", "(", "f", "*", "Feature", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "jf", ":=", "&", "jsonFeature", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "jf", ")", "\n", "if", "err", ...
// UnmarshalJSON handles the correct unmarshalling of the data // into the orb.Geometry types.
[ "UnmarshalJSON", "handles", "the", "correct", "unmarshalling", "of", "the", "data", "into", "the", "orb", ".", "Geometry", "types", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/feature.go#L70-L90
29,083
paulmach/orb
maptile/tilecover/helpers.go
Geometry
func Geometry(g orb.Geometry, z maptile.Zoom) maptile.Set { if g == nil { return nil } switch g := g.(type) { case orb.Point: return Point(g, z) case orb.MultiPoint: return MultiPoint(g, z) case orb.LineString: return LineString(g, z) case orb.MultiLineString: return MultiLineString(g, z) case orb.Ri...
go
func Geometry(g orb.Geometry, z maptile.Zoom) maptile.Set { if g == nil { return nil } switch g := g.(type) { case orb.Point: return Point(g, z) case orb.MultiPoint: return MultiPoint(g, z) case orb.LineString: return LineString(g, z) case orb.MultiLineString: return MultiLineString(g, z) case orb.Ri...
[ "func", "Geometry", "(", "g", "orb", ".", "Geometry", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "if", "g", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "switch", "g", ":=", "g", ".", "(", "type", ")", "{", "cas...
// Geometry returns the covering set of tiles for the given geometry.
[ "Geometry", "returns", "the", "covering", "set", "of", "tiles", "for", "the", "given", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/helpers.go#L12-L39
29,084
paulmach/orb
maptile/tilecover/helpers.go
Point
func Point(ll orb.Point, z maptile.Zoom) maptile.Set { return maptile.Set{ maptile.At(ll, z): true, } }
go
func Point(ll orb.Point, z maptile.Zoom) maptile.Set { return maptile.Set{ maptile.At(ll, z): true, } }
[ "func", "Point", "(", "ll", "orb", ".", "Point", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "return", "maptile", ".", "Set", "{", "maptile", ".", "At", "(", "ll", ",", "z", ")", ":", "true", ",", "}", "\n", "}" ]
// Point creates a tile cover for the point, i.e. just the tile // containing the point.
[ "Point", "creates", "a", "tile", "cover", "for", "the", "point", "i", ".", "e", ".", "just", "the", "tile", "containing", "the", "point", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/helpers.go#L43-L47
29,085
paulmach/orb
maptile/tilecover/helpers.go
MultiPoint
func MultiPoint(mp orb.MultiPoint, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, p := range mp { set[maptile.At(p, z)] = true } return set }
go
func MultiPoint(mp orb.MultiPoint, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, p := range mp { set[maptile.At(p, z)] = true } return set }
[ "func", "MultiPoint", "(", "mp", "orb", ".", "MultiPoint", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "set", ":=", "make", "(", "maptile", ".", "Set", ")", "\n", "for", "_", ",", "p", ":=", "range", "mp", "{", "set", "[", ...
// MultiPoint creates a tile cover for the set of points,
[ "MultiPoint", "creates", "a", "tile", "cover", "for", "the", "set", "of", "points" ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/helpers.go#L50-L57
29,086
paulmach/orb
maptile/tilecover/helpers.go
Bound
func Bound(b orb.Bound, z maptile.Zoom) maptile.Set { lo := maptile.At(b.Min, z) hi := maptile.At(b.Max, z) result := make(maptile.Set, (hi.X-lo.X+1)*(lo.Y-hi.Y+1)) for x := lo.X; x <= hi.X; x++ { for y := hi.Y; y <= lo.Y; y++ { result[maptile.Tile{X: x, Y: y, Z: z}] = true } } return result }
go
func Bound(b orb.Bound, z maptile.Zoom) maptile.Set { lo := maptile.At(b.Min, z) hi := maptile.At(b.Max, z) result := make(maptile.Set, (hi.X-lo.X+1)*(lo.Y-hi.Y+1)) for x := lo.X; x <= hi.X; x++ { for y := hi.Y; y <= lo.Y; y++ { result[maptile.Tile{X: x, Y: y, Z: z}] = true } } return result }
[ "func", "Bound", "(", "b", "orb", ".", "Bound", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "lo", ":=", "maptile", ".", "At", "(", "b", ".", "Min", ",", "z", ")", "\n", "hi", ":=", "maptile", ".", "At", "(", "b", ".", ...
// Bound creates a tile cover for the bound. i.e. all the tiles // that intersect the bound.
[ "Bound", "creates", "a", "tile", "cover", "for", "the", "bound", ".", "i", ".", "e", ".", "all", "the", "tiles", "that", "intersect", "the", "bound", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/helpers.go#L61-L74
29,087
paulmach/orb
maptile/tilecover/helpers.go
Collection
func Collection(c orb.Collection, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, g := range c { set.Merge(Geometry(g, z)) } return set }
go
func Collection(c orb.Collection, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, g := range c { set.Merge(Geometry(g, z)) } return set }
[ "func", "Collection", "(", "c", "orb", ".", "Collection", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "set", ":=", "make", "(", "maptile", ".", "Set", ")", "\n", "for", "_", ",", "g", ":=", "range", "c", "{", "set", ".", ...
// Collection returns the covering set of tiles for the // geoemtry collection.
[ "Collection", "returns", "the", "covering", "set", "of", "tiles", "for", "the", "geoemtry", "collection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/helpers.go#L78-L85
29,088
paulmach/orb
polygon.go
Equal
func (p Polygon) Equal(polygon Polygon) bool { if len(p) != len(polygon) { return false } for i := range p { if !p[i].Equal(polygon[i]) { return false } } return true }
go
func (p Polygon) Equal(polygon Polygon) bool { if len(p) != len(polygon) { return false } for i := range p { if !p[i].Equal(polygon[i]) { return false } } return true }
[ "func", "(", "p", "Polygon", ")", "Equal", "(", "polygon", "Polygon", ")", "bool", "{", "if", "len", "(", "p", ")", "!=", "len", "(", "polygon", ")", "{", "return", "false", "\n", "}", "\n\n", "for", "i", ":=", "range", "p", "{", "if", "!", "p"...
// Equal compares two polygons. Returns true if lengths are the same // and all points are Equal.
[ "Equal", "compares", "two", "polygons", ".", "Returns", "true", "if", "lengths", "are", "the", "same", "and", "all", "points", "are", "Equal", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/polygon.go#L28-L40
29,089
paulmach/orb
polygon.go
Clone
func (p Polygon) Clone() Polygon { if p == nil { return p } np := make(Polygon, 0, len(p)) for _, r := range p { np = append(np, r.Clone()) } return np }
go
func (p Polygon) Clone() Polygon { if p == nil { return p } np := make(Polygon, 0, len(p)) for _, r := range p { np = append(np, r.Clone()) } return np }
[ "func", "(", "p", "Polygon", ")", "Clone", "(", ")", "Polygon", "{", "if", "p", "==", "nil", "{", "return", "p", "\n", "}", "\n\n", "np", ":=", "make", "(", "Polygon", ",", "0", ",", "len", "(", "p", ")", ")", "\n", "for", "_", ",", "r", ":...
// Clone returns a new deep copy of the polygon. // All of the rings are also cloned.
[ "Clone", "returns", "a", "new", "deep", "copy", "of", "the", "polygon", ".", "All", "of", "the", "rings", "are", "also", "cloned", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/polygon.go#L44-L55
29,090
paulmach/orb
multi_polygon.go
Bound
func (mp MultiPolygon) Bound() Bound { if len(mp) == 0 { return emptyBound } bound := mp[0].Bound() for i := 1; i < len(mp); i++ { bound = bound.Union(mp[i].Bound()) } return bound }
go
func (mp MultiPolygon) Bound() Bound { if len(mp) == 0 { return emptyBound } bound := mp[0].Bound() for i := 1; i < len(mp); i++ { bound = bound.Union(mp[i].Bound()) } return bound }
[ "func", "(", "mp", "MultiPolygon", ")", "Bound", "(", ")", "Bound", "{", "if", "len", "(", "mp", ")", "==", "0", "{", "return", "emptyBound", "\n", "}", "\n", "bound", ":=", "mp", "[", "0", "]", ".", "Bound", "(", ")", "\n", "for", "i", ":=", ...
// Bound returns a bound around the multi-polygon.
[ "Bound", "returns", "a", "bound", "around", "the", "multi", "-", "polygon", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_polygon.go#L17-L27
29,091
paulmach/orb
multi_polygon.go
Equal
func (mp MultiPolygon) Equal(multiPolygon MultiPolygon) bool { if len(mp) != len(multiPolygon) { return false } for i, p := range mp { if !p.Equal(multiPolygon[i]) { return false } } return true }
go
func (mp MultiPolygon) Equal(multiPolygon MultiPolygon) bool { if len(mp) != len(multiPolygon) { return false } for i, p := range mp { if !p.Equal(multiPolygon[i]) { return false } } return true }
[ "func", "(", "mp", "MultiPolygon", ")", "Equal", "(", "multiPolygon", "MultiPolygon", ")", "bool", "{", "if", "len", "(", "mp", ")", "!=", "len", "(", "multiPolygon", ")", "{", "return", "false", "\n", "}", "\n\n", "for", "i", ",", "p", ":=", "range"...
// Equal compares two multi-polygons.
[ "Equal", "compares", "two", "multi", "-", "polygons", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_polygon.go#L30-L42
29,092
paulmach/orb
multi_polygon.go
Clone
func (mp MultiPolygon) Clone() MultiPolygon { if mp == nil { return nil } nmp := make(MultiPolygon, 0, len(mp)) for _, p := range mp { nmp = append(nmp, p.Clone()) } return nmp }
go
func (mp MultiPolygon) Clone() MultiPolygon { if mp == nil { return nil } nmp := make(MultiPolygon, 0, len(mp)) for _, p := range mp { nmp = append(nmp, p.Clone()) } return nmp }
[ "func", "(", "mp", "MultiPolygon", ")", "Clone", "(", ")", "MultiPolygon", "{", "if", "mp", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "nmp", ":=", "make", "(", "MultiPolygon", ",", "0", ",", "len", "(", "mp", ")", ")", "\n", "for", "_...
// Clone returns a new deep copy of the multi-polygon.
[ "Clone", "returns", "a", "new", "deep", "copy", "of", "the", "multi", "-", "polygon", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_polygon.go#L45-L56
29,093
paulmach/orb
internal/length/length.go
Length
func Length(g orb.Geometry, df orb.DistanceFunc) float64 { if g == nil { return 0 } switch g := g.(type) { case orb.Point: return 0 case orb.MultiPoint: return 0 case orb.LineString: return lineStringLength(g, df) case orb.MultiLineString: sum := 0.0 for _, ls := range g { sum += lineStringLength...
go
func Length(g orb.Geometry, df orb.DistanceFunc) float64 { if g == nil { return 0 } switch g := g.(type) { case orb.Point: return 0 case orb.MultiPoint: return 0 case orb.LineString: return lineStringLength(g, df) case orb.MultiLineString: sum := 0.0 for _, ls := range g { sum += lineStringLength...
[ "func", "Length", "(", "g", "orb", ".", "Geometry", ",", "df", "orb", ".", "DistanceFunc", ")", "float64", "{", "if", "g", "==", "nil", "{", "return", "0", "\n", "}", "\n\n", "switch", "g", ":=", "g", ".", "(", "type", ")", "{", "case", "orb", ...
// Length returns the length of the boundary of the geometry // using 2d euclidean geometry.
[ "Length", "returns", "the", "length", "of", "the", "boundary", "of", "the", "geometry", "using", "2d", "euclidean", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/internal/length/length.go#L11-L53
29,094
paulmach/orb
encoding/mvt/layer.go
NewLayer
func NewLayer(name string, fc *geojson.FeatureCollection) *Layer { return &Layer{ Name: name, Version: 1, Extent: DefaultExtent, Features: fc.Features, } }
go
func NewLayer(name string, fc *geojson.FeatureCollection) *Layer { return &Layer{ Name: name, Version: 1, Extent: DefaultExtent, Features: fc.Features, } }
[ "func", "NewLayer", "(", "name", "string", ",", "fc", "*", "geojson", ".", "FeatureCollection", ")", "*", "Layer", "{", "return", "&", "Layer", "{", "Name", ":", "name", ",", "Version", ":", "1", ",", "Extent", ":", "DefaultExtent", ",", "Features", ":...
// NewLayer is a helper to create a Layer from a feature collection // and a name, it sets the default extent and version to 1.
[ "NewLayer", "is", "a", "helper", "to", "create", "a", "Layer", "from", "a", "feature", "collection", "and", "a", "name", "it", "sets", "the", "default", "extent", "and", "version", "to", "1", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L24-L31
29,095
paulmach/orb
encoding/mvt/layer.go
ProjectToTile
func (l *Layer) ProjectToTile(tile maptile.Tile) { p := newProjection(tile, l.Extent) for _, f := range l.Features { f.Geometry = project.Geometry(f.Geometry, p.ToTile) } }
go
func (l *Layer) ProjectToTile(tile maptile.Tile) { p := newProjection(tile, l.Extent) for _, f := range l.Features { f.Geometry = project.Geometry(f.Geometry, p.ToTile) } }
[ "func", "(", "l", "*", "Layer", ")", "ProjectToTile", "(", "tile", "maptile", ".", "Tile", ")", "{", "p", ":=", "newProjection", "(", "tile", ",", "l", ".", "Extent", ")", "\n", "for", "_", ",", "f", ":=", "range", "l", ".", "Features", "{", "f",...
// ProjectToTile will project all the geometries in the layer // to tile coordinates based on the extent and the mercator projection.
[ "ProjectToTile", "will", "project", "all", "the", "geometries", "in", "the", "layer", "to", "tile", "coordinates", "based", "on", "the", "extent", "and", "the", "mercator", "projection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L35-L40
29,096
paulmach/orb
encoding/mvt/layer.go
ProjectToWGS84
func (l *Layer) ProjectToWGS84(tile maptile.Tile) { p := newProjection(tile, l.Extent) for _, f := range l.Features { f.Geometry = project.Geometry(f.Geometry, p.ToWGS84) } }
go
func (l *Layer) ProjectToWGS84(tile maptile.Tile) { p := newProjection(tile, l.Extent) for _, f := range l.Features { f.Geometry = project.Geometry(f.Geometry, p.ToWGS84) } }
[ "func", "(", "l", "*", "Layer", ")", "ProjectToWGS84", "(", "tile", "maptile", ".", "Tile", ")", "{", "p", ":=", "newProjection", "(", "tile", ",", "l", ".", "Extent", ")", "\n", "for", "_", ",", "f", ":=", "range", "l", ".", "Features", "{", "f"...
// ProjectToWGS84 will project all the geometries backed to WGS84 from // the extent and mercator projection.
[ "ProjectToWGS84", "will", "project", "all", "the", "geometries", "backed", "to", "WGS84", "from", "the", "extent", "and", "mercator", "projection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L44-L49
29,097
paulmach/orb
encoding/mvt/layer.go
NewLayers
func NewLayers(layers map[string]*geojson.FeatureCollection) Layers { result := make(Layers, 0, len(layers)) for name, fc := range layers { result = append(result, NewLayer(name, fc)) } return result }
go
func NewLayers(layers map[string]*geojson.FeatureCollection) Layers { result := make(Layers, 0, len(layers)) for name, fc := range layers { result = append(result, NewLayer(name, fc)) } return result }
[ "func", "NewLayers", "(", "layers", "map", "[", "string", "]", "*", "geojson", ".", "FeatureCollection", ")", "Layers", "{", "result", ":=", "make", "(", "Layers", ",", "0", ",", "len", "(", "layers", ")", ")", "\n", "for", "name", ",", "fc", ":=", ...
// NewLayers creates a set of layers given a set of feature collections.
[ "NewLayers", "creates", "a", "set", "of", "layers", "given", "a", "set", "of", "feature", "collections", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L55-L62
29,098
paulmach/orb
encoding/mvt/layer.go
ToFeatureCollections
func (ls Layers) ToFeatureCollections() map[string]*geojson.FeatureCollection { result := make(map[string]*geojson.FeatureCollection, len(ls)) for _, l := range ls { result[l.Name] = &geojson.FeatureCollection{ Features: l.Features, } } return result }
go
func (ls Layers) ToFeatureCollections() map[string]*geojson.FeatureCollection { result := make(map[string]*geojson.FeatureCollection, len(ls)) for _, l := range ls { result[l.Name] = &geojson.FeatureCollection{ Features: l.Features, } } return result }
[ "func", "(", "ls", "Layers", ")", "ToFeatureCollections", "(", ")", "map", "[", "string", "]", "*", "geojson", ".", "FeatureCollection", "{", "result", ":=", "make", "(", "map", "[", "string", "]", "*", "geojson", ".", "FeatureCollection", ",", "len", "(...
// ToFeatureCollections converts the layers to sets of geojson // feature collections.
[ "ToFeatureCollections", "converts", "the", "layers", "to", "sets", "of", "geojson", "feature", "collections", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L66-L75
29,099
paulmach/orb
encoding/mvt/layer.go
ProjectToTile
func (ls Layers) ProjectToTile(tile maptile.Tile) { for _, l := range ls { l.ProjectToTile(tile) } }
go
func (ls Layers) ProjectToTile(tile maptile.Tile) { for _, l := range ls { l.ProjectToTile(tile) } }
[ "func", "(", "ls", "Layers", ")", "ProjectToTile", "(", "tile", "maptile", ".", "Tile", ")", "{", "for", "_", ",", "l", ":=", "range", "ls", "{", "l", ".", "ProjectToTile", "(", "tile", ")", "\n", "}", "\n", "}" ]
// ProjectToTile will project all the geometries in all layers // to tile coordinates based on the extent and the mercator projection.
[ "ProjectToTile", "will", "project", "all", "the", "geometries", "in", "all", "layers", "to", "tile", "coordinates", "based", "on", "the", "extent", "and", "the", "mercator", "projection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L79-L83