Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This tag is broken, please use v0.7.1 instead.

### Breaking Changes

- tilecover now returns an error (vs. panicing) on non-closed 2d geometry by [@paulmach](https://github.com/paulmach) in https://github.com/paulmach/orb/pull/87
- tilecover now returns an error (vs. panicking) on non-closed 2d geometry by [@paulmach](https://github.com/paulmach) in https://github.com/paulmach/orb/pull/87

This changes the signature of many of the methods in the [maptile/tilecover](https://github.com/paulmach/orb/tree/master/maptile/tilecover) package.
To emulate the old behavior replace:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ They each provide their own README with extra info.
- **GeoJSON** - support as part of the [`geojson`](geojson) sub-package.
- **Mapbox Vector Tile** - encoding and decoding as part of the [`encoding/mvt`](encoding/mvt) sub-package.
- **Direct to type from DB query results** - by scanning WKB data directly into types.
- **Rich set of sub-packages** - including [`clipping`](clip), [`simplifing`](simplify), [`quadtree`](quadtree) and more.
- **Rich set of sub-packages** - including [`clipping`](clip), [`simplifying`](simplify), [`quadtree`](quadtree) and more.

## Type definitions

Expand Down Expand Up @@ -142,7 +142,7 @@ layers.RemoveEmpty(1.0, 2.0)
// encoding using the Mapbox Vector Tile protobuf encoding.
data, err := mvt.Marshal(layers) // this data is NOT gzipped.

// Sometimes MVT data is stored and transfered gzip compressed. In that case:
// Sometimes MVT data is stored and transferred gzip compressed. In that case:
data, err := mvt.MarshalGzipped(layers)
```

Expand Down
4 changes: 2 additions & 2 deletions bound.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ func (b Bound) IsEmpty() bool {
return b.Min[0] > b.Max[0] || b.Min[1] > b.Max[1]
}

// IsZero return true if the bound just includes just null island.
// IsZero return true if the bound includes just null island.
func (b Bound) IsZero() bool {
return b.Max == Point{} && b.Min == Point{}
}

// Bound returns the the same bound.
// Bound returns the same bound.
func (b Bound) Bound() Bound {
return b
}
Expand Down
6 changes: 3 additions & 3 deletions clip/clip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestInternalLine(t *testing.T) {
},
},
{
name: "clips line crossign many times",
name: "clips line crossing many times",
bound: orb.Bound{Min: orb.Point{0, 0}, Max: orb.Point{20, 20}},
input: orb.LineString{
{10, -10}, {10, 30}, {20, 30}, {20, -10},
Expand Down Expand Up @@ -175,7 +175,7 @@ func TestLineString(t *testing.T) {
output orb.MultiLineString
}{
{
name: "clips line crossign many times",
name: "clips line crossing many times",
bound: orb.Bound{Min: orb.Point{0, 0}, Max: orb.Point{20, 20}},
input: orb.LineString{
{10, -10}, {10, 30}, {20, 30}, {20, -10},
Expand Down Expand Up @@ -233,7 +233,7 @@ func TestLineString_OpenBound(t *testing.T) {
output orb.MultiLineString
}{
{
name: "clips line crossign many times",
name: "clips line crossing many times",
bound: orb.Bound{Min: orb.Point{0, 0}, Max: orb.Point{20, 20}},
input: orb.LineString{
{10, -10}, {10, 30}, {20, 30}, {20, -10},
Expand Down
4 changes: 2 additions & 2 deletions clip/smartclip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This package extends the clip functionality to handle partial 2d geometries. The
rings need to only intersect the bound. The algorithm will use that, plus the orientation, to
wrap/close the rings around the edge of the bound.

The use case is [OSM multipolyon relations](https://wiki.openstreetmap.org/wiki/Relation#Multipolygon)
The use case is [OSM multipolygon relations](https://wiki.openstreetmap.org/wiki/Relation#Multipolygon)
where a ring (inner or outer) contains multiple ways but only one is in the current viewport.
With only the ways intersecting the viewport and their orientation the correct shape can be drawn.

Expand All @@ -17,7 +17,7 @@ bound := orb.Bound{Min: orb.Point{1, 1}, Max: orb.Point{10, 10}}
ring := orb.Ring{{0, 0}, {11, 11}}
clipped := smartclip.Ring(bound, ring, orb.CCW)

// clipped is a multipolyon with one ring that wraps counter-clockwise
// clipped is a multipolygon with one ring that wraps counter-clockwise
// around the top triangle of the box
// [[[[1 1] [10 10] [5.5 10] [1 10] [1 5.5] [1 1]]]]
```
2 changes: 1 addition & 1 deletion clip/smartclip/smart.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func smartWrap(box orb.Bound, input []orb.LineString, o orb.Orientation) orb.Mul

// this operation is O(n^2). Technically we could use a linked list
// and remove points instead of marking them as "used".
// However since n is 2x the number of segements I think we're okay.
// However since n is 2x the number of segments I think we're okay.
for i := 0; i < 2*len(points); i++ {
ep := points[i%len(points)]
if ep.Used {
Expand Down
10 changes: 5 additions & 5 deletions clip/smartclip/smart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestRing(t *testing.T) {
t.Logf("%v", expected)
}

// should give same result if mulipolygon
// should give same result if multipolygon
result = MultiPolygon(bound, orb.MultiPolygon{{input}}, o)
if !deepEqualMultiPolygon(result, expected) {
t.Errorf("incorrect multipolygon")
Expand All @@ -159,7 +159,7 @@ func TestPolygon(t *testing.T) {
expected orb.MultiPolygon
}{
{
name: "with innner ring",
name: "with inner ring",
bound: oneSix,
input: orb.Polygon{
{{0, 2}, {5, 2}, {5, 5}, {0, 5}, {0, 2}},
Expand All @@ -171,7 +171,7 @@ func TestPolygon(t *testing.T) {
}},
},
{
name: "with innner ring that will share a side with the outer ring",
name: "with inner ring that will share a side with the outer ring",
bound: oneSix,
input: orb.Polygon{
{{0, 2}, {3, 2}, {3, 5}, {0, 5}},
Expand Down Expand Up @@ -321,7 +321,7 @@ func TestPolygon(t *testing.T) {
t.Logf("%v", expected)
}

// should give same result if inputed as multi polygon
// should give same result if inputted as multi polygon
result = MultiPolygon(bound, orb.MultiPolygon{input}, o)
if !deepEqualMultiPolygon(result, expected) {
t.Errorf("incorrect multipolygon")
Expand Down Expand Up @@ -378,7 +378,7 @@ func TestClipMultiPolygon(t *testing.T) {
},
},
{
name: "polygon with innner ring and single ring polygon",
name: "polygon with inner ring and single ring polygon",
bound: orb.Bound{Min: orb.Point{1, 1}, Max: orb.Point{9, 9}},
input: orb.MultiPolygon{
{
Expand Down
8 changes: 4 additions & 4 deletions encoding/ewkb/ewkb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func compare(t testing.TB, e orb.Geometry, s int, b []byte) {
t.Errorf("decoder: incorrect srid: %v != %v", srid, s)
}

// Umarshal
// Unmarshal
g, srid, err = Unmarshal(b)
if err != nil {
t.Fatalf("unmarshal: read error: %v", err)
Expand Down Expand Up @@ -111,7 +111,7 @@ func compare(t testing.TB, e orb.Geometry, s int, b []byte) {
if !bytes.Equal(data, b) {
t.Logf("%v", data)
t.Logf("%v", b)
t.Errorf("marshal: incorrent encoding")
t.Errorf("marshal: incorrect encoding")
}

// Encode
Expand All @@ -132,7 +132,7 @@ func compare(t testing.TB, e orb.Geometry, s int, b []byte) {
if !bytes.Equal(data, buf.Bytes()) {
t.Logf("%v", data)
t.Logf("%v", b)
t.Errorf("encode: incorrent encoding")
t.Errorf("encode: incorrect encoding")
}

// pass in srid
Expand All @@ -146,7 +146,7 @@ func compare(t testing.TB, e orb.Geometry, s int, b []byte) {
if !bytes.Equal(data, buf.Bytes()) {
t.Logf("%v", data)
t.Logf("%v", b)
t.Errorf("encode with srid: incorrent encoding")
t.Errorf("encode with srid: incorrect encoding")
}

// preallocation
Expand Down
2 changes: 1 addition & 1 deletion encoding/ewkb/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ func TestScanBound_errors(t *testing.T) {
}

func TestValue(t *testing.T) {
t.Run("marshalls geometry", func(t *testing.T) {
t.Run("marshals geometry", func(t *testing.T) {
testPoint := orb.Point{1, 2}
testPointData := MustMarshal(testPoint, 4326)
val, err := Value(testPoint, 4326).Value()
Expand Down
2 changes: 1 addition & 1 deletion encoding/internal/wkbcommon/wkb.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (

const (
// limits so that bad data can't come in and preallocate tons of memory.
// Well formed data with less elements will allocate the correct amount just fine.
// Well formed data with fewer elements will allocate the correct amount just fine.
MaxPointsAlloc = 10000
MaxMultiAlloc = 100
)
Expand Down
4 changes: 2 additions & 2 deletions encoding/internal/wkbcommon/wkb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func compare(t testing.TB, e orb.Geometry, s int, b []byte) {
t.Errorf("decoder: incorrect srid: %v != %v", srid, s)
}

// Umarshal
// Unmarshal
g, srid, err = Unmarshal(b)
if err != nil {
t.Fatalf("unmarshal: read error: %v", err)
Expand All @@ -67,7 +67,7 @@ func compare(t testing.TB, e orb.Geometry, s int, b []byte) {
if !bytes.Equal(data, b) {
t.Logf("%v", data)
t.Logf("%v", b)
t.Errorf("marshal: incorrent encoding")
t.Errorf("marshal: incorrect encoding")
}

// preallocation
Expand Down
2 changes: 1 addition & 1 deletion encoding/mvt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ layers.RemoveEmpty(1.0, 1.0)
// encoding using the Mapbox Vector Tile protobuf encoding.
data, err := mvt.Marshal(layers) // this data is NOT gzipped.

// Sometimes MVT data is stored and transfered gzip compressed. In that case:
// Sometimes MVT data is stored and transferred gzip compressed. In that case:
data, err := mvt.MarshalGzipped(layers)
```

Expand Down
2 changes: 1 addition & 1 deletion encoding/mvt/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestMarshalUnmarshalForGeometryCollection(t *testing.T) {
// compare geometry
xe, ye := tileEpsilon(tile)
if len(results) == len(expected) {
t.Errorf("result geometry count must be splited polygon: %v (but result is %v)", len(results), len(expected))
t.Errorf("result geometry count must be split polygon: %v (but result is %v)", len(results), len(expected))
}
for i, result := range results {
compareOrbGeometry(t, result.Geometry, expected[i], xe, ye)
Expand Down
2 changes: 1 addition & 1 deletion encoding/mvt/simplify.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/paulmach/orb/planar"
)

// 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 simplifier.
func (ls Layers) Simplify(s orb.Simplifier) {
for _, l := range ls {
l.Simplify(s)
Expand Down
2 changes: 1 addition & 1 deletion encoding/wkb/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ func TestScanBound_errors(t *testing.T) {
}

func TestValue(t *testing.T) {
t.Run("marshalls geometry", func(t *testing.T) {
t.Run("marshals geometry", func(t *testing.T) {
val, err := Value(testPoint).Value()
if err != nil {
t.Errorf("value error: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion encoding/wkb/wkb.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Package wkb is for decoding ESRI's Well Known Binary (WKB) format
// sepcification at https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry#Well-known_binary
// specification at https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry#Well-known_binary
package wkb

import (
Expand Down
4 changes: 2 additions & 2 deletions encoding/wkb/wkb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func compare(t testing.TB, e orb.Geometry, b []byte) {
t.Errorf("decoder: incorrect geometry: %v != %v", g, e)
}

// Umarshal
// Unmarshal
g, err = Unmarshal(b)
if err != nil {
t.Fatalf("unmarshal: read error: %v", err)
Expand All @@ -92,7 +92,7 @@ func compare(t testing.TB, e orb.Geometry, b []byte) {
if !bytes.Equal(data, b) {
t.Logf("%v", data)
t.Logf("%v", b)
t.Errorf("marshal: incorrent encoding")
t.Errorf("marshal: incorrect encoding")
}

// preallocation
Expand Down
8 changes: 4 additions & 4 deletions encoding/wkt/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func unmarshalPoint(s string) (orb.Point, error) {
return tp, nil
}

// parsePoint pase point by (x y)
// parsePoint parse point by (x y)
func parsePoint(s string) (p orb.Point, err error) {
one, two, ok := cut(s, " ")
if !ok {
Expand Down Expand Up @@ -493,7 +493,7 @@ func splitByRegexpYield(s string, re *regexp.Regexp, set func(int), yield func(s
// We use a yield function because it was faster/used less memory than
// allocating an array of the results.
func splitOnComma(s string, yield func(s string) error) error {
// in WKT points are separtated by commas, coordinates in points are separted by spaces
// in WKT points are separated by commas, coordinates in points are separated by spaces
// e.g. 1 2,3 4,5 6,7 81 2,5 4
// we want to split this and find each point.

Expand Down Expand Up @@ -587,7 +587,7 @@ func trimSpace(s string) string {
}

// gets the ToUpper case of the first 20 chars.
// This is to determin the type without doing a full strings.ToUpper
// This is to determine the type without doing a full strings.ToUpper
func upperPrefix(s string) []byte {
prefix := make([]byte, 20)
for i := 0; i < 20 && i < len(s); i++ {
Expand All @@ -601,7 +601,7 @@ func upperPrefix(s string) []byte {
return prefix
}

// coppied here from strings.Cut so we don't require go1.18
// copied here from strings.Cut so we don't require go1.18
func cut(s, sep string) (before, after string, found bool) {
if i := strings.Index(s, sep); i >= 0 {
return s[:i], s[i+len(sep):], true
Expand Down
2 changes: 1 addition & 1 deletion equal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
)

// Equal returns if the two geometrires are equal.
// Equal returns if the two geometries are equal.
func Equal(g1, g2 Geometry) bool {
if g1 == nil || g2 == nil {
return g1 == g2
Expand Down
2 changes: 1 addition & 1 deletion geo/area_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestSignedArea(t *testing.T) {
t.Errorf("wrong area: %v != %v", val, tc.result)
}

// should work without redudant last point.
// should work without redundant last point.
if tc.ring[0] == tc.ring[len(tc.ring)-1] {
tc.ring = tc.ring[:len(tc.ring)-1]
val = SignedArea(tc.ring)
Expand Down
4 changes: 2 additions & 2 deletions geo/bound.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ func BoundWidth(b orb.Bound) float64 {
//MinLatitude is the minimum possible latitude
var minLatitude = deg2rad(-90)

//MaxLatitude is the maxiumum possible latitude
//MaxLatitude is the maximum possible latitude
var maxLatitude = deg2rad(90)

//MinLongitude is the minimum possible longitude
var minLongitude = deg2rad(-180)

//MaxLongitude is the maxiumum possible longitude
//MaxLongitude is the maximum possible longitude
var maxLongitude = deg2rad(180)

func deg2rad(d float64) float64 {
Expand Down
2 changes: 1 addition & 1 deletion geojson/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func ExampleFeatureCollection_foreignMembers() {
// {"features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[102,0.5]},"properties":{"prop0":"value0"}}],"title":"Title as Foreign Member","type":"FeatureCollection"}
}

// MyFeatureCollection is a depricated/no longer supported way to extract
// MyFeatureCollection is a deprecated/no longer supported way to extract
// foreign/extra members from a feature collection. Now an UnmarshalJSON
// method, like below, is required for it to work.
type MyFeatureCollection struct {
Expand Down
4 changes: 2 additions & 2 deletions geojson/geometry.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"go.mongodb.org/mongo-driver/bson/bsontype"
)

// ErrInvalidGeometry will be returned if a the json of the geometry is invalid.
// ErrInvalidGeometry will be returned if the json of the geometry is invalid.
var ErrInvalidGeometry = errors.New("geojson: invalid geometry")

// A Geometry matches the structure of a GeoJSON Geometry.
Expand Down Expand Up @@ -44,7 +44,7 @@ func NewGeometry(g orb.Geometry) *Geometry {
}

// Geometry returns the orb.Geometry for the geojson Geometry.
// This will convert the "Geometries" into a orb.Collection if applicable.
// This will convert the "Geometries" into an orb.Collection if applicable.
func (g *Geometry) Geometry() orb.Geometry {
if g.Coordinates != nil {
return g.Coordinates
Expand Down
4 changes: 2 additions & 2 deletions geojson/geometry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func TestHelperTypes(t *testing.T) {
}

// not the correct type should return error.
// non of they types directly supported are geometry collections.
// none of the types directly supported are geometry collections.
data, err = json.Marshal(NewGeometry(orb.Collection{orb.Point{}}))
if err != nil {
t.Errorf("unmarshal error: %v", err)
Expand Down Expand Up @@ -417,7 +417,7 @@ func TestHelperTypes(t *testing.T) {
}

// not the correct type should return error.
// non of they types directly supported are geometry collections.
// none of the types directly supported are geometry collections.
data, err = bson.Marshal(NewGeometry(orb.Collection{orb.Point{}}))
if err != nil {
t.Errorf("unmarshal error: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion maptile/tilecover/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# orb/maptile/tilecover [![Godoc Reference](https://pkg.go.dev/badge/github.com/paulmach/orb)](https://pkg.go.dev/github.com/paulmach/orb/maptile/tilecover)

Package `tilecover` computes the covering set of tiles for an `orb.Geometry`.
It is a a port of the nodejs library [tile-cover](https://github.com/mapbox/tile-cover)
It is a port of the nodejs library [tile-cover](https://github.com/mapbox/tile-cover)
which is a port from Google's S2 library. The same set of tests pass.

## Usage
Expand Down
Loading