diff --git a/README.md b/README.md index 9df2ed4..f26b1ff 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Implements the TopoJSON specification: https://github.com/mbostock/topojson-specification Uses the GeoJSON implementation of paulmach: -https://github.com/paulmach/go.geojson +https://github.com/paulmach/orb/geojson Large parts are a port of the canonical JavaScript implementation, big chunks of the test suite are ported as well: diff --git a/bounds.go b/bounds.go index 60052f2..687ab2f 100644 --- a/bounds.go +++ b/bounds.go @@ -3,7 +3,7 @@ package topojson import ( "math" - "github.com/paulmach/go.geojson" + "github.com/paulmach/orb" ) func (t *Topology) bounds() { @@ -20,25 +20,45 @@ func (t *Topology) bounds() { } -func (t *Topology) boundGeometry(g *geojson.Geometry) { - switch g.Type { - case geojson.GeometryCollection: - for _, geom := range g.Geometries { - t.boundGeometry(geom) +func (t *Topology) boundGeometry(g orb.Geometry) { + switch c := g.(type) { + case orb.Point: + t.BBox(c.Bound()) + case orb.MultiPoint: + t.BBox(c.Bound()) + case orb.LineString: + t.BBox(c.Bound()) + case orb.MultiLineString: + t.BBox(c.Bound()) + case orb.Polygon: + t.BBox(c.Bound()) + case orb.MultiPolygon: + t.BBox(c.Bound()) + case orb.Collection: + t.BBox(c.Bound()) + // for _, geo := range c { + // t.boundGeometry(geo) + // } + } +} + +func (t *Topology) BBox(b orb.Bound) { + xx := []float64{b.Min[0], b.Max[0]} + yy := []float64{b.Min[1], b.Max[1]} + for _, x := range xx { + if x < t.BoundingBox[0] { + t.BoundingBox[0] = x + } + if x > t.BoundingBox[2] { + t.BoundingBox[2] = x + } + } + for _, y := range yy { + if y < t.BoundingBox[1] { + t.BoundingBox[1] = y } - case geojson.GeometryPoint: - t.boundPoint(g.Point) - case geojson.GeometryMultiPoint: - t.boundPoints(g.MultiPoint) - case geojson.GeometryLineString: - t.boundPoints(g.LineString) - case geojson.GeometryMultiLineString: - t.boundMultiPoints(g.MultiLineString) - case geojson.GeometryPolygon: - t.boundMultiPoints(g.Polygon) - case geojson.GeometryMultiPolygon: - for _, poly := range g.MultiPolygon { - t.boundMultiPoints(poly) + if y > t.BoundingBox[3] { + t.BoundingBox[3] = y } } } diff --git a/bounds_test.go b/bounds_test.go index dee9f79..135afb8 100644 --- a/bounds_test.go +++ b/bounds_test.go @@ -4,19 +4,20 @@ import ( "testing" "github.com/cheekybits/is" - geojson "github.com/paulmach/go.geojson" + orb "github.com/paulmach/orb" + geojson "github.com/paulmach/orb/geojson" ) func TestBoundingBox(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("bar", geojson.NewLineStringGeometry([][]float64{ - {-1, 0}, {1, 0}, {-2, 3}, - })), + NewTestFeature("foo", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("bar", orb.LineString{ + orb.Point{-1, 0}, orb.Point{1, 0}, orb.Point{-2, 3}, + }), } topo := &Topology{input: in} diff --git a/cut_test.go b/cut_test.go index 87e55a7..5cc6f96 100644 --- a/cut_test.go +++ b/cut_test.go @@ -5,7 +5,8 @@ import ( "testing" "github.com/cheekybits/is" - "github.com/paulmach/go.geojson" + orb "github.com/paulmach/orb" + "github.com/paulmach/orb/geojson" ) // See https://github.com/mbostock/topojson/blob/master/test/topology/cut-test.js @@ -15,12 +16,12 @@ func TestCutDuplicates(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("abc2", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("abc2", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -28,13 +29,13 @@ func TestCutDuplicates(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abc2") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 5) is.Nil(o2.Arc.Next) @@ -45,12 +46,12 @@ func TestCutReversedDuplicates(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), } topo := &Topology{input: in} @@ -58,13 +59,13 @@ func TestCutReversedDuplicates(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "cba") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 5) is.Nil(o2.Arc.Next) @@ -75,16 +76,16 @@ func TestCutDuplicateRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), - NewTestFeature("abca2", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + }), + NewTestFeature("abca2", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -92,14 +93,14 @@ func TestCutDuplicateRings(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "abca2") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -111,16 +112,16 @@ func TestCutReversedDuplicateRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), - NewTestFeature("acba", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {2, 0}, {1, 0}, {0, 0}, + }), + NewTestFeature("acba", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -128,14 +129,14 @@ func TestCutReversedDuplicateRings(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "acba") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -147,16 +148,16 @@ func TestCutRotatedDuplicateRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), - NewTestFeature("bcab", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {2, 0}, {0, 0}, {1, 0}, + }), + NewTestFeature("bcab", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -164,14 +165,14 @@ func TestCutRotatedDuplicateRings(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "bcab") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -183,14 +184,14 @@ func TestCutRingLine(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcaLine", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {0, 0}, - })), - NewTestFeature("abcaPolygon", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abcaLine", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, + }), + NewTestFeature("abcaPolygon", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -198,13 +199,13 @@ func TestCutRingLine(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abcaLine") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 3) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abcaPolygon") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -216,14 +217,14 @@ func TestCutRingLineReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcaLine", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {0, 0}, - })), - NewTestFeature("bcabPolygon", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {2, 0}, {0, 0}, {1, 0}, + NewTestFeature("abcaLine", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, + }), + NewTestFeature("bcabPolygon", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -231,13 +232,13 @@ func TestCutRingLineReversed(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abcaLine") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 3) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "bcabPolygon") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -249,14 +250,14 @@ func TestCutRingLineReversed2(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("bcabLine", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, {0, 0}, {1, 0}, - })), - NewTestFeature("abcaPolygon", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("bcabLine", orb.LineString{ + orb.Point{1, 0}, {2, 0}, orb.Point{0, 0}, orb.Point{1, 0}, + }), + NewTestFeature("abcaPolygon", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -264,13 +265,13 @@ func TestCutRingLineReversed2(t *testing.T) { topo.cut() o1 := GetFeature(topo, "bcabLine") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 3) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abcaPolygon") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -282,12 +283,12 @@ func TestCutOldArcExtends(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, + }), } topo := &Topology{input: in} @@ -295,7 +296,7 @@ func TestCutOldArcExtends(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -303,7 +304,7 @@ func TestCutOldArcExtends(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "ab") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Nil(o2.Arc.Next) @@ -314,12 +315,12 @@ func TestCutReversedOldArcExtends(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, + }), } topo := &Topology{input: in} @@ -327,7 +328,7 @@ func TestCutReversedOldArcExtends(t *testing.T) { topo.cut() o1 := GetFeature(topo, "cba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -335,7 +336,7 @@ func TestCutReversedOldArcExtends(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "ab") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Nil(o2.Arc.Next) @@ -346,12 +347,12 @@ func TestCutNewArcSharesStart(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("ade", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 1}, {2, 1}, - })), + NewTestFeature("ade", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 1}, orb.Point{2, 1}, + }), } topo := &Topology{input: in} @@ -359,13 +360,13 @@ func TestCutNewArcSharesStart(t *testing.T) { topo.cut() o1 := GetFeature(topo, "ade") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 5) is.Nil(o2.Arc.Next) @@ -376,11 +377,11 @@ func TestCutRingNoCuts(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("aba", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 0}, + NewTestFeature("aba", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -388,7 +389,7 @@ func TestCutRingNoCuts(t *testing.T) { topo.cut() o1 := GetFeature(topo, "aba") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 2) @@ -400,11 +401,11 @@ func TestCutRingAANoCuts(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("aa", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {0, 0}, + NewTestFeature("aa", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -412,7 +413,7 @@ func TestCutRingAANoCuts(t *testing.T) { topo.cut() o1 := GetFeature(topo, "aa") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 1) @@ -424,11 +425,11 @@ func TestCutRingANoCuts(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("a", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, + NewTestFeature("a", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -436,7 +437,7 @@ func TestCutRingANoCuts(t *testing.T) { topo.cut() o1 := GetFeature(topo, "a") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 0) @@ -448,12 +449,12 @@ func TestCutNewLineSharesEnd(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("dec", geojson.NewLineStringGeometry([][]float64{ - {0, 1}, {1, 1}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("dec", orb.LineString{ + orb.Point{0, 1}, orb.Point{1, 1}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -461,13 +462,13 @@ func TestCutNewLineSharesEnd(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "dec") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 5) is.Nil(o2.Arc.Next) @@ -478,12 +479,12 @@ func TestCutNewLineExtends(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, - })), - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, + }), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -491,13 +492,13 @@ func TestCutNewLineExtends(t *testing.T) { topo.cut() o1 := GetFeature(topo, "ab") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 2) is.Equal(o2.Arc.End, 3) is.Equal(o2.Arc.Next.Start, 3) @@ -510,12 +511,12 @@ func TestCutNewLineExtendsReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("ba", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {0, 0}, - })), - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("ba", orb.LineString{ + orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -523,13 +524,13 @@ func TestCutNewLineExtendsReversed(t *testing.T) { topo.cut() o1 := GetFeature(topo, "ba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 2) is.Equal(o2.Arc.End, 3) is.Equal(o2.Arc.Next.Start, 3) @@ -542,12 +543,12 @@ func TestCutNewStartsMiddle(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("bc", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("bc", orb.LineString{ + orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -555,7 +556,7 @@ func TestCutNewStartsMiddle(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -563,7 +564,7 @@ func TestCutNewStartsMiddle(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "bc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Nil(o2.Arc.Next) @@ -574,12 +575,12 @@ func TestCutNewStartsMiddleReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("bc", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("bc", orb.LineString{ + orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -587,7 +588,7 @@ func TestCutNewStartsMiddleReversed(t *testing.T) { topo.cut() o1 := GetFeature(topo, "cba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -595,7 +596,7 @@ func TestCutNewStartsMiddleReversed(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "bc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Nil(o2.Arc.Next) @@ -606,12 +607,12 @@ func TestCutNewLineDeviates(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("abd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("abd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, + }), } topo := &Topology{input: in} @@ -619,7 +620,7 @@ func TestCutNewLineDeviates(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -627,7 +628,7 @@ func TestCutNewLineDeviates(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "abd") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Equal(o2.Arc.Next.Start, 4) @@ -640,12 +641,12 @@ func TestCutNewLineDeviatesReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("abd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("abd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, + }), } topo := &Topology{input: in} @@ -653,7 +654,7 @@ func TestCutNewLineDeviatesReversed(t *testing.T) { topo.cut() o1 := GetFeature(topo, "cba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -661,7 +662,7 @@ func TestCutNewLineDeviatesReversed(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "abd") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Equal(o2.Arc.Next.Start, 4) @@ -674,12 +675,12 @@ func TestCutNewLineMerges(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("dbc", geojson.NewLineStringGeometry([][]float64{ - {3, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("dbc", orb.LineString{ + orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -687,7 +688,7 @@ func TestCutNewLineMerges(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -695,7 +696,7 @@ func TestCutNewLineMerges(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "dbc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Equal(o2.Arc.Next.Start, 4) @@ -708,12 +709,12 @@ func TestCutNewLineMergesReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("dbc", geojson.NewLineStringGeometry([][]float64{ - {3, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("dbc", orb.LineString{ + orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -721,7 +722,7 @@ func TestCutNewLineMergesReversed(t *testing.T) { topo.cut() o1 := GetFeature(topo, "cba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -729,7 +730,7 @@ func TestCutNewLineMergesReversed(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "dbc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Equal(o2.Arc.Next.Start, 4) @@ -742,12 +743,12 @@ func TestCutNewLineSharesMidpoint(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("dbe", geojson.NewLineStringGeometry([][]float64{ - {0, 1}, {1, 0}, {2, 1}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("dbe", orb.LineString{ + orb.Point{0, 1}, orb.Point{1, 0}, orb.Point{2, 1}, + }), } topo := &Topology{input: in} @@ -755,7 +756,7 @@ func TestCutNewLineSharesMidpoint(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -763,7 +764,7 @@ func TestCutNewLineSharesMidpoint(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "dbe") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Equal(o2.Arc.Next.Start, 4) @@ -776,12 +777,12 @@ func TestCutNewLineSkipsPoint(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcde", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, - })), - NewTestFeature("adbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("abcde", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), + NewTestFeature("adbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -789,7 +790,7 @@ func TestCutNewLineSkipsPoint(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abcde") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) o1Next := o1.Arc.Next @@ -800,7 +801,7 @@ func TestCutNewLineSkipsPoint(t *testing.T) { is.Nil(o1Next.Next.Next) o2 := GetFeature(topo, "adbe") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 5) is.Equal(o2.Arc.End, 6) o2Next := o2.Arc.Next @@ -816,12 +817,12 @@ func TestCutNewLineSkipsPointReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("edcba", geojson.NewLineStringGeometry([][]float64{ - {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("adbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("edcba", orb.LineString{ + orb.Point{4, 0}, orb.Point{3, 0}, orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("adbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -829,7 +830,7 @@ func TestCutNewLineSkipsPointReversed(t *testing.T) { topo.cut() o1 := GetFeature(topo, "edcba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) o1Next := o1.Arc.Next @@ -840,7 +841,7 @@ func TestCutNewLineSkipsPointReversed(t *testing.T) { is.Nil(o1Next.Next.Next) o2 := GetFeature(topo, "adbe") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 5) is.Equal(o2.Arc.End, 6) o2Next := o2.Arc.Next @@ -856,9 +857,9 @@ func TestCutSelfIntersectsMiddle(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcdbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {3, 0}, {1, 0}, {4, 0}, - })), + NewTestFeature("abcdbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -866,7 +867,7 @@ func TestCutSelfIntersectsMiddle(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abcdbe") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 5) is.Nil(o1.Arc.Next) @@ -877,9 +878,9 @@ func TestCutSelfIntersectsStart(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abacd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {0, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("abacd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -887,7 +888,7 @@ func TestCutSelfIntersectsStart(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abacd") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Equal(o1.Arc.Next.Start, 2) @@ -900,9 +901,9 @@ func TestCutSelfIntersectsEnd(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcdbd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {4, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("abcdbd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{4, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -910,7 +911,7 @@ func TestCutSelfIntersectsEnd(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abcdbd") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Equal(o1.Arc.Next.Start, 2) @@ -923,12 +924,12 @@ func TestCutSelfIntersectsShares(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcdbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {3, 0}, {1, 0}, {4, 0}, - })), - NewTestFeature("fbg", geojson.NewLineStringGeometry([][]float64{ - {0, 1}, {1, 0}, {2, 1}, - })), + NewTestFeature("abcdbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{4, 0}, + }), + NewTestFeature("fbg", orb.LineString{ + orb.Point{0, 1}, orb.Point{1, 0}, orb.Point{2, 1}, + }), } topo := &Topology{input: in} @@ -936,7 +937,7 @@ func TestCutSelfIntersectsShares(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abcdbe") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) o1Next := o1.Arc.Next @@ -947,7 +948,7 @@ func TestCutSelfIntersectsShares(t *testing.T) { is.Nil(o1Next.Next.Next) o2 := GetFeature(topo, "fbg") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 6) is.Equal(o2.Arc.End, 7) is.Equal(o2.Arc.Next.Start, 7) @@ -960,9 +961,9 @@ func TestCutLineClosed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {0, 1}, {0, 0}, - })), + NewTestFeature("abca", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, + }), } topo := &Topology{input: in} @@ -970,7 +971,7 @@ func TestCutLineClosed(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 3) is.Nil(o1.Arc.Next) @@ -981,11 +982,11 @@ func TestCutRingClosed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -993,7 +994,7 @@ func TestCutRingClosed(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) @@ -1005,16 +1006,16 @@ func TestCutDuplicateRingsShare(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("abca2", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + }), + NewTestFeature("abca2", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1022,14 +1023,14 @@ func TestCutDuplicateRingsShare(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "abca2") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -1041,16 +1042,16 @@ func TestCutDuplicateRingsReversedShare(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("acba", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {0, 1}, {1, 0}, {0, 0}, + }), + NewTestFeature("acba", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{0, 1}, orb.Point{1, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1058,14 +1059,14 @@ func TestCutDuplicateRingsReversedShare(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "acba") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -1077,16 +1078,16 @@ func TestCutCoincidentRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("bcab", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {0, 1}, {0, 0}, {1, 0}, + }), + NewTestFeature("bcab", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1094,14 +1095,14 @@ func TestCutCoincidentRings(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "bcab") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -1113,16 +1114,16 @@ func TestCutCoincidentRings2(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("bacb", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {0, 0}, {0, 1}, {1, 0}, + }), + NewTestFeature("bacb", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{0, 0}, orb.Point{0, 1}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1130,14 +1131,14 @@ func TestCutCoincidentRings2(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "bacb") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -1149,21 +1150,21 @@ func TestCutCoincidentRings3(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcda", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}, + NewTestFeature("abcda", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{1, 1}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("efae", geojson.NewPolygonGeometry([][][]float64{ - { - {0, -1}, {1, -1}, {0, 0}, {0, -1}, + }), + NewTestFeature("efae", orb.Polygon{ + orb.Ring{ + orb.Point{0, -1}, orb.Point{1, -1}, orb.Point{0, 0}, orb.Point{0, -1}, }, - })), - NewTestFeature("ghcg", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 2}, {1, 2}, {1, 1}, {0, 2}, + }), + NewTestFeature("ghcg", orb.Polygon{ + orb.Ring{ + orb.Point{0, 2}, orb.Point{1, 2}, orb.Point{1, 1}, orb.Point{0, 2}, }, - })), + }), } topo := &Topology{input: in} @@ -1171,7 +1172,7 @@ func TestCutCoincidentRings3(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abcda") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 2) @@ -1180,14 +1181,14 @@ func TestCutCoincidentRings3(t *testing.T) { is.Nil(o1.Arcs[0].Next.Next) o2 := GetFeature(topo, "efae") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 5) is.Equal(o2.Arcs[0].End, 8) is.Nil(o2.Arcs[0].Next) o3 := GetFeature(topo, "ghcg") - is.Equal(o3.Type, geojson.GeometryPolygon) + is.Equal(o3.Type, geojson.TypePolygon) is.Equal(len(o3.Arcs), 1) is.Equal(o3.Arcs[0].Start, 9) is.Equal(o3.Arcs[0].End, 12) @@ -1199,16 +1200,16 @@ func TestCutNoCutsButRotated(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("dbed", geojson.NewPolygonGeometry([][][]float64{ - { - {2, 1}, {1, 0}, {2, 2}, {2, 1}, + }), + NewTestFeature("dbed", orb.Polygon{ + orb.Ring{ + orb.Point{2, 1}, orb.Point{1, 0}, orb.Point{2, 2}, orb.Point{2, 1}, }, - })), + }), } topo := &Topology{input: in} @@ -1216,14 +1217,14 @@ func TestCutNoCutsButRotated(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "dbed") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -1242,16 +1243,16 @@ func TestCutOverlapping(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcda", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}, // rotated to BCDAB, cut BC-CDAB + NewTestFeature("abcda", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{1, 1}, orb.Point{0, 1}, orb.Point{0, 0}, // rotated to BCDAB, cut BC-CDAB }, - })), - NewTestFeature("befcb", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {2, 0}, {2, 1}, {1, 1}, {1, 0}, + }), + NewTestFeature("befcb", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{2, 1}, orb.Point{1, 1}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1259,7 +1260,7 @@ func TestCutOverlapping(t *testing.T) { topo.cut() o1 := GetFeature(topo, "abcda") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 1) @@ -1268,7 +1269,7 @@ func TestCutOverlapping(t *testing.T) { is.Nil(o1.Arcs[0].Next.Next) o2 := GetFeature(topo, "befcb") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 5) is.Equal(o2.Arcs[0].End, 8) diff --git a/dedup_test.go b/dedup_test.go index d264071..ae55dcf 100644 --- a/dedup_test.go +++ b/dedup_test.go @@ -5,7 +5,8 @@ import ( "testing" "github.com/cheekybits/is" - "github.com/paulmach/go.geojson" + orb "github.com/paulmach/orb" + "github.com/paulmach/orb/geojson" ) // See https://github.com/mbostock/topojson/blob/master/test/topology/dedup-test.js @@ -15,12 +16,12 @@ func TestDedupDuplicates(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("abc2", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("abc2", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -29,13 +30,13 @@ func TestDedupDuplicates(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abc2") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 0) is.Equal(o2.Arc.End, 2) is.Nil(o2.Arc.Next) @@ -46,12 +47,12 @@ func TestDedupReversedDuplicates(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), } topo := &Topology{input: in} @@ -60,13 +61,13 @@ func TestDedupReversedDuplicates(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "cba") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 2) is.Equal(o2.Arc.End, 0) is.Nil(o2.Arc.Next) @@ -77,16 +78,16 @@ func TestDedupDuplicateRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), - NewTestFeature("abca2", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + }), + NewTestFeature("abca2", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -95,14 +96,14 @@ func TestDedupDuplicateRings(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "abca2") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 0) is.Equal(o2.Arcs[0].End, 3) @@ -114,16 +115,16 @@ func TestDedupReversedDuplicateRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), - NewTestFeature("acba", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {2, 0}, {1, 0}, {0, 0}, + }), + NewTestFeature("acba", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -132,14 +133,14 @@ func TestDedupReversedDuplicateRings(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "acba") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 3) is.Equal(o2.Arcs[0].End, 0) @@ -151,16 +152,16 @@ func TestDedupRotatedDuplicateRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), - NewTestFeature("bcab", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {2, 0}, {0, 0}, {1, 0}, + }), + NewTestFeature("bcab", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -169,14 +170,14 @@ func TestDedupRotatedDuplicateRings(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "bcab") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 0) is.Equal(o2.Arcs[0].End, 3) @@ -188,14 +189,14 @@ func TestDedupRingLine(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcaLine", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {0, 0}, - })), - NewTestFeature("abcaPolygon", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abcaLine", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, + }), + NewTestFeature("abcaPolygon", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -204,13 +205,13 @@ func TestDedupRingLine(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abcaLine") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 3) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abcaPolygon") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 0) is.Equal(o2.Arcs[0].End, 3) @@ -222,14 +223,14 @@ func TestDedupRingLineReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcaLine", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {0, 0}, - })), - NewTestFeature("bcabPolygon", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {2, 0}, {0, 0}, {1, 0}, + NewTestFeature("abcaLine", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, + }), + NewTestFeature("bcabPolygon", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -238,13 +239,13 @@ func TestDedupRingLineReversed(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abcaLine") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 3) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "bcabPolygon") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 0) is.Equal(o2.Arcs[0].End, 3) @@ -260,14 +261,14 @@ func TestDedupRingLineReversed2(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("bcabLine", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, {0, 0}, {1, 0}, - })), - NewTestFeature("abcaPolygon", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("bcabLine", orb.LineString{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, orb.Point{1, 0}, + }), + NewTestFeature("abcaPolygon", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -276,13 +277,13 @@ func TestDedupRingLineReversed2(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "bcabLine") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 3) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abcaPolygon") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 0) is.Equal(o2.Arcs[0].End, 3) @@ -294,12 +295,12 @@ func TestDedupOldArcExtends(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, + }), } topo := &Topology{input: in} @@ -308,7 +309,7 @@ func TestDedupOldArcExtends(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -316,7 +317,7 @@ func TestDedupOldArcExtends(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "ab") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 0) is.Equal(o2.Arc.End, 1) is.Nil(o2.Arc.Next) @@ -327,12 +328,12 @@ func TestDedupReversedOldArcExtends(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, + }), } topo := &Topology{input: in} @@ -341,7 +342,7 @@ func TestDedupReversedOldArcExtends(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "cba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -349,7 +350,7 @@ func TestDedupReversedOldArcExtends(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "ab") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 2) is.Equal(o2.Arc.End, 1) is.Nil(o2.Arc.Next) @@ -360,12 +361,12 @@ func TestDedupNewArcSharesStart(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("ade", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 1}, {2, 1}, - })), + NewTestFeature("ade", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 1}, orb.Point{2, 1}, + }), } topo := &Topology{input: in} @@ -374,13 +375,13 @@ func TestDedupNewArcSharesStart(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "ade") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 5) is.Nil(o2.Arc.Next) @@ -391,11 +392,11 @@ func TestDedupRingNoCuts(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("aba", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 0}, + NewTestFeature("aba", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -404,7 +405,7 @@ func TestDedupRingNoCuts(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "aba") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 2) @@ -416,11 +417,11 @@ func TestDedupRingAANoCuts(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("aa", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {0, 0}, + NewTestFeature("aa", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -429,7 +430,7 @@ func TestDedupRingAANoCuts(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "aa") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 1) @@ -441,11 +442,11 @@ func TestDedupRingANoCuts(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("a", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, + NewTestFeature("a", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -454,7 +455,7 @@ func TestDedupRingANoCuts(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "a") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 0) @@ -466,12 +467,12 @@ func TestDedupNewLineSharesEnd(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("dec", geojson.NewLineStringGeometry([][]float64{ - {0, 1}, {1, 1}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("dec", orb.LineString{ + orb.Point{0, 1}, orb.Point{1, 1}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -480,13 +481,13 @@ func TestDedupNewLineSharesEnd(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "dec") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 5) is.Nil(o2.Arc.Next) @@ -497,12 +498,12 @@ func TestDedupNewLineExtends(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, - })), - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, + }), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -511,13 +512,13 @@ func TestDedupNewLineExtends(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "ab") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 0) is.Equal(o2.Arc.End, 1) is.Equal(o2.Arc.Next.Start, 3) @@ -530,12 +531,12 @@ func TestDedupNewLineExtendsReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("ba", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {0, 0}, - })), - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("ba", orb.LineString{ + orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -544,13 +545,13 @@ func TestDedupNewLineExtendsReversed(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "ba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Nil(o1.Arc.Next) o2 := GetFeature(topo, "abc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 1) is.Equal(o2.Arc.End, 0) is.Equal(o2.Arc.Next.Start, 3) @@ -563,12 +564,12 @@ func TestDedupNewStartsMiddle(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("bc", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("bc", orb.LineString{ + orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -577,7 +578,7 @@ func TestDedupNewStartsMiddle(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -585,7 +586,7 @@ func TestDedupNewStartsMiddle(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "bc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 1) is.Equal(o2.Arc.End, 2) is.Nil(o2.Arc.Next) @@ -596,12 +597,12 @@ func TestDedupNewStartsMiddleReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("bc", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("bc", orb.LineString{ + orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -610,7 +611,7 @@ func TestDedupNewStartsMiddleReversed(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "cba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -618,7 +619,7 @@ func TestDedupNewStartsMiddleReversed(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "bc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 1) is.Equal(o2.Arc.End, 0) is.Nil(o2.Arc.Next) @@ -629,12 +630,12 @@ func TestDedupNewLineDeviates(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("abd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("abd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, + }), } topo := &Topology{input: in} @@ -643,7 +644,7 @@ func TestDedupNewLineDeviates(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -651,7 +652,7 @@ func TestDedupNewLineDeviates(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "abd") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 0) is.Equal(o2.Arc.End, 1) is.Equal(o2.Arc.Next.Start, 4) @@ -664,12 +665,12 @@ func TestDedupNewLineDeviatesReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("abd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("abd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, + }), } topo := &Topology{input: in} @@ -678,7 +679,7 @@ func TestDedupNewLineDeviatesReversed(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "cba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -686,7 +687,7 @@ func TestDedupNewLineDeviatesReversed(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "abd") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 2) is.Equal(o2.Arc.End, 1) is.Equal(o2.Arc.Next.Start, 4) @@ -699,12 +700,12 @@ func TestDedupNewLineMerges(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("dbc", geojson.NewLineStringGeometry([][]float64{ - {3, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("dbc", orb.LineString{ + orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -713,7 +714,7 @@ func TestDedupNewLineMerges(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -721,7 +722,7 @@ func TestDedupNewLineMerges(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "dbc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Equal(o2.Arc.Next.Start, 1) @@ -734,12 +735,12 @@ func TestDedupNewLineMergesReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("dbc", geojson.NewLineStringGeometry([][]float64{ - {3, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("dbc", orb.LineString{ + orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -748,7 +749,7 @@ func TestDedupNewLineMergesReversed(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "cba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -756,7 +757,7 @@ func TestDedupNewLineMergesReversed(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "dbc") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Equal(o2.Arc.Next.Start, 1) @@ -769,12 +770,12 @@ func TestDedupNewLineSharesMidpoint(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("dbe", geojson.NewLineStringGeometry([][]float64{ - {0, 1}, {1, 0}, {2, 1}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("dbe", orb.LineString{ + orb.Point{0, 1}, orb.Point{1, 0}, orb.Point{2, 1}, + }), } topo := &Topology{input: in} @@ -783,7 +784,7 @@ func TestDedupNewLineSharesMidpoint(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abc") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) is.Equal(o1.Arc.Next.Start, 1) @@ -791,7 +792,7 @@ func TestDedupNewLineSharesMidpoint(t *testing.T) { is.Nil(o1.Arc.Next.Next) o2 := GetFeature(topo, "dbe") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 3) is.Equal(o2.Arc.End, 4) is.Equal(o2.Arc.Next.Start, 4) @@ -804,12 +805,12 @@ func TestDedupNewLineSkipsPoint(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcde", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, - })), - NewTestFeature("adbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("abcde", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), + NewTestFeature("adbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -818,7 +819,7 @@ func TestDedupNewLineSkipsPoint(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abcde") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) o1Next := o1.Arc.Next @@ -829,7 +830,7 @@ func TestDedupNewLineSkipsPoint(t *testing.T) { is.Nil(o1Next.Next.Next) o2 := GetFeature(topo, "adbe") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 0) is.Equal(o2.Arc.End, 1) o2Next := o2.Arc.Next @@ -845,12 +846,12 @@ func TestDedupNewLineSkipsPointReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("edcba", geojson.NewLineStringGeometry([][]float64{ - {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("adbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("edcba", orb.LineString{ + orb.Point{4, 0}, orb.Point{3, 0}, orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("adbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -859,7 +860,7 @@ func TestDedupNewLineSkipsPointReversed(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "edcba") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) o1Next := o1.Arc.Next @@ -870,7 +871,7 @@ func TestDedupNewLineSkipsPointReversed(t *testing.T) { is.Nil(o1Next.Next.Next) o2 := GetFeature(topo, "adbe") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 4) is.Equal(o2.Arc.End, 3) o2Next := o2.Arc.Next @@ -886,9 +887,9 @@ func TestDedupSelfIntersectsMiddle(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcdbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {3, 0}, {1, 0}, {4, 0}, - })), + NewTestFeature("abcdbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -897,7 +898,7 @@ func TestDedupSelfIntersectsMiddle(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abcdbe") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 5) is.Nil(o1.Arc.Next) @@ -908,9 +909,9 @@ func TestDedupSelfIntersectsStart(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abacd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {0, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("abacd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -919,7 +920,7 @@ func TestDedupSelfIntersectsStart(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abacd") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Equal(o1.Arc.Next.Start, 2) @@ -932,9 +933,9 @@ func TestDedupSelfIntersectsEnd(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcdbd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {4, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("abcdbd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{4, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -943,7 +944,7 @@ func TestDedupSelfIntersectsEnd(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abcdbd") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 2) is.Equal(o1.Arc.Next.Start, 2) @@ -956,12 +957,12 @@ func TestDedupSelfIntersectsShares(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcdbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {3, 0}, {1, 0}, {4, 0}, - })), - NewTestFeature("fbg", geojson.NewLineStringGeometry([][]float64{ - {0, 1}, {1, 0}, {2, 1}, - })), + NewTestFeature("abcdbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{4, 0}, + }), + NewTestFeature("fbg", orb.LineString{ + orb.Point{0, 1}, orb.Point{1, 0}, orb.Point{2, 1}, + }), } topo := &Topology{input: in} @@ -970,7 +971,7 @@ func TestDedupSelfIntersectsShares(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abcdbe") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 1) o1Next := o1.Arc.Next @@ -981,7 +982,7 @@ func TestDedupSelfIntersectsShares(t *testing.T) { is.Nil(o1Next.Next.Next) o2 := GetFeature(topo, "fbg") - is.Equal(o2.Type, geojson.GeometryLineString) + is.Equal(o2.Type, geojson.TypeLineString) is.Equal(o2.Arc.Start, 6) is.Equal(o2.Arc.End, 7) is.Equal(o2.Arc.Next.Start, 7) @@ -994,9 +995,9 @@ func TestDedupLineClosed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {0, 1}, {0, 0}, - })), + NewTestFeature("abca", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, + }), } topo := &Topology{input: in} @@ -1005,7 +1006,7 @@ func TestDedupLineClosed(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryLineString) + is.Equal(o1.Type, geojson.TypeLineString) is.Equal(o1.Arc.Start, 0) is.Equal(o1.Arc.End, 3) is.Nil(o1.Arc.Next) @@ -1016,11 +1017,11 @@ func TestDedupRingClosed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1029,7 +1030,7 @@ func TestDedupRingClosed(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) @@ -1041,16 +1042,16 @@ func TestDedupDuplicateRingsShare(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("abca2", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + }), + NewTestFeature("abca2", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1059,14 +1060,14 @@ func TestDedupDuplicateRingsShare(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "abca2") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 0) is.Equal(o2.Arcs[0].End, 3) @@ -1078,16 +1079,16 @@ func TestDedupDuplicateRingsReversedShare(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("acba", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {0, 1}, {1, 0}, {0, 0}, + }), + NewTestFeature("acba", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{0, 1}, orb.Point{1, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1096,14 +1097,14 @@ func TestDedupDuplicateRingsReversedShare(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "acba") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 3) is.Equal(o2.Arcs[0].End, 0) @@ -1115,16 +1116,16 @@ func TestDedupCoincidentRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("bcab", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {0, 1}, {0, 0}, {1, 0}, + }), + NewTestFeature("bcab", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1133,14 +1134,14 @@ func TestDedupCoincidentRings(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "bcab") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 0) is.Equal(o2.Arcs[0].End, 3) @@ -1152,16 +1153,16 @@ func TestDedupCoincidentRings2(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("bacb", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {0, 0}, {0, 1}, {1, 0}, + }), + NewTestFeature("bacb", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{0, 0}, orb.Point{0, 1}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1170,14 +1171,14 @@ func TestDedupCoincidentRings2(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "bacb") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 3) is.Equal(o2.Arcs[0].End, 0) @@ -1189,21 +1190,21 @@ func TestDedupCoincidentRings3(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcda", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}, + NewTestFeature("abcda", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{1, 1}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("efae", geojson.NewPolygonGeometry([][][]float64{ - { - {0, -1}, {1, -1}, {0, 0}, {0, -1}, + }), + NewTestFeature("efae", orb.Polygon{ + orb.Ring{ + orb.Point{0, -1}, orb.Point{1, -1}, orb.Point{0, 0}, orb.Point{0, -1}, }, - })), - NewTestFeature("ghcg", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 2}, {1, 2}, {1, 1}, {0, 2}, + }), + NewTestFeature("ghcg", orb.Polygon{ + orb.Ring{ + orb.Point{0, 2}, orb.Point{1, 2}, orb.Point{1, 1}, orb.Point{0, 2}, }, - })), + }), } topo := &Topology{input: in} @@ -1212,7 +1213,7 @@ func TestDedupCoincidentRings3(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abcda") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 2) @@ -1221,14 +1222,14 @@ func TestDedupCoincidentRings3(t *testing.T) { is.Nil(o1.Arcs[0].Next.Next) o2 := GetFeature(topo, "efae") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 5) is.Equal(o2.Arcs[0].End, 8) is.Nil(o2.Arcs[0].Next) o3 := GetFeature(topo, "ghcg") - is.Equal(o3.Type, geojson.GeometryPolygon) + is.Equal(o3.Type, geojson.TypePolygon) is.Equal(len(o3.Arcs), 1) is.Equal(o3.Arcs[0].Start, 9) is.Equal(o3.Arcs[0].End, 12) @@ -1240,16 +1241,16 @@ func TestDedupNoCutsButRotated(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("dbed", geojson.NewPolygonGeometry([][][]float64{ - { - {2, 1}, {1, 0}, {2, 2}, {2, 1}, + }), + NewTestFeature("dbed", orb.Polygon{ + orb.Ring{ + orb.Point{2, 1}, orb.Point{1, 0}, orb.Point{2, 2}, orb.Point{2, 1}, }, - })), + }), } topo := &Topology{input: in} @@ -1258,14 +1259,14 @@ func TestDedupNoCutsButRotated(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abca") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 3) is.Nil(o1.Arcs[0].Next) o2 := GetFeature(topo, "dbed") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 4) is.Equal(o2.Arcs[0].End, 7) @@ -1284,16 +1285,16 @@ func TestDedupOverlapping(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcda", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}, // rotated to BCDAB, cut BC-CDAB + NewTestFeature("abcda", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{1, 1}, orb.Point{0, 1}, orb.Point{0, 0}, // rotated to BCDAB, cut BC-CDAB }, - })), - NewTestFeature("befcb", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {2, 0}, {2, 1}, {1, 1}, {1, 0}, + }), + NewTestFeature("befcb", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{2, 1}, orb.Point{1, 1}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -1302,7 +1303,7 @@ func TestDedupOverlapping(t *testing.T) { topo.dedup() o1 := GetFeature(topo, "abcda") - is.Equal(o1.Type, geojson.GeometryPolygon) + is.Equal(o1.Type, geojson.TypePolygon) is.Equal(len(o1.Arcs), 1) is.Equal(o1.Arcs[0].Start, 0) is.Equal(o1.Arcs[0].End, 1) @@ -1311,7 +1312,7 @@ func TestDedupOverlapping(t *testing.T) { is.Nil(o1.Arcs[0].Next.Next) o2 := GetFeature(topo, "befcb") - is.Equal(o2.Type, geojson.GeometryPolygon) + is.Equal(o2.Type, geojson.TypePolygon) is.Equal(len(o2.Arcs), 1) is.Equal(o2.Arcs[0].Start, 5) is.Equal(o2.Arcs[0].End, 8) diff --git a/doc.go b/doc.go index 5aa85ae..1a064a3 100644 --- a/doc.go +++ b/doc.go @@ -5,5 +5,5 @@ // https://github.com/mbostock/topojson-specification // // Uses the GeoJSON implementation of paulmach: -// https://github.com/paulmach/go.geojson +// https://github.com/paulmach/orb/geojson package topojson diff --git a/extract.go b/extract.go index b76a6b1..757fe6d 100644 --- a/extract.go +++ b/extract.go @@ -3,7 +3,8 @@ package topojson import ( "fmt" - "github.com/paulmach/go.geojson" + "github.com/paulmach/orb" + "github.com/paulmach/orb/geojson" ) func (t *Topology) extract() { @@ -22,69 +23,78 @@ func (t *Topology) extract() { func (t *Topology) extractFeature(f *geojson.Feature) *topologyObject { g := f.Geometry - o := t.extractGeometry(g) + o := t.extractGeometry(geojson.NewGeometry(g)) - idProp := "id" - if t.opts != nil && t.opts.IDProperty != "" { - idProp = t.opts.IDProperty - } + // TODO + // idProp := "id" + // if t.opts != nil && t.opts.IDProperty != "" { + // idProp = t.opts.IDProperty + // } - id, err := f.PropertyString(idProp) - if err == nil { - o.ID = id + if f.ID != nil { + o.ID = fmt.Sprint(f.ID) } - o.Properties = f.Properties - o.BoundingBox = f.BoundingBox - + o.BoundingBox = f.BBox return o } func (t *Topology) extractGeometry(g *geojson.Geometry) *topologyObject { o := &topologyObject{ - Type: g.Type, - BoundingBox: g.BoundingBox, + Type: g.Type, } + // TODO + // if g.Coordinates != nil { + // o.BoundingBox = []float64{ + // g.Coordinates.Bound().Min[0], + // g.Coordinates.Bound().Min[1], + // g.Coordinates.Bound().Max[0], + // g.Coordinates.Bound().Max[1], + // } + // } + switch g.Type { - case geojson.GeometryCollection: + default: for _, geom := range g.Geometries { o.Geometries = append(o.Geometries, t.extractGeometry(geom)) } - case geojson.GeometryLineString: - o.Arc = t.extractLine(g.LineString) - case geojson.GeometryMultiLineString: - o.Arcs = make([]*arc, len(g.MultiLineString)) - for i, l := range g.MultiLineString { + case geojson.TypeLineString: + o.Arc = t.extractLine(g.Coordinates.(orb.LineString)) + case geojson.TypeMultiLineString: + o.Arcs = make([]*arc, len(g.Coordinates.(orb.MultiLineString))) + for i, l := range g.Coordinates.(orb.MultiLineString) { o.Arcs[i] = t.extractLine(l) } - case geojson.GeometryPolygon: - o.Arcs = make([]*arc, len(g.Polygon)) - for i, r := range g.Polygon { + case geojson.TypePolygon: + o.Arcs = make([]*arc, len(g.Coordinates.(orb.Polygon))) + for i, r := range g.Coordinates.(orb.Polygon) { o.Arcs[i] = t.extractRing(r) } - case geojson.GeometryMultiPolygon: - o.MultiArcs = make([][]*arc, len(g.MultiPolygon)) - for i, p := range g.MultiPolygon { + case geojson.TypeMultiPolygon: + o.MultiArcs = make([][]*arc, len(g.Coordinates.(orb.MultiPolygon))) + for i, p := range g.Coordinates.(orb.MultiPolygon) { arcs := make([]*arc, len(p)) for j, r := range p { arcs[j] = t.extractRing(r) } o.MultiArcs[i] = arcs } - case geojson.GeometryPoint: - o.Point = g.Point - case geojson.GeometryMultiPoint: - o.MultiPoint = g.MultiPoint + case geojson.TypePoint: + o.Point = []float64{g.Coordinates.(orb.Point)[0], g.Coordinates.(orb.Point)[1]} + case geojson.TypeMultiPoint: + for _, v := range g.Coordinates.(orb.MultiPoint) { + o.MultiPoint = append(o.MultiPoint, []float64{v[0], v[1]}) + } } return o } -func (t *Topology) extractLine(line [][]float64) *arc { +func (t *Topology) extractLine(line orb.LineString) *arc { n := len(line) for i := 0; i < n; i++ { - t.coordinates = append(t.coordinates, line[i]) + t.coordinates = append(t.coordinates, []float64{line[i][0], line[i][1]}) } index := len(t.coordinates) - 1 @@ -94,10 +104,10 @@ func (t *Topology) extractLine(line [][]float64) *arc { return arc } -func (t *Topology) extractRing(ring [][]float64) *arc { +func (t *Topology) extractRing(ring orb.Ring) *arc { n := len(ring) for i := 0; i < n; i++ { - t.coordinates = append(t.coordinates, ring[i]) + t.coordinates = append(t.coordinates, []float64{ring[i][0], ring[i][1]}) } index := len(t.coordinates) - 1 diff --git a/extract_test.go b/extract_test.go index 7d02a0e..d350fd0 100644 --- a/extract_test.go +++ b/extract_test.go @@ -5,7 +5,8 @@ import ( "testing" "github.com/cheekybits/is" - "github.com/paulmach/go.geojson" + "github.com/paulmach/orb" + "github.com/paulmach/orb/geojson" ) // See https://github.com/mbostock/topojson/blob/master/test/topology/extract-test.js @@ -15,12 +16,12 @@ func TestCopiesCoordinates(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("bar", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("foo", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("bar", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } expected := [][]float64{ @@ -41,9 +42,9 @@ func TestClosingCoordinates(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {0, 0}, - })), + NewTestFeature("foo", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, + }), } expected := [][]float64{ @@ -63,23 +64,23 @@ func TestLineSlices(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("bar", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("foo", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("bar", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} topo.extract() foo := GetFeature(topo, "foo") - is.Equal(foo.Type, geojson.GeometryLineString) + is.Equal(foo.Type, geojson.TypeLineString) is.True(reflect.DeepEqual(foo.Arc, &arc{Start: 0, End: 2})) bar := GetFeature(topo, "bar") - is.Equal(bar.Type, geojson.GeometryLineString) + is.Equal(bar.Type, geojson.TypeLineString) is.True(reflect.DeepEqual(bar.Arc, &arc{Start: 3, End: 5})) } @@ -88,17 +89,19 @@ func TestExtractRingsOrder(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("line", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("multiline", geojson.NewMultiLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("polygon", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("line", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("multiline", orb.MultiLineString{ + orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, }, - })), + }), + NewTestFeature("polygon", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, + }, + }), } topo := &Topology{input: in} @@ -118,23 +121,21 @@ func TestExtractNested(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewCollectionGeometry(geojson.NewCollectionGeometry(geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {0, 1}, - })))), + NewTestFeature("foo", orb.Collection{ + orb.LineString{ + orb.Point{0, 0}, orb.Point{0, 1}, + }, + }), } topo := &Topology{input: in} topo.extract() foo := GetFeature(topo, "foo") - is.Equal(foo.Type, geojson.GeometryCollection) + is.Equal(foo.Type, "GeometryCollection") geometries := foo.Geometries is.Equal(len(geometries), 1) - is.Equal(geometries[0].Type, geojson.GeometryCollection) - - geometries = foo.Geometries[0].Geometries - is.Equal(len(geometries), 1) - is.Equal(geometries[0].Type, geojson.GeometryLineString) + is.Equal(geometries[0].Type, geojson.TypeLineString) is.True(reflect.DeepEqual(geometries[0].Arc, &arc{Start: 0, End: 1})) } diff --git a/filter.go b/filter.go index 3627de2..8347a74 100644 --- a/filter.go +++ b/filter.go @@ -1,7 +1,7 @@ package topojson import ( - geojson "github.com/paulmach/go.geojson" + geojson "github.com/paulmach/orb/geojson" ) // Filter topology into a new topology that only contains features with the given IDs @@ -50,23 +50,23 @@ func remapGeometry(arcMap map[int]int, ids []string, g *Geometry) *Geometry { } switch g.Type { - case geojson.GeometryPoint: + case geojson.TypePoint: geom.Point = g.Point - case geojson.GeometryMultiPoint: + case geojson.TypeMultiPoint: geom.MultiPoint = g.MultiPoint - case geojson.GeometryLineString: + case geojson.TypeLineString: geom.LineString = remapLineString(arcMap, g.LineString) - case geojson.GeometryMultiLineString: + case geojson.TypeMultiLineString: geom.MultiLineString = remapMultiLineString(arcMap, g.MultiLineString) - case geojson.GeometryPolygon: + case geojson.TypePolygon: geom.Polygon = remapMultiLineString(arcMap, g.Polygon) - case geojson.GeometryMultiPolygon: + case geojson.TypeMultiPolygon: polygons := make([][][]int, len(g.MultiPolygon)) for i, poly := range g.MultiPolygon { polygons[i] = remapMultiLineString(arcMap, poly) } geom.MultiPolygon = polygons - case geojson.GeometryCollection: + default: geometries := make([]*Geometry, 0) for _, geometry := range g.Geometries { out := remapGeometry(arcMap, ids, geometry) diff --git a/filter_test.go b/filter_test.go index 239e6e2..0c04ee7 100644 --- a/filter_test.go +++ b/filter_test.go @@ -4,22 +4,23 @@ import ( "testing" "github.com/cheekybits/is" - geojson "github.com/paulmach/go.geojson" + "github.com/paulmach/orb" + geojson "github.com/paulmach/orb/geojson" ) func TestFilter(t *testing.T) { is := is.New(t) fc := geojson.NewFeatureCollection() - fc.AddFeature(NewTestFeature("one", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}, - }))) - fc.AddFeature(NewTestFeature("two", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, {2, 1}, {1, 1}, {1, 0}, - }))) - fc.AddFeature(NewTestFeature("three", geojson.NewLineStringGeometry([][]float64{ - {1, 1}, {2, 1}, {2, 2}, {1, 2}, {1, 1}, - }))) + fc.Append(NewTestFeature("one", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{1, 1}, orb.Point{0, 1}, orb.Point{0, 0}, + })) + fc.Append(NewTestFeature("two", orb.LineString{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{2, 1}, orb.Point{1, 1}, orb.Point{1, 0}, + })) + fc.Append(NewTestFeature("three", orb.LineString{ + orb.Point{1, 1}, orb.Point{2, 1}, orb.Point{2, 2}, orb.Point{1, 2}, orb.Point{1, 1}, + })) topo := NewTopology(fc, nil) is.NotNil(topo) @@ -33,7 +34,7 @@ func TestFilter(t *testing.T) { al2 := len(topo2.Arcs) is.True(al > al2) // Arc has been eliminated - expected := map[string][][]float64{ + expected := map[string][]orb.Point{ "one": {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}}, "two": {{1, 0}, {2, 0}, {2, 1}, {1, 1}, {1, 0}}, } @@ -44,6 +45,6 @@ func TestFilter(t *testing.T) { for _, feat := range fc2.Features { exp, ok := expected[feat.ID.(string)] is.True(ok) - is.Equal(feat.Geometry.LineString, exp) + is.Equal(feat.Geometry, exp) } } diff --git a/geojson.go b/geojson.go index b3a08d6..5686b79 100644 --- a/geojson.go +++ b/geojson.go @@ -1,7 +1,8 @@ package topojson import ( - geojson "github.com/paulmach/go.geojson" + "github.com/paulmach/orb" + geojson "github.com/paulmach/orb/geojson" ) func (t *Topology) ToGeoJSON() *geojson.FeatureCollection { @@ -9,57 +10,53 @@ func (t *Topology) ToGeoJSON() *geojson.FeatureCollection { for _, obj := range t.Objects { switch obj.Type { - case geojson.GeometryCollection: + case "GeometryCollection": for _, geometry := range obj.Geometries { feat := geojson.NewFeature(t.toGeometry(geometry)) feat.ID = geometry.ID feat.Properties = geometry.Properties - feat.BoundingBox = geometry.BoundingBox - fc.AddFeature(feat) + feat.BBox = geometry.BoundingBox + fc.Append(feat) } default: feat := geojson.NewFeature(t.toGeometry(obj)) feat.ID = obj.ID feat.Properties = obj.Properties - feat.BoundingBox = obj.BoundingBox - fc.AddFeature(feat) + feat.BBox = obj.BoundingBox + fc.Append(feat) } } return fc } -func (t *Topology) toGeometry(g *Geometry) *geojson.Geometry { +func (t *Topology) toGeometry(g *Geometry) orb.Geometry { switch g.Type { - case geojson.GeometryPoint: - return geojson.NewPointGeometry(t.packPoint(g.Point)) - case geojson.GeometryMultiPoint: - return geojson.NewMultiPointGeometry(t.packPoints(g.MultiPoint)...) - case geojson.GeometryLineString: - return geojson.NewLineStringGeometry(t.packLinestring(g.LineString)) - case geojson.GeometryMultiLineString: - return geojson.NewMultiLineStringGeometry(t.packMultiLinestring(g.MultiLineString)...) - case geojson.GeometryPolygon: - return geojson.NewPolygonGeometry(t.packMultiLinestring(g.Polygon)) - case geojson.GeometryMultiPolygon: - polygons := make([][][][]float64, len(g.MultiPolygon)) - for i, poly := range g.MultiPolygon { - polygons[i] = t.packMultiLinestring(poly) - } - return geojson.NewMultiPolygonGeometry(polygons...) - case geojson.GeometryCollection: - geometries := make([]*geojson.Geometry, len(g.Geometries)) + case geojson.TypePoint: + return t.packPoint(g.Point) + case geojson.TypeMultiPoint: + return t.packPoints(g.MultiPoint) + case geojson.TypeLineString: + return t.packLinestring(g.LineString) + case geojson.TypeMultiLineString: + return t.packMultiLinestring(g.MultiLineString) + case geojson.TypePolygon: + return t.packPolygon(g.Polygon) + case geojson.TypeMultiPolygon: + return t.packMultiPolygon(g.MultiPolygon) + default: + geometries := make([]orb.Geometry, len(g.Geometries)) for i, geometry := range g.Geometries { geometries[i] = t.toGeometry(geometry) } - return geojson.NewCollectionGeometry(geometries...) + return orb.Collection(geometries) } return nil } -func (t *Topology) packPoint(in []float64) []float64 { +func (t *Topology) packPoint(in []float64) orb.Geometry { if t.Transform == nil { - return in + return orb.Point{in[0], in[1]} } out := make([]float64, len(in)) @@ -70,19 +67,19 @@ func (t *Topology) packPoint(in []float64) []float64 { } } - return out + return orb.Point{out[0], out[1]} } -func (t *Topology) packPoints(in [][]float64) [][]float64 { - out := make([][]float64, len(in)) +func (t *Topology) packPoints(in [][]float64) orb.Geometry { + out := make(orb.Collection, len(in)) for i, p := range in { out[i] = t.packPoint(p) } return out } -func (t *Topology) packLinestring(ls []int) [][]float64 { - result := make([][]float64, 0) +func (t *Topology) packLinestring(ls []int) orb.Geometry { + result := orb.LineString{} for _, a := range ls { reverse := false if a < 0 { @@ -112,28 +109,47 @@ func (t *Topology) packLinestring(ls []int) [][]float64 { if reverse { for j := len(newArc) - 1; j >= 0; j-- { - if len(result) > 0 && pointEquals(result[len(result)-1], newArc[j]) { + if len(result) > 0 && pointEquals([]float64{result[len(result)-1][0], result[len(result)-1][1]}, newArc[j]) { continue } - result = append(result, newArc[j]) + result = append(result, orb.Point{newArc[j][0], newArc[j][1]}) } } else { for j := 0; j < len(newArc); j++ { - if len(result) > 0 && pointEquals(result[len(result)-1], newArc[j]) { + if len(result) > 0 && pointEquals([]float64{result[len(result)-1][0], result[len(result)-1][1]}, newArc[j]) { continue } - result = append(result, newArc[j]) + result = append(result, orb.Point{newArc[j][0], newArc[j][1]}) } } } + return result +} + +func (t *Topology) packMultiLinestring(ls [][]int) orb.Geometry { + result := make(orb.MultiLineString, len(ls)) + for i, l := range ls { + result[i] = t.packLinestring(l).(orb.LineString) + } + return result +} +func (t *Topology) packPolygon(ls [][]int) orb.Geometry { + result := make(orb.Polygon, len(ls)) + for i, l := range ls { + s := t.packLinestring(l).(orb.LineString) + result[i] = make(orb.Ring, len(s)) + for j, l := range s { + result[i][j] = l + } + } return result } -func (t *Topology) packMultiLinestring(ls [][]int) [][][]float64 { - result := make([][][]float64, len(ls)) +func (t *Topology) packMultiPolygon(ls [][][]int) orb.Geometry { + result := make(orb.MultiPolygon, len(ls)) for i, l := range ls { - result[i] = t.packLinestring(l) + result[i] = t.packPolygon(l).(orb.Polygon) } return result } diff --git a/geojson_test.go b/geojson_test.go index 1f9adab..2f5c6c7 100644 --- a/geojson_test.go +++ b/geojson_test.go @@ -4,22 +4,22 @@ import ( "testing" "github.com/cheekybits/is" - geojson "github.com/paulmach/go.geojson" + orb "github.com/paulmach/orb" + geojson "github.com/paulmach/orb/geojson" ) func TestGeoJSON(t *testing.T) { is := is.New(t) - poly := geojson.NewPolygonFeature([][][]float64{ - { + poly := geojson.NewFeature(orb.Polygon{ + orb.Ring{ {0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}, }, }) poly.ID = "poly" - poly.SetProperty("id", "poly") fc := geojson.NewFeatureCollection() - fc.AddFeature(poly) + fc.Append(poly) topo := NewTopology(fc, nil) is.NotNil(topo) @@ -35,12 +35,12 @@ func TestGeoJSONMultiArc(t *testing.T) { is := is.New(t) fc := geojson.NewFeatureCollection() - fc.AddFeature(NewTestFeature("one", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}, - }))) - fc.AddFeature(NewTestFeature("two", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, {2, 1}, {1, 1}, {1, 0}, - }))) + fc.Append(NewTestFeature("one", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{1, 1}, orb.Point{0, 1}, orb.Point{0, 0}, + })) + fc.Append(NewTestFeature("two", orb.LineString{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{2, 1}, orb.Point{1, 1}, orb.Point{1, 0}, + })) topo := NewTopology(fc, nil) is.NotNil(topo) @@ -50,14 +50,14 @@ func TestGeoJSONMultiArc(t *testing.T) { fc2 := topo.ToGeoJSON() is.NotNil(fc2) - expected := map[string][][]float64{ + expected := map[string][]orb.Point{ "one": {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}}, "two": {{1, 0}, {2, 0}, {2, 1}, {1, 1}, {1, 0}}, } for _, feat := range fc2.Features { exp, ok := expected[feat.ID.(string)] is.True(ok) - is.Equal(feat.Geometry.LineString, exp) + is.Equal(feat.Geometry, exp) } } @@ -77,10 +77,13 @@ func TestGeoJSONWithGeometryCollections(t *testing.T) { for i := 0; i < len(result.Features); i++ { is.Equal(result.Features[i].Type, expected.Features[i].Type) is.Equal(result.Features[i].Properties, expected.Features[i].Properties) - is.Equal(result.Features[i].Geometry.Type, expected.Features[i].Geometry.Type) // can't accurately compare floats for equality, so just check the array lengths - is.Equal(len(result.Features[i].Geometry.MultiPolygon), len(expected.Features[i].Geometry.MultiPolygon)) - is.Equal(len(result.Features[i].Geometry.Polygon), len(expected.Features[i].Geometry.Polygon)) + switch v := result.Features[i].Geometry.(type) { + case orb.Polygon: + is.Equal(len(v), len(expected.Features[i].Geometry.(orb.Polygon))) + case orb.MultiPolygon: + is.Equal(len(v), len(expected.Features[i].Geometry.(orb.MultiPolygon))) + } } } @@ -88,7 +91,7 @@ var sourceTopojson = `{ "type":"Topology", "arcs":[[[10361,14391],[-79,-49],[-23,-39],[-14,-131],[-46,29],[-135,-28],[-27,29],[-66,17],[-63,-27],[-107,39],[-60,-25],[-86,13],[-103,28],[-110,-90],[-106,-58],[-54,25],[-3,37],[-67,17],[0,-35],[-100,56],[11,-46],[-76,-20],[-108,32],[-51,38],[1,48],[-85,2],[-10,36],[-44,28],[-48,-3],[-71,27],[-22,-45],[-63,14],[-18,-21],[-30,-127],[-55,33],[-26,40],[-40,-14],[-6,-53],[-61,-60],[-91,-42],[-63,19],[-155,67],[-51,-40],[-156,-31]],[[7794,14081],[21,42],[-6,99],[-19,88],[-47,1],[-22,59],[-68,41],[-47,54],[-62,43],[-39,110],[69,58],[-9,41],[-64,22],[-45,46],[-4,38],[81,229],[-9,64],[-62,45],[-46,63],[-37,22],[-17,52],[-94,-60],[-81,-67],[-63,-13],[-72,54],[-27,69],[17,24],[-60,94],[54,39],[19,70],[35,22],[-37,45],[-2,54],[-61,40],[48,42],[1,82],[66,54],[105,35],[-35,55],[15,25],[-12,75],[-97,-27],[-74,71],[-26,68],[-95,30],[-49,95],[-12,69]],[[6825,16343],[43,101],[60,12],[8,60],[-26,41],[65,78],[67,42],[56,70],[48,16],[54,84],[83,23],[54,-1],[29,-33],[111,55],[10,53],[-18,51],[58,22],[98,81],[55,-14],[69,52],[19,59],[-34,75],[-49,65],[-7,110],[-99,102],[-4,72],[-76,81],[7,49],[48,12],[73,-7],[61,57],[16,40],[71,84],[6,47],[48,13],[28,55],[36,-6],[17,27],[5,13],[-2,27],[27,7],[68,-16],[76,45],[101,-119],[143,-120],[52,-121],[45,-52],[49,-13],[29,38],[39,-45],[-18,-53],[20,-33],[48,44],[94,-38],[89,-110],[30,-51],[-17,-42],[38,-58],[11,-81],[36,-14],[10,-130],[21,-57],[-10,-75],[-52,-70],[37,-120],[73,-73],[-38,-93],[-2,-50],[31,-87],[46,-57],[41,-134],[-32,-72],[10,-62],[36,-45],[10,-79],[78,-101],[8,-57],[60,-114],[17,-58],[85,-74],[16,-44],[-27,-71],[25,-78],[-14,-35],[31,-134],[33,-49],[27,-91],[23,-124],[110,-145],[73,-52],[7,-78],[26,-62],[38,-41],[-18,-44],[42,-17],[61,5],[125,-42],[50,-46],[121,-50],[64,5],[50,-44],[86,-2],[110,-41]],[[7952,18119],[-1,94],[96,56],[65,-78],[-27,-36],[-76,-50],[-57,14]],[[5776,13129],[-23,-29],[25,-49],[-34,-53],[-14,103],[46,28]],[[7794,14081],[-36,-29],[-146,-5],[-75,-83],[3,-67],[27,-45],[-47,-25],[-79,-81],[93,-80],[-25,-41],[-2,-96],[16,-30],[-13,-77],[-48,-24],[-91,5],[-12,-43],[-107,4],[-36,-76],[-91,-101],[-14,-40],[-39,-21],[-11,-84],[34,-17],[39,-70],[81,-29],[28,-42],[-7,-79],[87,-17],[91,26],[22,-26],[18,-142],[48,-3],[79,-62],[101,24],[8,-63],[56,26],[19,-90],[41,-32],[59,-11],[46,-58],[8,-53],[53,-88],[54,-38],[-2,-64],[-71,-34],[-80,-62],[-3,-136],[-35,-63],[-47,-34],[23,-79],[50,-37],[30,-45],[63,6],[42,30],[46,-63],[-7,-67],[34,-77],[50,-33],[27,-49],[66,-56],[68,-102]],[[8280,11233],[-48,-101],[-70,-10],[-28,-66],[5,-79],[-76,-80],[4,-29],[56,-35],[-43,-97],[23,-99],[-18,-18],[9,-186],[18,-108],[44,-54],[-21,-44]],[[8135,10227],[-27,-63],[-83,-1],[-43,-64],[-73,-12],[-63,43],[2,-79],[-66,-34],[-87,-129],[-43,-38],[-154,-47],[-37,-64],[-61,-10],[-5,-82],[25,-36],[-19,-51],[-107,-41],[4,-35],[-73,-34],[-89,24],[-23,-69],[-49,50],[-31,-26],[-36,23],[-19,78],[-47,26],[-90,-33],[-34,29],[-51,-38]],[[6756,9514],[-59,9],[-16,27],[-64,-12],[-63,24],[-17,59],[-32,16],[10,45],[-37,137],[-44,39],[-8,54],[-77,33],[-35,32],[-39,80],[106,40],[14,33],[0,3],[-55,87],[-161,126],[-71,5],[-1,1],[-15,5],[-10,7],[-7,6],[-1,1],[-2,2],[0,0],[-3,4],[0,0],[-12,16],[29,46],[-42,27],[-26,99],[-142,164],[-3,36],[55,47],[131,60],[63,48],[47,14],[46,-93],[19,-91],[72,-109],[34,-74],[39,-47],[94,-54],[69,23],[37,28],[61,-32],[68,52],[-20,43],[-59,-16],[-45,33],[-67,-17],[-90,54],[-124,96],[-29,33],[-34,80],[-13,87],[-58,78],[2,27],[-39,76],[-5,65],[-70,64],[7,105],[60,99],[64,127],[25,20],[77,110],[50,33],[18,74],[-75,32],[-66,13],[-44,27],[-30,61],[-7,51],[5,150],[18,172],[-8,95],[230,99],[43,-32],[49,23],[41,59],[-70,74],[-24,52],[-10,83],[47,96],[112,66],[3,47],[45,42],[-36,25],[-33,62],[-38,33],[-22,74],[52,86],[-122,-38],[-66,-116],[-47,-30],[-69,32],[-12,71],[-43,53],[-34,8],[-16,-52],[2,-62],[-32,-25],[-18,-55],[-82,-105],[-76,-64],[-41,70],[-62,-31],[-32,70],[13,121],[-37,31],[75,35],[9,97],[29,51],[-6,39],[-43,43],[-19,-71],[-39,-28],[26,-51],[-23,-30],[-52,9],[-35,-25],[-43,7],[-185,291],[8,90],[-25,88],[-57,70],[-59,113],[-131,156],[-56,95],[-50,27],[-36,82],[48,24],[61,145],[-4,58],[23,39],[-10,134],[53,84],[40,37],[29,77],[37,53],[48,33],[54,69],[8,63],[-13,58],[53,124],[19,86],[62,74],[33,21],[70,-31],[59,46],[-63,49],[53,70],[70,9],[68,31],[47,-14],[90,-70],[12,57],[51,79],[53,-11],[41,78],[8,51],[36,47],[-25,94],[158,-17],[34,61],[89,49],[76,73],[73,86],[204,114],[26,49]],[[11875,11193],[-65,-32],[-55,15],[-39,-12],[-14,-83],[-61,-60],[48,-58],[-93,-47],[-23,15],[-28,84],[-42,2],[-38,56],[-3,78],[-30,64],[61,96],[-66,14],[-23,54],[-103,78],[-85,-161],[-38,-8],[-118,24],[-18,33],[-71,-79],[68,-8],[42,-44],[6,-45],[-88,-28],[-44,1],[-24,-74],[31,-32],[-149,-47],[-145,-4],[-8,84],[17,85],[-95,-1],[-117,23]],[[10465,11176],[0,91],[-13,67],[28,33],[2,73],[44,5],[12,11],[-3,24],[-20,70],[31,38],[18,59],[-11,76],[149,55],[29,-38],[99,-73],[73,7],[62,54],[89,-3],[174,44],[75,5],[69,-111],[89,-120],[96,-71],[77,-79],[57,-36],[36,13],[55,-51],[93,-126]],[[10354,10976],[-138,34],[-53,27],[-66,85],[-33,-56],[-61,-40],[-23,-101],[-109,-42],[-56,1],[-54,-86],[-25,-13],[-3,-56],[-27,-108],[-108,-104],[-51,4],[-44,-21],[-74,38],[-10,58],[-90,-43],[-79,-1],[-2,54],[-97,4],[-23,-47],[-103,-18],[-87,-33],[-10,32],[-69,-14],[-24,99],[-34,40],[-63,33],[20,56],[-53,52],[-43,10],[-78,66],[3,110],[-43,9],[-62,50],[10,69],[-58,63],[-35,4],[-46,45],[-73,-3]],[[10361,14391],[81,-51],[11,-42],[56,16],[74,-85],[39,-26],[121,-29],[61,-72],[67,-58],[-22,-53],[18,-40],[59,-26],[51,-58],[76,-155],[10,-89],[38,-103],[55,-72],[102,-77],[50,-18],[2,-62],[24,-66],[101,-74],[85,-20],[82,-50],[85,-40],[8,-31],[-63,-28],[-52,3],[-59,-26],[-49,-56],[-27,-75],[0,-141],[56,-182],[49,-141],[65,-123],[177,-258],[105,-136],[32,-53],[132,-178],[46,-132],[-116,67],[-84,25],[-157,-53],[-101,10],[-50,43],[-100,116],[-80,68],[-19,56],[-67,41],[-41,8],[-78,-16],[-86,-39],[-120,-34],[-49,11],[-148,-24],[-68,57],[-51,10],[-100,-28],[-60,-57],[24,-95],[-47,-96],[0,-45],[22,-32],[-1,-22],[-47,-6],[-33,-110],[15,-144],[-9,-46],[-18,-32],[-18,1],[-6,-2],[-6,-8],[-1,-11],[-13,-18],[9,-24],[-24,-12],[-25,-67]],[[12344,8996],[-44,-97],[50,-36],[-73,-39],[-87,-77],[-27,8]],[[12163,8755],[44,86],[22,69],[18,102],[23,9],[74,-25]],[[11875,11193],[116,-44],[18,-53],[101,-38],[20,26],[55,-96],[6,-61],[33,-30],[64,-157],[65,-144],[29,-84],[56,-105],[33,-97],[35,-168],[-17,-184],[5,-39],[-25,-76],[-31,7],[-88,-75],[-61,-67],[-77,-42],[-115,-114],[-97,-141],[-48,-104],[63,-69],[44,-1],[112,-61],[9,-39],[63,-120],[-17,-109],[-19,-62],[-45,-90]],[[12162,8756],[-72,3],[-82,-48],[-46,11],[-37,-40],[7,-103],[-50,-50],[-98,-11],[-53,41],[-57,-25],[-22,17],[-73,-64],[-121,52],[-103,-52],[-53,59],[-58,14],[-67,-47],[-91,-36],[-88,19],[-77,-44],[43,-51],[-37,-102],[22,-53],[101,27],[10,-72],[34,-63],[-23,-40],[108,-61],[-7,-50],[32,-64],[-40,-58],[-29,-70],[-71,-50],[-54,-88],[-72,-5],[-28,-51],[60,-83],[-16,-63],[-57,6],[-63,-88],[17,-66],[-21,-44],[-43,-8],[-68,78],[-96,-32],[30,-127],[-45,-59],[-12,-41]],[[10596,7074],[-63,-5],[-61,-62],[-99,-59],[-37,8],[-39,-75],[-76,-6],[-33,-51],[75,-70],[21,-37],[-6,-48],[-35,0],[-25,-63],[-66,-70],[-45,68],[-28,104],[-42,-18],[-109,14],[-50,-49],[-129,-46],[-26,-77],[31,-11],[-28,-59],[-55,-12],[-63,-50],[-82,28],[-36,-17],[-49,27],[17,76],[-36,89],[-29,26],[14,64],[-29,49],[63,15],[64,35],[-44,41],[-103,159]],[[9358,6992],[35,68],[108,23],[-11,56],[-29,22],[41,76],[36,5],[36,46],[-24,105],[37,53],[-97,39],[6,29],[70,39],[52,6],[38,30],[-128,244],[-125,168],[-283,178],[-118,58],[-28,59],[-43,20],[12,57],[-31,60],[45,26],[-11,81],[-117,100],[-73,-3],[-4,68],[-70,16],[-6,52],[59,128],[72,-17],[70,83],[-29,25],[4,82],[-74,47],[-113,32],[-37,-19],[-53,43],[-111,20],[-85,133],[52,78],[10,92],[113,65],[5,122],[-35,12],[-29,141],[12,64],[-24,19],[-38,81],[16,32],[-36,65],[-82,70],[-62,11],[-49,38],[-97,7]],[[10354,10976],[24,20],[5,48],[18,2],[3,15],[-7,18],[13,18],[4,17],[9,2],[12,-3],[6,3],[17,30],[7,30]],[[9358,6992],[-17,-73],[-78,-54],[47,-81],[-52,-22],[-73,74],[-54,-16],[12,-47],[-62,-13],[-40,-68],[8,-33],[-25,-122],[-34,-90],[-38,-36],[-79,-32],[-38,-47],[-33,45],[-67,55]],[[8735,6432],[0,30],[44,40],[29,86],[-56,-18],[-71,26],[9,39],[-76,63],[5,46],[-50,34],[-24,41],[-65,-49],[-55,-73],[-27,19],[-42,-17],[22,-67],[42,-28],[16,-43],[-17,-62],[-30,-3],[-42,50],[-74,62],[-33,-44],[-38,23],[-61,-6],[-126,-84],[-112,19],[-73,-25],[21,65],[40,45],[-82,26],[-34,-28],[-7,-86],[38,-51],[-40,-21],[-66,15],[-57,-89],[-115,31],[-31,93],[-43,21],[-75,-2],[-19,-52],[-61,6],[3,44],[-74,36],[-33,-54],[38,-36],[-48,-58],[12,-65],[48,-20],[-3,-64],[33,-28],[15,-51],[-100,-69],[-27,16],[-26,-63],[-73,-2],[-80,-30],[-58,-42],[-28,-46]],[[6898,5932],[-29,29],[-51,-5],[-42,21],[-43,-13],[-74,91],[17,45],[-61,32],[-35,46],[-101,85],[-99,-59],[-75,-29],[-15,71],[-42,-13],[-50,105],[-58,56],[-79,147],[24,57],[-8,30],[-66,85],[6,77],[30,48],[-66,28],[12,31],[78,20],[-1,34],[-52,25],[48,53],[-6,67],[30,25],[25,59],[49,31],[-3,43],[124,62],[-61,13],[48,143],[46,38],[13,41],[-37,17],[-124,-32],[-96,57],[-34,45],[-82,33],[-9,32],[-133,100],[-5,64],[72,78],[26,-8],[75,55],[50,21],[108,5],[42,12],[2,62],[51,17],[14,107],[-32,36],[-66,-46],[-115,-60],[-46,139],[35,1],[124,188],[16,123],[37,61],[4,47],[66,3],[27,37],[-73,48],[-6,44],[-109,18],[-38,51],[-74,2],[-50,19],[-18,80],[31,72],[-19,17],[63,59],[-46,36],[9,35],[57,30],[39,94],[36,-15],[85,19],[40,76],[52,10],[87,-54],[69,26],[108,-26],[3,-30],[48,-53],[23,-60],[85,90],[50,2],[3,179]],[[12873,5056],[11,3],[146,-69],[-22,-17],[-96,-26],[-37,8],[-36,62],[14,11],[3,4],[-1,5],[3,12],[1,18],[14,-11]],[[13630,5293],[-16,-36],[-77,-85],[-77,-65],[-50,6],[-14,44],[11,57],[52,3],[14,59],[157,17]],[[13660,5866],[57,-20],[-29,-34],[-81,-39],[-78,-3],[-5,37],[47,49],[71,22],[18,-12]],[[14903,8290],[16,-26],[-22,-14],[-5,-5],[-4,-8],[0,-30],[-42,-31],[-28,27],[12,23],[11,4],[3,6],[-3,11],[24,-2],[38,45]],[[15042,8363],[30,-97],[5,-95],[54,-211],[-27,-26],[-50,15],[-74,-2],[2,57],[-21,27],[-28,-10],[-17,39],[3,1],[-8,7],[-10,3],[-15,11],[-5,21],[-16,21],[-26,25],[51,58],[-1,29],[6,11],[14,1],[12,6],[0,55],[121,54]],[[12235,4892],[99,86],[3,44],[124,27],[-35,77],[-42,-5],[-34,73],[-14,64],[-76,72],[-103,-32],[-61,7],[-91,-59],[-45,7],[-77,68],[2,38],[-66,16],[3,107],[-103,10],[-74,24],[-108,-29],[-51,-57],[-106,-27],[-12,-34],[-85,-26],[-31,14],[-92,-59],[-63,-25],[-72,21],[-35,-24],[-58,45],[-23,-84]],[[10909,5231],[-33,2],[-23,54],[-13,78],[60,93],[-11,21],[-66,2],[-2,70],[-29,27],[24,58],[-42,17],[-25,50],[-107,6],[-61,53],[-12,80],[-50,73],[-18,-14],[-48,67],[51,60],[47,0],[4,-49],[43,-79],[61,9],[69,-14],[29,-22],[63,89],[-54,93],[-60,30],[-20,31],[-65,7],[-35,42],[-53,24],[38,88],[49,71],[-12,121],[31,44],[4,73],[-49,35],[81,111],[37,23],[24,57],[-26,73],[-51,12],[-1,94],[14,41],[-76,42]],[[12162,8756],[1,-1]],[[12344,8996],[110,8],[56,-18],[165,140],[-2,50],[50,107],[33,120],[97,88],[67,-16],[156,23],[164,-13],[43,16],[72,-18],[57,13],[17,-58],[35,-5],[94,27],[49,-21],[45,14],[89,-21],[10,39],[189,-56],[236,-29],[93,-28],[79,-39],[168,-120],[63,-65],[223,-185],[100,-99],[83,-105],[27,-48],[51,-156],[35,-132],[-35,-104],[-19,75],[-40,3],[-67,-43],[-73,-94],[-13,5],[-11,-3],[3,-12],[-14,-9],[-8,-9],[-4,-15],[-30,-11],[90,-86],[8,-24],[15,-11],[13,-6],[2,-7],[-4,-13],[23,-25],[46,-16],[-1,-65],[79,7],[40,-35],[-19,-49],[-19,-174],[-61,-137],[-31,-110],[-51,-47],[-33,-93],[-15,-254],[-33,-90],[-41,-209],[-28,26],[36,67],[20,74],[-79,66],[-34,-27],[98,-61],[-45,-113],[-55,-38],[-48,-56],[-90,-66],[-51,-123],[-121,-136],[-47,-24],[-41,-67],[-18,53],[-57,42],[1,74],[-47,31],[-130,47],[43,-57],[104,-27],[22,-85],[-18,-19],[-56,21],[-36,-26],[-61,9],[-43,37],[-60,-31],[-62,-10],[39,-44],[95,24],[33,-23],[83,0],[52,23],[39,-40],[-47,-67],[-44,-30],[-17,-73],[22,-57],[102,5],[-100,-135],[-59,-49],[-171,-96],[-129,-10],[-21,27],[1,69],[-74,49],[-92,-19],[-92,-69],[-1,-67],[-62,-63],[-44,-24],[-86,20],[-105,-47],[-33,-41],[86,-30],[53,11],[52,34],[26,-19],[78,33],[44,59],[59,7],[33,-40],[-15,-98],[18,-59],[-27,-102],[3,-44],[-31,-29],[-114,-17],[10,-74],[-82,4],[-28,-39],[44,-82],[35,-26],[-58,-37],[-55,-53],[-53,18],[-215,41],[-70,-19],[-115,39],[-3,-11],[1,-8],[-3,-22],[-8,-2],[-9,-9],[-20,6],[-13,-14],[12,-38],[-26,-34],[-91,5],[-35,-44],[-12,-96],[-57,-24],[-117,-4],[-29,59],[-30,9],[-52,-40],[-64,35],[-68,54]],[[12235,4892],[-14,-100]],[[12221,4792],[-56,-46],[-41,-70],[-6,-85],[10,-46],[-30,-105],[-97,-87],[-6,-75],[-43,-8],[-48,56],[-34,-48],[-23,115],[-75,30],[-49,-62],[-39,-9],[-18,-51],[-55,-39],[-58,45],[-15,90],[-64,41],[-37,0],[-10,42],[-72,70],[-50,-55],[-58,-105],[-21,63],[41,84],[-94,113],[-112,63],[-70,18],[-4,56],[-66,20],[-22,30],[41,110],[-22,94],[35,61],[-44,129]],[[9421,2647],[47,3],[61,-68],[55,-28],[92,-5],[97,-37],[23,-95],[44,-29],[-46,-50],[-50,-4],[-64,-41],[-28,-79],[-9,-75],[-118,-56],[-123,-17],[-19,37],[-132,116],[-108,52],[-71,72],[-72,4],[-47,-14],[-2,43],[52,92],[97,8],[83,53],[52,6],[94,45],[62,74],[30,-7]],[[10120,2850],[21,-10],[2,-74],[-59,37],[36,47]],[[10035,2860],[30,-17],[-13,-116],[-21,-29],[-94,15],[57,48],[16,89],[25,10]],[[9875,2859],[25,-29],[9,-119],[-98,-25],[-39,43],[30,53],[-2,57],[21,9],[13,21],[41,-10]],[[13231,4759],[88,-25],[45,-35],[161,-35],[67,-83],[24,-50],[-79,-56],[-36,-1],[-39,31],[-89,12],[-80,-4],[-17,41],[-32,40],[-27,118],[14,47]],[[12221,4792],[32,67],[101,-80],[75,38],[26,-47],[112,-23],[95,13],[33,20],[9,66],[37,37],[198,-10],[51,-28],[57,12],[107,-24],[32,-35],[6,-51],[-44,-31],[-41,-1],[-29,46],[-63,-21],[-33,-73],[-122,-17],[14,-36],[45,-30],[82,-5],[68,11],[16,-40],[89,16],[23,46],[68,-48],[4,-66],[136,-28],[69,1],[37,-41],[79,19],[42,-6],[91,15],[47,48],[248,28],[62,16],[97,-9],[72,18],[71,-2],[105,33],[107,-17],[14,-30],[-13,-85],[-52,-70],[-70,7],[1,-131],[51,-178],[2,-133],[-9,-67],[-35,-64],[-63,-35],[-67,-58],[-84,-40],[-77,-6],[-38,-21],[-31,-48],[-177,-30],[-62,-25],[-101,-86],[-42,-57],[-38,-140],[31,-166],[-81,-7],[-260,62],[-31,3],[-117,-80],[-92,-105],[-145,-61],[-128,-17],[-79,-33],[-127,-23],[-117,-63],[-39,-78],[-35,-17],[-72,-83],[-25,-46],[-99,6],[-95,57],[-31,-7],[-55,26],[-58,48],[-77,5],[-238,95],[-135,35],[-121,17],[-91,-5],[-94,-25],[-77,-31],[-136,-20],[-186,-2],[-95,-30],[-101,-16],[-87,-24],[-105,-48],[-26,-67],[-55,-58],[-72,77],[-57,42],[-73,34],[-6,29],[51,79],[-34,76],[-66,26],[-74,5],[-35,-14],[-41,21],[-24,-40],[-101,18],[-15,-20],[-49,16],[-73,16],[19,-75],[34,-34],[14,-56],[-49,-44],[-79,44],[-54,66],[-155,82],[-134,148],[-132,76],[72,-112],[56,-55],[54,-30],[12,-56],[44,-44],[-56,-81],[-86,0],[-51,-58],[-76,-16],[-129,-41],[-11,-37],[-84,-63],[-132,52],[-85,12]],[[8685,2561],[20,45],[-86,-3],[-39,89],[-62,-45],[-55,135],[15,66],[23,22],[-31,85],[-40,-28],[-40,10],[4,97],[60,43],[3,59],[-48,28],[-62,-46],[-66,87],[-22,50],[-54,65],[41,47],[77,6],[24,-47],[39,64],[32,14],[52,-54],[127,-48],[38,1],[56,-69],[52,-29],[92,80],[-31,87],[58,27],[-68,106],[10,121],[-16,34],[21,78],[-69,39],[17,80],[-34,70],[6,38],[-47,41],[8,33],[68,18],[37,-9],[51,106],[53,12],[65,-32],[16,129],[17,62],[-15,28],[11,69],[56,-16],[20,50],[-16,57],[-112,86],[18,84],[41,58],[-109,163],[-11,60],[-28,15],[-20,56],[-77,124],[-40,-22],[-26,112],[44,33],[13,58],[-37,31],[-36,76],[4,36],[91,9],[-71,81],[-1,57],[-26,130],[-35,39],[48,34],[25,40],[-12,85],[15,46],[-9,60],[29,23],[19,65],[41,15],[-14,67],[44,43],[-17,48],[-63,34],[-6,73]],[[91,85],[44,-46],[-22,-39],[-47,10],[-1,44],[26,31]],[[0,179],[51,-44],[-34,-20],[-17,64]],[[8685,2561],[-60,-10],[-83,-54],[-64,12],[-101,-6],[-57,-16],[-82,-53],[-49,60],[-26,-16],[-83,2],[-43,25],[-43,-8],[-29,-72],[24,-20],[45,60],[43,-77],[62,-35],[80,1],[-19,-44],[36,-78],[-37,-26],[6,-55],[-18,-43],[-125,-6],[-58,-37],[-11,50],[-77,11],[-55,49],[-90,9],[-30,23],[-76,-21],[-63,19],[-273,44],[-61,-69],[4,-40],[-42,-52],[-48,37],[-36,66],[-26,-1],[133,-144],[50,-10],[33,-57],[-50,-89],[-31,-19],[21,132],[-93,112],[-88,81],[-153,125],[-211,133],[-100,48],[-31,-1],[-157,46],[-62,-11],[-48,-46],[-57,-30],[-83,-18],[-96,11],[-30,-53],[-57,5],[-124,-8],[-71,-15],[-67,-30],[-68,-124],[-85,-30],[-68,-41],[-57,28],[0,43],[-31,51],[-24,74],[-43,34],[42,-174],[6,-90],[-49,-67],[-51,-100],[-31,-109],[-3,-77],[50,-65],[-52,-21],[-33,28],[-44,-63],[2,-105],[127,-33],[-53,-84],[2,-63],[-39,-43],[-54,-2],[-12,-29],[-76,-25],[-53,-82],[-34,-154],[17,-64],[-59,2],[-66,-52],[-62,42],[-38,9],[-33,-38],[-65,23],[-69,53],[-1,62],[-92,124],[-66,10],[-91,29],[-49,-38],[-45,-4],[-76,76],[-50,-6],[-31,83],[15,57],[-69,-1],[-52,19],[-12,74],[-25,26],[37,108],[-48,-32],[10,-50],[-11,-47],[18,-17],[16,-104],[42,-30],[-92,-55],[-46,50],[-71,45],[-47,14],[-111,-3],[-37,13],[-91,-11],[-30,-50],[-84,-23],[-71,-39],[-78,21],[-77,-24],[-40,14],[-79,-19],[1,50],[-45,7],[-87,-26],[-27,-35],[24,-46],[-50,-50],[-13,-148],[-27,-72],[-32,40],[-78,10],[-92,-92],[-88,-9],[-31,-69],[4,-48],[-68,-78],[-37,61],[16,54],[-21,74],[-44,-8],[-4,-155],[-68,-67],[15,-52],[-36,-46],[56,-40],[28,-83],[-19,-62],[-50,-25],[-9,-69],[-103,10],[-55,-87],[1,-51],[-56,-8],[-6,33],[-50,14],[1,31],[-43,63],[22,55],[-63,131],[-71,71],[-55,1],[-63,44],[-53,-14],[-80,75],[-62,17],[-52,-8],[-44,-56],[27,-60],[-40,-89],[-40,-24],[-81,-3],[-65,-41],[-57,0],[-20,53],[-36,25],[11,45],[30,16],[-23,159],[62,92],[80,12],[26,43],[44,23],[66,60],[108,35],[115,-82],[66,73],[18,37],[104,34],[108,106],[51,24],[31,71],[-3,42],[65,7],[36,62],[48,22],[17,85],[-4,79],[65,25],[48,38],[52,10],[33,62],[5,92],[21,110],[-3,33],[28,74],[64,-1],[16,43],[45,-7],[74,90],[51,-4],[21,38],[84,-2],[54,11],[48,74],[6,106],[17,47],[48,4],[98,101],[46,30],[2,76],[67,41],[104,88],[16,157],[-10,135],[-14,33],[2,75],[36,55],[-6,33],[30,81],[12,166],[117,5],[72,-21],[94,-73],[56,-4],[77,26],[76,113],[46,24],[31,72],[79,-45],[-3,50],[-63,27],[-13,29],[-1,103],[-31,48],[50,83],[-5,92],[25,34],[44,-10],[79,36],[70,8],[33,20],[55,-33],[42,27],[151,17],[16,22],[65,3],[22,-19],[70,33],[90,-5],[39,42],[29,-27],[241,-45],[73,-8],[43,33],[84,-2],[92,-35],[21,-30],[58,-9],[56,-70],[141,-2],[113,-11],[35,25],[143,37],[45,26],[57,8],[92,-29],[97,36],[46,74],[-41,87],[18,130],[36,42],[18,80],[38,111],[42,49],[50,-7],[33,34],[30,76],[57,75],[92,92],[49,29],[74,-1],[62,71],[52,88],[16,85],[40,43],[27,57],[54,38],[37,53],[39,98],[114,83],[29,100],[56,42],[36,-8],[93,67],[-3,52],[-78,-34],[-84,-61],[-51,-63],[-13,-42],[-171,-99],[-53,-56],[3,-20],[-58,-100],[-28,78],[22,92],[-26,16],[6,79],[-19,21],[-2,33],[-11,12],[1,10],[19,8],[8,8],[3,18],[12,35],[-33,46],[17,81],[39,96]]], "transform": { - "scale": [0.0005360715937289712, 0.00032300856994129236 ], + "scale": [0.0005360715937289712, 0.00032300856994129236 ], "translate": [-6.348383337142886, 49.91002832975399 ] }, "objects": { @@ -247,7 +250,7 @@ var targetGeojson = `{ }, "geometry": { "type": "Polygon", - "coordinates": [[[0.21045261213107658, 51.49018625390679 ], [0.20294760981887094, 51.457885396912665 ], [0.1729276005700484, 51.443027002695366 ], [0.150948665227161, 51.420416402799475 ], [0.14773223566478677, 51.39296067435446 ], [0.15309295160207625, 51.37810228013716 ], [0.1370108037902078, 51.34418638029333 ], [0.08501185919849696, 51.31608463470844 ], [0.08179542963612363, 51.29185899196284 ], [0.05874435110577725, 51.28927492340331 ], [0.033012914606787014, 51.307363403320025 ], [0.014786480420002412, 51.29185899196284 ], [0.0024568337642358884, 51.32900497750609 ], [-0.03774853576543702, 51.33869523460433 ], [-0.06401604385815673, 51.31866870326797 ], [-0.08492283601358697, 51.315761626138496 ], [-0.09457212470070786, 51.29928818907149 ], [-0.1240560623558018, 51.286690854843776 ], [-0.15514821479208152, 51.30122624049114 ], [-0.16318928869801663, 51.33029701178585 ], [-0.19749787069667057, 51.343540363153444 ], [-0.21733251966464273, 51.343540363153444 ], [-0.22269323560193222, 51.35710672309098 ], [-0.26129039035041846, 51.37971732298687 ], [-0.28809397003686676, 51.3619518516401 ], [-0.31918612247314737, 51.32803595179627 ], [-0.3304436259414558, 51.348385491702565 ], [-0.3084646905985675, 51.375518211577635 ], [-0.3588554204090908, 51.412018179981004 ], [-0.41889543890673586, 51.4323677198873 ], [-0.456420450467764, 51.438181874146245 ], [-0.4585647368426793, 51.45627035406296 ], [-0.4939454620287913, 51.46273052546179 ], [-0.5057390370908292, 51.47242078256002 ], [-0.48376010174794093, 51.50795172525356 ], [-0.49555367680997886, 51.538314530828046 ], [-0.4767911710294648, 51.558018053594466 ], [-0.5003783211535389, 51.59968615911689 ], [-0.4880486744977732, 51.62681887899196 ], [-0.4569565220614926, 51.612283493344606 ], [-0.43819401628097854, 51.62003569902319 ], [-0.3995968615324923, 51.61325251905443 ], [-0.36582435112756784, 51.621327733302955 ], [-0.31650576450450174, 51.6403852389295 ], [-0.2998875450989038, 51.63586311895032 ], [-0.2543214596319414, 51.64426134176879 ], [-0.24788860050719386, 51.655243633146796 ], [-0.19106501157192302, 51.66396486453521 ], [-0.16372536029174523, 51.682376353021866 ], [-0.10582962816901631, 51.69174360155016 ], [-0.06616033023307288, 51.68399139587157 ], [-0.01094495607898871, 51.68076131017216 ], [-0.012553170860175378, 51.64619939318844 ], [0.02282755432593664, 51.641031256069375 ], [0.021755411138478564, 51.62875693041161 ], [0.06303292385560955, 51.6067923476556 ], [0.08715614557341311, 51.60453128766601 ], [0.13593866060274973, 51.62358879329255 ], [0.168639027820217, 51.621327733302955 ], [0.22385440197430118, 51.63166400754108 ], [0.2645958430977027, 51.608407390505306 ], [0.2721008454099083, 51.587734842029064 ], [0.2903272795966929, 51.56415521642335 ], [0.3128422865333098, 51.56577025927306 ], [0.3316047923138239, 51.540898599387575 ], [0.26513191469143127, 51.53217736799916 ], [0.2635236999102446, 51.51796499092175 ], [0.21045261213107658, 51.49018625390679 ] ] ] + "coordinates": [[[0.21045261213107658, 51.49018625390679 ], [0.20294760981887094, 51.457885396912665 ], [0.1729276005700484, 51.443027002695366 ], [0.150948665227161, 51.420416402799475 ], [0.14773223566478677, 51.39296067435446 ], [0.15309295160207625, 51.37810228013716 ], [0.1370108037902078, 51.34418638029333 ], [0.08501185919849696, 51.31608463470844 ], [0.08179542963612363, 51.29185899196284 ], [0.05874435110577725, 51.28927492340331 ], [0.033012914606787014, 51.307363403320025 ], [0.014786480420002412, 51.29185899196284 ], [0.0024568337642358884, 51.32900497750609 ], [-0.03774853576543702, 51.33869523460433 ], [-0.06401604385815673, 51.31866870326797 ], [-0.08492283601358697, 51.315761626138496 ], [-0.09457212470070786, 51.29928818907149 ], [-0.1240560623558018, 51.286690854843776 ], [-0.15514821479208152, 51.30122624049114 ], [-0.16318928869801663, 51.33029701178585 ], [-0.19749787069667057, 51.343540363153444 ], [-0.21733251966464273, 51.343540363153444 ], [-0.22269323560193222, 51.35710672309098 ], [-0.26129039035041846, 51.37971732298687 ], [-0.28809397003686676, 51.3619518516401 ], [-0.31918612247314737, 51.32803595179627 ], [-0.3304436259414558, 51.348385491702565 ], [-0.3084646905985675, 51.375518211577635 ], [-0.3588554204090908, 51.412018179981004 ], [-0.41889543890673586, 51.4323677198873 ], [-0.456420450467764, 51.438181874146245 ], [-0.4585647368426793, 51.45627035406296 ], [-0.4939454620287913, 51.46273052546179 ], [-0.5057390370908292, 51.47242078256002 ], [-0.48376010174794093, 51.50795172525356 ], [-0.49555367680997886, 51.538314530828046 ], [-0.4767911710294648, 51.558018053594466 ], [-0.5003783211535389, 51.59968615911689 ], [-0.4880486744977732, 51.62681887899196 ], [-0.4569565220614926, 51.612283493344606 ], [-0.43819401628097854, 51.62003569902319 ], [-0.3995968615324923, 51.61325251905443 ], [-0.36582435112756784, 51.621327733302955 ], [-0.31650576450450174, 51.6403852389295 ], [-0.2998875450989038, 51.63586311895032 ], [-0.2543214596319414, 51.64426134176879 ], [-0.24788860050719386, 51.655243633146796 ], [-0.19106501157192302, 51.66396486453521 ], [-0.16372536029174523, 51.682376353021866 ], [-0.10582962816901631, 51.69174360155016 ], [-0.06616033023307288, 51.68399139587157 ], [-0.01094495607898871, 51.68076131017216 ], [-0.012553170860175378, 51.64619939318844 ], [0.02282755432593664, 51.641031256069375 ], [0.021755411138478564, 51.62875693041161 ], [0.06303292385560955, 51.6067923476556 ], [0.08715614557341311, 51.60453128766601 ], [0.13593866060274973, 51.62358879329255 ], [0.168639027820217, 51.621327733302955 ], [0.22385440197430118, 51.63166400754108 ], [0.2645958430977027, 51.608407390505306 ], [0.2721008454099083, 51.587734842029064 ], [0.2903272795966929, 51.56415521642335 ], [0.3128422865333098, 51.56577025927306 ], [0.3316047923138239, 51.540898599387575 ], [0.26513191469143127, 51.53217736799916 ], [0.2635236999102446, 51.51796499092175 ], [0.21045261213107658, 51.49018625390679 ] ] ] } }, { @@ -258,7 +261,7 @@ var targetGeojson = `{ }, "geometry": { "type": "MultiPolygon", - "coordinates": [[[[-1.2980528526222486, 50.765032014388595 ], [-1.272857487716987, 50.766001040098416 ], [-1.2401571204995196, 50.74403645734241 ], [-1.2106731828444257, 50.734992217384054 ], [-1.1613545962213605, 50.73337717453435 ], [-1.1093556516296506, 50.72142585744652 ], [-1.097026004973884, 50.69074004330209 ], [-1.07343885484981, 50.6813727947738 ], [-1.098098148161342, 50.66522236627673 ], [-1.1249017278477904, 50.663930331996966 ], [-1.1592103098464452, 50.650686980629374 ], [-1.1742203144708565, 50.62516930360401 ], [-1.1790449588144165, 50.60094366085842 ], [-1.2423014068744358, 50.582855180941706 ], [-1.308238212903099, 50.5773640352527 ], [-1.3184235731839493, 50.58931535234053 ], [-1.3891850235561733, 50.62678434645372 ], [-1.4470807556789023, 50.64358079209067 ], [-1.485141838833659, 50.66683740912644 ], [-1.5237389935821453, 50.66812944340621 ], [-1.548934358487407, 50.66360732342703 ], [-1.550006501674865, 50.6774966919345 ], [-1.5221307788009586, 50.7072134803691 ], [-1.4701318342092486, 50.709797548928634 ], [-1.4256378919297434, 50.72691700313552 ], [-1.397762169055837, 50.72885505455517 ], [-1.3473714392453138, 50.743390440202525 ], [-1.314135000434118, 50.76729307437818 ], [-1.2980528526222486, 50.765032014388595 ] ] ], [[[-0.9233388086056973, 50.83060275408668 ], [-0.9120813051373888, 50.82737266838726 ], [-0.9110091619499316, 50.80347003421161 ], [-0.9426373859799408, 50.815421351299435 ], [-0.9233388086056973, 50.83060275408668 ] ] ], [[[-0.9689048940726606, 50.83383283978609 ], [-0.9528227462607912, 50.828341694097084 ], [-0.9597916769792674, 50.79087269998389 ], [-0.9710491804475758, 50.7815054514556 ], [-1.021439910258099, 50.786350580004715 ], [-0.990883829415548, 50.8018549913619 ], [-0.9823066839158843, 50.83060275408668 ], [-0.9689048940726606, 50.83383283978609 ] ] ], [[[-1.0546763490692959, 50.83350983121615 ], [-1.0412745592260713, 50.82414258268785 ], [-1.0364499148825104, 50.78570456286484 ], [-1.0889849310679498, 50.7776293486163 ], [-1.1098917232233791, 50.79151871712378 ], [-1.0938095754115107, 50.808638171330664 ], [-1.0948817185989688, 50.82704965981732 ], [-1.0836242151306603, 50.82995673694679 ], [-1.0766552844121833, 50.83673991691556 ], [-1.0546763490692959, 50.83350983121615 ] ] ], [[[0.7443799194851319, 51.4472261141046 ], [0.791554219733281, 51.43915089985607 ], [0.8156774414510854, 51.427845599908125 ], [0.9019849680414493, 51.41654029996018 ], [0.9379017648212908, 51.389730588655055 ], [0.950767483070786, 51.373580160157985 ], [0.9084178271661969, 51.35549168024127 ], [0.8891192497919542, 51.355168671671336 ], [0.868212457636524, 51.365181937339514 ], [0.8205020857946455, 51.36905804017881 ], [0.7776163582963278, 51.36776600589904 ], [0.7685031412029355, 51.381009357266635 ], [0.7513488502036081, 51.39392970006429 ], [0.7368749171729263, 51.43204471131736 ], [0.7443799194851319, 51.4472261141046 ] ] ], [[[-0.6681687299907075, 52.1949909535187 ], [-0.6274272888673051, 52.18142459358116 ], [-0.6349322911795108, 52.168181242213564 ], [-0.6343962195857822, 52.13781843663909 ], [-0.6070565683056044, 52.13394233379979 ], [-0.5931187068686512, 52.110362708194074 ], [-0.6059844251181463, 52.09195121970742 ], [-0.6258190740861185, 52.08452202259877 ], [-0.6692408731781656, 52.048668071335285 ], [-0.6429733650854459, 52.03736277138734 ], [-0.6451176514603612, 52.01378314578163 ], [-0.66173587086596, 51.99957076870421 ], [-0.6553030117412115, 51.96048673174131 ], [-0.6815705198339312, 51.937553123275485 ], [-0.7019412403956329, 51.90912836912065 ], [-0.673529445927997, 51.90137616344206 ], [-0.6547669401474829, 51.887809803504524 ], [-0.6199222865550995, 51.88554874351494 ], [-0.6092008546805205, 51.87553547784675 ], [-0.5770365590567819, 51.86584522074852 ], [-0.5480886929954174, 51.83580542374398 ], [-0.5818612034003428, 51.8070576610192 ], [-0.5974072796184835, 51.81416384955791 ], [-0.6343962195857822, 51.818685969537086 ], [-0.6670965868032495, 51.815778892407614 ], [-0.690147665333595, 51.84129656943298 ], [-0.6922919517085111, 51.857123989360105 ], [-0.7174873166137727, 51.857123989360105 ], [-0.7448269678939505, 51.83774347516363 ], [-0.7190955313949594, 51.81610190097756 ], [-0.7094462427078376, 51.820624020956735 ], [-0.6826426630213893, 51.79704439535102 ], [-0.6762098038966418, 51.77120370975572 ], [-0.6435094366791745, 51.75408425554883 ], [-0.586149776150175, 51.75214620412918 ], [-0.5727479863069505, 51.73599577563212 ], [-0.5502329793703336, 51.73050462994311 ], [-0.5630986976198287, 51.71177013288652 ], [-0.5475526214016888, 51.70304890149811 ], [-0.5464804782142307, 51.680438301602216 ], [-0.5110997530281187, 51.67979228446233 ], [-0.5052029654970998, 51.673009104493566 ], [-0.5373672611208384, 51.642969307489025 ], [-0.5303983304023614, 51.617774639033605 ], [-0.5180686837465958, 51.60033217625678 ], [-0.5003783211535389, 51.59968615911689 ], [-0.4767911710294648, 51.558018053594466 ], [-0.49555367680997886, 51.538314530828046 ], [-0.48376010174794093, 51.50795172525356 ], [-0.5057390370908292, 51.47242078256002 ], [-0.4939454620287913, 51.46273052546179 ], [-0.4585647368426793, 51.45627035406296 ], [-0.456420450467764, 51.438181874146245 ], [-0.41889543890673586, 51.4323677198873 ], [-0.3588554204090908, 51.412018179981004 ], [-0.3084646905985675, 51.375518211577635 ], [-0.3304436259414558, 51.348385491702565 ], [-0.31918612247314737, 51.32803595179627 ], [-0.28809397003686676, 51.3619518516401 ], [-0.26129039035041846, 51.37971732298687 ], [-0.22269323560193222, 51.35710672309098 ], [-0.21733251966464273, 51.343540363153444 ], [-0.19749787069667057, 51.343540363153444 ], [-0.16318928869801663, 51.33029701178585 ], [-0.15514821479208152, 51.30122624049114 ], [-0.1240560623558018, 51.286690854843776 ], [-0.09457212470070786, 51.29928818907149 ], [-0.08492283601358697, 51.315761626138496 ], [-0.06401604385815673, 51.31866870326797 ], [-0.03774853576543702, 51.33869523460433 ], [0.0024568337642358884, 51.32900497750609 ], [0.014786480420002412, 51.29185899196284 ], [0.033012914606787014, 51.307363403320025 ], [0.05874435110577725, 51.28927492340331 ], [0.08179542963612363, 51.29185899196284 ], [0.08501185919849696, 51.31608463470844 ], [0.1370108037902078, 51.34418638029333 ], [0.15309295160207625, 51.37810228013716 ], [0.14773223566478677, 51.39296067435446 ], [0.150948665227161, 51.420416402799475 ], [0.1729276005700484, 51.443027002695366 ], [0.20294760981887094, 51.457885396912665 ], [0.22010190081819836, 51.47952697109873 ], [0.27424513178482446, 51.45368628550343 ], [0.31445050131449737, 51.465960611161194 ], [0.32838836275145056, 51.45077920837396 ], [0.38842838124909473, 51.44335001126531 ], [0.4393551826533475, 51.447549122674545 ], [0.4570455452464035, 51.454009294073366 ], [0.4618701895899644, 51.47532785968949 ], [0.48170483855793567, 51.48727917677732 ], [0.5878470141162726, 51.48404909107791 ], [0.6151866653964495, 51.47500485111955 ], [0.6457427462390015, 51.47888095395885 ], [0.703102406768001, 51.47112874828026 ], [0.7202566977673284, 51.459823448332315 ], [0.7234731273297017, 51.44335001126531 ], [0.6998859772056276, 51.433336745597124 ], [0.6779070418627393, 51.43301373702719 ], [0.6623609656445995, 51.44787213124449 ], [0.6285884552396741, 51.44108895127572 ], [0.6108980926466181, 51.417509325670004 ], [0.5454973582116835, 51.412018179981004 ], [0.5530023605238892, 51.40038987146311 ], [0.5771255822416927, 51.39069961436488 ], [0.6210834529274685, 51.38908457151517 ], [0.6575363213010386, 51.39263766578453 ], [0.6661134668007023, 51.37971732298687 ], [0.7138238386425808, 51.384885460105934 ], [0.7261534852983464, 51.39974385432323 ], [0.7626063536719165, 51.38423944296605 ], [0.7647506400468327, 51.36292087734992 ], [0.8376563767939729, 51.353876637391565 ], [0.8746453167612716, 51.35419964596151 ], [0.8944799657292437, 51.340956294593916 ], [0.9368296216338328, 51.3470934574228 ], [0.9593446285704497, 51.34515540600315 ], [1.0081271435997854, 51.35000053455227 ], [1.033322508505047, 51.36550494590946 ], [1.1662682637498323, 51.374549185867814 ], [1.1995047025610281, 51.37971732298687 ], [1.251503647152739, 51.3768102458574 ], [1.2901008019012243, 51.38262440011634 ], [1.328161885055981, 51.38197838297646 ], [1.3844494023975233, 51.39263766578453 ], [1.4418090629265237, 51.38714652009552 ], [1.4493140652387293, 51.377456262997285 ], [1.4423451345202523, 51.35000053455227 ], [1.4144694116463459, 51.32738993465638 ], [1.3769444000853177, 51.329650994645974 ], [1.3774804716790472, 51.28733687198366 ], [1.404820122959224, 51.229841346534116 ], [1.4058922661466822, 51.18688120673192 ], [1.4010676218031213, 51.165239632545855 ], [1.3823051160226072, 51.144567084069614 ], [1.3485326056176827, 51.133261784121665 ], [1.3126158088378412, 51.11452728706507 ], [1.2675857949646074, 51.10160694426742 ], [1.2263082822474773, 51.099668892847774 ], [1.2059375616857757, 51.092885712879 ], [1.1893193422801778, 51.077381301521825 ], [1.0944346701901502, 51.06769104442358 ], [1.0611982313789534, 51.05961583017505 ], [1.0070550004123273, 51.0318370931601 ], [0.9845399934757113, 51.013425604673444 ], [0.9641692729140097, 50.96820440488167 ], [0.9807874923196085, 50.914584982271414 ], [0.9373656932275614, 50.91232392228182 ], [0.7979870788580286, 50.932350453618184 ], [0.7813688594524306, 50.933319479328006 ], [0.7186484829861408, 50.9074787937327 ], [0.6693298963630756, 50.87356289388887 ], [0.5915995152723754, 50.85385937112245 ], [0.5229823512750666, 50.84836822543345 ], [0.4806326953704776, 50.83770894262538 ], [0.4125516029668983, 50.830279745516734 ], [0.3498312265006094, 50.809930205610435 ], [0.32892443434517915, 50.78473553715501 ], [0.31016192856466507, 50.77924439146601 ], [0.27156477381617883, 50.75243468016088 ], [0.2581629839729551, 50.73757628594358 ], [0.2050918961937871, 50.73951433736323 ], [0.15416509478953433, 50.75792582584988 ], [0.1375468753839364, 50.755664765860296 ], [0.10806293772884334, 50.764062988678766 ], [0.07697078529256274, 50.77956740003595 ], [0.035693272575431756, 50.78118244288566 ], [-0.09189176673206312, 50.81186825703008 ], [-0.1642614318854747, 50.82317355697803 ], [-0.22912609472667977, 50.82866470266703 ], [-0.2779086097560164, 50.82704965981732 ], [-0.32829933956653967, 50.81897444556879 ], [-0.36957685228367065, 50.80896117990061 ], [-0.44248258903081084, 50.802501008501785 ], [-0.5421919054643993, 50.8018549913619 ], [-0.5931187068686512, 50.792164734263665 ], [-0.6472619378352773, 50.7869965971446 ], [-0.6939001664896978, 50.77924439146601 ], [-0.75018768383124, 50.76373998010883 ], [-0.7641255452681932, 50.74209840592276 ], [-0.7936094829232863, 50.72336390886617 ], [-0.8322066376717725, 50.748235568751646 ], [-0.8627627185143236, 50.76180192868918 ], [-0.9018959448565385, 50.77278422006718 ], [-0.9051123744189127, 50.78215146859548 ], [-0.8777727231387349, 50.80766914562084 ], [-0.8959991573255204, 50.83221779693638 ], [-0.9313798825116324, 50.840616019754854 ], [-0.9710491804475758, 50.84223106260456 ], [-0.9898116862280899, 50.83770894262538 ], [-1.0117906215709782, 50.84449212259415 ], [-1.0246563398204733, 50.8315717797965 ], [-1.0787995707870994, 50.83738593405544 ], [-1.0868406446930337, 50.83092576265662 ], [-1.1131081527857534, 50.836093899775676 ], [-1.1522413791279682, 50.84126203689474 ], [-1.1420560188471178, 50.81703639414914 ], [-1.1238295846603332, 50.806054102771135 ], [-1.1163245823481276, 50.78796562285442 ], [-1.1425920904408464, 50.77375324577701 ], [-1.1849417463454355, 50.78796562285442 ], [-1.2138896124068, 50.80928418847055 ], [-1.2969807094347905, 50.83577089120573 ], [-1.3688143029944726, 50.883576159557045 ], [-1.4395757533666966, 50.908124810872586 ], [-1.4009785986182113, 50.87194785103916 ], [-1.3709585893693887, 50.85418237969239 ], [-1.3420107233080243, 50.84449212259415 ], [-1.3355778641832767, 50.82640364267744 ], [-1.3119907140592018, 50.81219126560002 ], [-1.3420107233080243, 50.78602757143478 ], [-1.3881128803687153, 50.78602757143478 ], [-1.415452531648893, 50.76729307437818 ], [-1.4561939727722946, 50.762124937259124 ], [-1.525347208363332, 50.748881585891525 ], [-1.531243995894351, 50.7369302688037 ], [-1.5762740097675847, 50.7165807288974 ], [-1.6470354601398087, 50.73337717453435 ], [-1.6926015456067711, 50.73725327737364 ], [-1.6818801137321922, 50.751788663021 ], [-1.7279822707928831, 50.750819637311174 ], [-1.7488890629483134, 50.77956740003595 ], [-1.7821255017595092, 50.765032014388595 ], [-1.8116094394146032, 50.808638171330664 ], [-1.803568365508668, 50.82995673694679 ], [-1.7912387188529015, 50.8370629254855 ], [-1.8078569382585004, 50.86451865393051 ], [-1.8292998020076592, 50.85547441397215 ], [-1.850742665756818, 50.85870449967157 ], [-1.8485983793819019, 50.89003633095587 ], [-1.8164340837581632, 50.90392569946335 ], [-1.8148258689769765, 50.922983205089885 ], [-1.8405573054759676, 50.93202744504824 ], [-1.8737937442871635, 50.91716905083094 ], [-1.9091744694732755, 50.945270796415834 ], [-1.9209680445353126, 50.9614212249129 ], [-1.949915910596677, 50.98241678195908 ], [-1.9279369752537896, 50.99759818474632 ], [-1.8866594625366586, 50.99953623616597 ], [-1.8737937442871635, 50.98435483337873 ], [-1.8528869521317333, 51.00502738185497 ], [-1.8357326611324067, 51.00954950183415 ], [-1.8078569382585004, 50.99210703905732 ], [-1.739775845854921, 50.97660262770014 ], [-1.7194051252932194, 50.97692563627008 ], [-1.6893851160443978, 50.95463804494413 ], [-1.6615093931704905, 50.945270796415834 ], [-1.6121908065474253, 50.97111148201114 ], [-1.6288090259530232, 50.99921322759603 ], [-1.5977168735167435, 51.007934458984444 ], [-1.6341697418903136, 51.04217336739822 ], [-1.6288090259530232, 51.08125740436112 ], [-1.637386171452687, 51.092239695739124 ], [-1.6261286679843785, 51.117434364194544 ], [-1.663117607951678, 51.13003169842225 ], [-1.6540043908582858, 51.155872384017556 ], [-1.6722308250450704, 51.17848298391345 ], [-1.6690143954826961, 51.19075730957122 ], [-1.6942097603879578, 51.20400066093881 ], [-1.6899211876381264, 51.214659943746874 ], [-1.6534683192645563, 51.220474098005816 ], [-1.6336336702965841, 51.217567020876345 ], [-1.6062940190164072, 51.25180592929012 ], [-1.5778822245487714, 51.255682032129414 ], [-1.543037570956388, 51.24534575789129 ], [-1.5344604254567251, 51.28701386341372 ], [-1.525347208363332, 51.30704039475008 ], [-1.533388282269267, 51.31608463470844 ], [-1.527491494738248, 51.33837222603439 ], [-1.4974714854894255, 51.33320408891532 ], [-1.4867500536148466, 51.349354517412394 ], [-1.4953271991145103, 51.36776600589904 ], [-1.5553672176121545, 51.395544742914 ], [-1.5457179289250336, 51.42267746278906 ], [-1.5237389935821453, 51.44141195984566 ], [-1.5821707972986028, 51.49406235674609 ], [-1.5880675848296217, 51.51344287094257 ], [-1.603077589454033, 51.51828799949168 ], [-1.6137990213286129, 51.536376479408396 ], [-1.655076534045743, 51.57642954208112 ], [-1.6765193977949018, 51.56932335354241 ], [-1.690457259231855, 51.605500313375835 ], [-1.6668701091077809, 51.6161595961839 ], [-1.6599011783893038, 51.63489409324049 ], [-1.679735827357276, 51.644907358908675 ], [-1.6990344047315187, 51.66945601022421 ], [-1.6968901183566034, 51.681084318742094 ], [-1.6481076033272668, 51.68399139587157 ], [-1.6861686864820236, 51.710155090036814 ], [-1.6867047580757522, 51.72856657852347 ], [-1.7006426195127062, 51.77055769261584 ], [-1.7194051252932194, 51.783155026843545 ], [-1.6936736887942292, 51.79413731822155 ], [-1.6802718989510046, 51.8070576610192 ], [-1.6867047580757522, 51.83451338946421 ], [-1.678663684169818, 51.84937178368151 ], [-1.6834883285133788, 51.86875229787799 ], [-1.667942252295239, 51.87618149498664 ], [-1.6577568920143877, 51.89717705203282 ], [-1.6357779566715003, 51.902022180581945 ], [-1.643282958983706, 51.92366375476801 ], [-1.619695808859631, 51.937553123275485 ], [-1.6288090259530232, 51.95305753463266 ], [-1.6625815363579486, 51.96403982601067 ], [-1.6657979659203228, 51.98761945161638 ], [-1.6298811691404813, 51.96985398026961 ], [-1.6121908065474253, 51.955318594622256 ], [-1.5918200859857246, 51.9704999974095 ], [-1.5494704300811355, 51.98083627164762 ], [-1.5290997095194347, 51.9924645801655 ], [-1.5108732753326501, 52.02153535146022 ], [-1.4974714854894255, 52.060942396993056 ], [-1.5017600582392578, 52.07160167980112 ], [-1.480317194490099, 52.093566262557125 ], [-1.4470807556789023, 52.09776537396637 ], [-1.4535136148036498, 52.1129467767536 ], [-1.4245657487422854, 52.11811491387267 ], [-1.3854325224000705, 52.09421227969701 ], [-1.3575567995261641, 52.10131846823572 ], [-1.3827521644314258, 52.127482162400966 ], [-1.3409385801205662, 52.144924625177794 ], [-1.331825363027174, 52.168504250783506 ], [-1.2766099888730897, 52.117145888162845 ], [-1.2530228387490148, 52.103902536795246 ], [-1.2873314207476687, 52.092597236847304 ], [-1.321103931152594, 52.08775210829818 ], [-1.3055578549344542, 52.07192468837106 ], [-1.3130628572466598, 52.05125213989482 ], [-1.297516781028519, 52.04285391707634 ], [-1.2782182036542764, 52.01410615435157 ], [-1.2873314207476687, 51.98955750303603 ], [-1.261063912654949, 51.98083627164762 ], [-1.2417653352807063, 51.98632741733662 ], [-1.1978074645949306, 51.97728317737826 ], [-1.1640349541900052, 51.993433605875325 ], [-1.1345510165349122, 51.997309708714624 ], [-1.119541011910501, 52.01636721434116 ], [-1.1361592313160989, 52.019920308610516 ], [-1.1222213698791457, 52.04479196849599 ], [-1.0530681342881083, 52.05965036271329 ], [-1.02626455460166, 52.07547778264042 ], [-0.9678327508852025, 52.070955662661234 ], [-0.9453177439485856, 52.076769816920184 ], [-0.9303077393241743, 52.043176925646286 ], [-0.9061845176063708, 52.02121234289028 ], [-0.8708037924202587, 52.04382294278617 ], [-0.8574020025770341, 52.06417248269247 ], [-0.8386394967965201, 52.06417248269247 ], [-0.8354230672341467, 52.079676894049655 ], [-0.8466805707024543, 52.09162821113748 ], [-0.8868859402321272, 52.114238811033374 ], [-0.8691955776390712, 52.13071224810038 ], [-0.8284541365156697, 52.13265029952002 ], [-0.8075473443602394, 52.15687594226562 ], [-0.7877126953922682, 52.15429187370609 ], [-0.7346416076130993, 52.17334937933263 ], [-0.7019412403956329, 52.19337591066899 ], [-0.6681687299907075, 52.1949909535187 ] ] ] ] + "coordinates": [[[[-1.2980528526222486, 50.765032014388595 ], [-1.272857487716987, 50.766001040098416 ], [-1.2401571204995196, 50.74403645734241 ], [-1.2106731828444257, 50.734992217384054 ], [-1.1613545962213605, 50.73337717453435 ], [-1.1093556516296506, 50.72142585744652 ], [-1.097026004973884, 50.69074004330209 ], [-1.07343885484981, 50.6813727947738 ], [-1.098098148161342, 50.66522236627673 ], [-1.1249017278477904, 50.663930331996966 ], [-1.1592103098464452, 50.650686980629374 ], [-1.1742203144708565, 50.62516930360401 ], [-1.1790449588144165, 50.60094366085842 ], [-1.2423014068744358, 50.582855180941706 ], [-1.308238212903099, 50.5773640352527 ], [-1.3184235731839493, 50.58931535234053 ], [-1.3891850235561733, 50.62678434645372 ], [-1.4470807556789023, 50.64358079209067 ], [-1.485141838833659, 50.66683740912644 ], [-1.5237389935821453, 50.66812944340621 ], [-1.548934358487407, 50.66360732342703 ], [-1.550006501674865, 50.6774966919345 ], [-1.5221307788009586, 50.7072134803691 ], [-1.4701318342092486, 50.709797548928634 ], [-1.4256378919297434, 50.72691700313552 ], [-1.397762169055837, 50.72885505455517 ], [-1.3473714392453138, 50.743390440202525 ], [-1.314135000434118, 50.76729307437818 ], [-1.2980528526222486, 50.765032014388595 ] ] ], [[[-0.9233388086056973, 50.83060275408668 ], [-0.9120813051373888, 50.82737266838726 ], [-0.9110091619499316, 50.80347003421161 ], [-0.9426373859799408, 50.815421351299435 ], [-0.9233388086056973, 50.83060275408668 ] ] ], [[[-0.9689048940726606, 50.83383283978609 ], [-0.9528227462607912, 50.828341694097084 ], [-0.9597916769792674, 50.79087269998389 ], [-0.9710491804475758, 50.7815054514556 ], [-1.021439910258099, 50.786350580004715 ], [-0.990883829415548, 50.8018549913619 ], [-0.9823066839158843, 50.83060275408668 ], [-0.9689048940726606, 50.83383283978609 ] ] ], [[[-1.0546763490692959, 50.83350983121615 ], [-1.0412745592260713, 50.82414258268785 ], [-1.0364499148825104, 50.78570456286484 ], [-1.0889849310679498, 50.7776293486163 ], [-1.1098917232233791, 50.79151871712378 ], [-1.0938095754115107, 50.808638171330664 ], [-1.0948817185989688, 50.82704965981732 ], [-1.0836242151306603, 50.82995673694679 ], [-1.0766552844121833, 50.83673991691556 ], [-1.0546763490692959, 50.83350983121615 ] ] ], [[[0.7443799194851319, 51.4472261141046 ], [0.791554219733281, 51.43915089985607 ], [0.8156774414510854, 51.427845599908125 ], [0.9019849680414493, 51.41654029996018 ], [0.9379017648212908, 51.389730588655055 ], [0.950767483070786, 51.373580160157985 ], [0.9084178271661969, 51.35549168024127 ], [0.8891192497919542, 51.355168671671336 ], [0.868212457636524, 51.365181937339514 ], [0.8205020857946455, 51.36905804017881 ], [0.7776163582963278, 51.36776600589904 ], [0.7685031412029355, 51.381009357266635 ], [0.7513488502036081, 51.39392970006429 ], [0.7368749171729263, 51.43204471131736 ], [0.7443799194851319, 51.4472261141046 ] ] ], [[[-0.6681687299907075, 52.1949909535187 ], [-0.6274272888673051, 52.18142459358116 ], [-0.6349322911795108, 52.168181242213564 ], [-0.6343962195857822, 52.13781843663909 ], [-0.6070565683056044, 52.13394233379979 ], [-0.5931187068686512, 52.110362708194074 ], [-0.6059844251181463, 52.09195121970742 ], [-0.6258190740861185, 52.08452202259877 ], [-0.6692408731781656, 52.048668071335285 ], [-0.6429733650854459, 52.03736277138734 ], [-0.6451176514603612, 52.01378314578163 ], [-0.66173587086596, 51.99957076870421 ], [-0.6553030117412115, 51.96048673174131 ], [-0.6815705198339312, 51.937553123275485 ], [-0.7019412403956329, 51.90912836912065 ], [-0.673529445927997, 51.90137616344206 ], [-0.6547669401474829, 51.887809803504524 ], [-0.6199222865550995, 51.88554874351494 ], [-0.6092008546805205, 51.87553547784675 ], [-0.5770365590567819, 51.86584522074852 ], [-0.5480886929954174, 51.83580542374398 ], [-0.5818612034003428, 51.8070576610192 ], [-0.5974072796184835, 51.81416384955791 ], [-0.6343962195857822, 51.818685969537086 ], [-0.6670965868032495, 51.815778892407614 ], [-0.690147665333595, 51.84129656943298 ], [-0.6922919517085111, 51.857123989360105 ], [-0.7174873166137727, 51.857123989360105 ], [-0.7448269678939505, 51.83774347516363 ], [-0.7190955313949594, 51.81610190097756 ], [-0.7094462427078376, 51.820624020956735 ], [-0.6826426630213893, 51.79704439535102 ], [-0.6762098038966418, 51.77120370975572 ], [-0.6435094366791745, 51.75408425554883 ], [-0.586149776150175, 51.75214620412918 ], [-0.5727479863069505, 51.73599577563212 ], [-0.5502329793703336, 51.73050462994311 ], [-0.5630986976198287, 51.71177013288652 ], [-0.5475526214016888, 51.70304890149811 ], [-0.5464804782142307, 51.680438301602216 ], [-0.5110997530281187, 51.67979228446233 ], [-0.5052029654970998, 51.673009104493566 ], [-0.5373672611208384, 51.642969307489025 ], [-0.5303983304023614, 51.617774639033605 ], [-0.5180686837465958, 51.60033217625678 ], [-0.5003783211535389, 51.59968615911689 ], [-0.4767911710294648, 51.558018053594466 ], [-0.49555367680997886, 51.538314530828046 ], [-0.48376010174794093, 51.50795172525356 ], [-0.5057390370908292, 51.47242078256002 ], [-0.4939454620287913, 51.46273052546179 ], [-0.4585647368426793, 51.45627035406296 ], [-0.456420450467764, 51.438181874146245 ], [-0.41889543890673586, 51.4323677198873 ], [-0.3588554204090908, 51.412018179981004 ], [-0.3084646905985675, 51.375518211577635 ], [-0.3304436259414558, 51.348385491702565 ], [-0.31918612247314737, 51.32803595179627 ], [-0.28809397003686676, 51.3619518516401 ], [-0.26129039035041846, 51.37971732298687 ], [-0.22269323560193222, 51.35710672309098 ], [-0.21733251966464273, 51.343540363153444 ], [-0.19749787069667057, 51.343540363153444 ], [-0.16318928869801663, 51.33029701178585 ], [-0.15514821479208152, 51.30122624049114 ], [-0.1240560623558018, 51.286690854843776 ], [-0.09457212470070786, 51.29928818907149 ], [-0.08492283601358697, 51.315761626138496 ], [-0.06401604385815673, 51.31866870326797 ], [-0.03774853576543702, 51.33869523460433 ], [0.0024568337642358884, 51.32900497750609 ], [0.014786480420002412, 51.29185899196284 ], [0.033012914606787014, 51.307363403320025 ], [0.05874435110577725, 51.28927492340331 ], [0.08179542963612363, 51.29185899196284 ], [0.08501185919849696, 51.31608463470844 ], [0.1370108037902078, 51.34418638029333 ], [0.15309295160207625, 51.37810228013716 ], [0.14773223566478677, 51.39296067435446 ], [0.150948665227161, 51.420416402799475 ], [0.1729276005700484, 51.443027002695366 ], [0.20294760981887094, 51.457885396912665 ], [0.22010190081819836, 51.47952697109873 ], [0.27424513178482446, 51.45368628550343 ], [0.31445050131449737, 51.465960611161194 ], [0.32838836275145056, 51.45077920837396 ], [0.38842838124909473, 51.44335001126531 ], [0.4393551826533475, 51.447549122674545 ], [0.4570455452464035, 51.454009294073366 ], [0.4618701895899644, 51.47532785968949 ], [0.48170483855793567, 51.48727917677732 ], [0.5878470141162726, 51.48404909107791 ], [0.6151866653964495, 51.47500485111955 ], [0.6457427462390015, 51.47888095395885 ], [0.703102406768001, 51.47112874828026 ], [0.7202566977673284, 51.459823448332315 ], [0.7234731273297017, 51.44335001126531 ], [0.6998859772056276, 51.433336745597124 ], [0.6779070418627393, 51.43301373702719 ], [0.6623609656445995, 51.44787213124449 ], [0.6285884552396741, 51.44108895127572 ], [0.6108980926466181, 51.417509325670004 ], [0.5454973582116835, 51.412018179981004 ], [0.5530023605238892, 51.40038987146311 ], [0.5771255822416927, 51.39069961436488 ], [0.6210834529274685, 51.38908457151517 ], [0.6575363213010386, 51.39263766578453 ], [0.6661134668007023, 51.37971732298687 ], [0.7138238386425808, 51.384885460105934 ], [0.7261534852983464, 51.39974385432323 ], [0.7626063536719165, 51.38423944296605 ], [0.7647506400468327, 51.36292087734992 ], [0.8376563767939729, 51.353876637391565 ], [0.8746453167612716, 51.35419964596151 ], [0.8944799657292437, 51.340956294593916 ], [0.9368296216338328, 51.3470934574228 ], [0.9593446285704497, 51.34515540600315 ], [1.0081271435997854, 51.35000053455227 ], [1.033322508505047, 51.36550494590946 ], [1.1662682637498323, 51.374549185867814 ], [1.1995047025610281, 51.37971732298687 ], [1.251503647152739, 51.3768102458574 ], [1.2901008019012243, 51.38262440011634 ], [1.328161885055981, 51.38197838297646 ], [1.3844494023975233, 51.39263766578453 ], [1.4418090629265237, 51.38714652009552 ], [1.4493140652387293, 51.377456262997285 ], [1.4423451345202523, 51.35000053455227 ], [1.4144694116463459, 51.32738993465638 ], [1.3769444000853177, 51.329650994645974 ], [1.3774804716790472, 51.28733687198366 ], [1.404820122959224, 51.229841346534116 ], [1.4058922661466822, 51.18688120673192 ], [1.4010676218031213, 51.165239632545855 ], [1.3823051160226072, 51.144567084069614 ], [1.3485326056176827, 51.133261784121665 ], [1.3126158088378412, 51.11452728706507 ], [1.2675857949646074, 51.10160694426742 ], [1.2263082822474773, 51.099668892847774 ], [1.2059375616857757, 51.092885712879 ], [1.1893193422801778, 51.077381301521825 ], [1.0944346701901502, 51.06769104442358 ], [1.0611982313789534, 51.05961583017505 ], [1.0070550004123273, 51.0318370931601 ], [0.9845399934757113, 51.013425604673444 ], [0.9641692729140097, 50.96820440488167 ], [0.9807874923196085, 50.914584982271414 ], [0.9373656932275614, 50.91232392228182 ], [0.7979870788580286, 50.932350453618184 ], [0.7813688594524306, 50.933319479328006 ], [0.7186484829861408, 50.9074787937327 ], [0.6693298963630756, 50.87356289388887 ], [0.5915995152723754, 50.85385937112245 ], [0.5229823512750666, 50.84836822543345 ], [0.4806326953704776, 50.83770894262538 ], [0.4125516029668983, 50.830279745516734 ], [0.3498312265006094, 50.809930205610435 ], [0.32892443434517915, 50.78473553715501 ], [0.31016192856466507, 50.77924439146601 ], [0.27156477381617883, 50.75243468016088 ], [0.2581629839729551, 50.73757628594358 ], [0.2050918961937871, 50.73951433736323 ], [0.15416509478953433, 50.75792582584988 ], [0.1375468753839364, 50.755664765860296 ], [0.10806293772884334, 50.764062988678766 ], [0.07697078529256274, 50.77956740003595 ], [0.035693272575431756, 50.78118244288566 ], [-0.09189176673206312, 50.81186825703008 ], [-0.1642614318854747, 50.82317355697803 ], [-0.22912609472667977, 50.82866470266703 ], [-0.2779086097560164, 50.82704965981732 ], [-0.32829933956653967, 50.81897444556879 ], [-0.36957685228367065, 50.80896117990061 ], [-0.44248258903081084, 50.802501008501785 ], [-0.5421919054643993, 50.8018549913619 ], [-0.5931187068686512, 50.792164734263665 ], [-0.6472619378352773, 50.7869965971446 ], [-0.6939001664896978, 50.77924439146601 ], [-0.75018768383124, 50.76373998010883 ], [-0.7641255452681932, 50.74209840592276 ], [-0.7936094829232863, 50.72336390886617 ], [-0.8322066376717725, 50.748235568751646 ], [-0.8627627185143236, 50.76180192868918 ], [-0.9018959448565385, 50.77278422006718 ], [-0.9051123744189127, 50.78215146859548 ], [-0.8777727231387349, 50.80766914562084 ], [-0.8959991573255204, 50.83221779693638 ], [-0.9313798825116324, 50.840616019754854 ], [-0.9710491804475758, 50.84223106260456 ], [-0.9898116862280899, 50.83770894262538 ], [-1.0117906215709782, 50.84449212259415 ], [-1.0246563398204733, 50.8315717797965 ], [-1.0787995707870994, 50.83738593405544 ], [-1.0868406446930337, 50.83092576265662 ], [-1.1131081527857534, 50.836093899775676 ], [-1.1522413791279682, 50.84126203689474 ], [-1.1420560188471178, 50.81703639414914 ], [-1.1238295846603332, 50.806054102771135 ], [-1.1163245823481276, 50.78796562285442 ], [-1.1425920904408464, 50.77375324577701 ], [-1.1849417463454355, 50.78796562285442 ], [-1.2138896124068, 50.80928418847055 ], [-1.2969807094347905, 50.83577089120573 ], [-1.3688143029944726, 50.883576159557045 ], [-1.4395757533666966, 50.908124810872586 ], [-1.4009785986182113, 50.87194785103916 ], [-1.3709585893693887, 50.85418237969239 ], [-1.3420107233080243, 50.84449212259415 ], [-1.3355778641832767, 50.82640364267744 ], [-1.3119907140592018, 50.81219126560002 ], [-1.3420107233080243, 50.78602757143478 ], [-1.3881128803687153, 50.78602757143478 ], [-1.415452531648893, 50.76729307437818 ], [-1.4561939727722946, 50.762124937259124 ], [-1.525347208363332, 50.748881585891525 ], [-1.531243995894351, 50.7369302688037 ], [-1.5762740097675847, 50.7165807288974 ], [-1.6470354601398087, 50.73337717453435 ], [-1.6926015456067711, 50.73725327737364 ], [-1.6818801137321922, 50.751788663021 ], [-1.7279822707928831, 50.750819637311174 ], [-1.7488890629483134, 50.77956740003595 ], [-1.7821255017595092, 50.765032014388595 ], [-1.8116094394146032, 50.808638171330664 ], [-1.803568365508668, 50.82995673694679 ], [-1.7912387188529015, 50.8370629254855 ], [-1.8078569382585004, 50.86451865393051 ], [-1.8292998020076592, 50.85547441397215 ], [-1.850742665756818, 50.85870449967157 ], [-1.8485983793819019, 50.89003633095587 ], [-1.8164340837581632, 50.90392569946335 ], [-1.8148258689769765, 50.922983205089885 ], [-1.8405573054759676, 50.93202744504824 ], [-1.8737937442871635, 50.91716905083094 ], [-1.9091744694732755, 50.945270796415834 ], [-1.9209680445353126, 50.9614212249129 ], [-1.949915910596677, 50.98241678195908 ], [-1.9279369752537896, 50.99759818474632 ], [-1.8866594625366586, 50.99953623616597 ], [-1.8737937442871635, 50.98435483337873 ], [-1.8528869521317333, 51.00502738185497 ], [-1.8357326611324067, 51.00954950183415 ], [-1.8078569382585004, 50.99210703905732 ], [-1.739775845854921, 50.97660262770014 ], [-1.7194051252932194, 50.97692563627008 ], [-1.6893851160443978, 50.95463804494413 ], [-1.6615093931704905, 50.945270796415834 ], [-1.6121908065474253, 50.97111148201114 ], [-1.6288090259530232, 50.99921322759603 ], [-1.5977168735167435, 51.007934458984444 ], [-1.6341697418903136, 51.04217336739822 ], [-1.6288090259530232, 51.08125740436112 ], [-1.637386171452687, 51.092239695739124 ], [-1.6261286679843785, 51.117434364194544 ], [-1.663117607951678, 51.13003169842225 ], [-1.6540043908582858, 51.155872384017556 ], [-1.6722308250450704, 51.17848298391345 ], [-1.6690143954826961, 51.19075730957122 ], [-1.6942097603879578, 51.20400066093881 ], [-1.6899211876381264, 51.214659943746874 ], [-1.6534683192645563, 51.220474098005816 ], [-1.6336336702965841, 51.217567020876345 ], [-1.6062940190164072, 51.25180592929012 ], [-1.5778822245487714, 51.255682032129414 ], [-1.543037570956388, 51.24534575789129 ], [-1.5344604254567251, 51.28701386341372 ], [-1.525347208363332, 51.30704039475008 ], [-1.533388282269267, 51.31608463470844 ], [-1.527491494738248, 51.33837222603439 ], [-1.4974714854894255, 51.33320408891532 ], [-1.4867500536148466, 51.349354517412394 ], [-1.4953271991145103, 51.36776600589904 ], [-1.5553672176121545, 51.395544742914 ], [-1.5457179289250336, 51.42267746278906 ], [-1.5237389935821453, 51.44141195984566 ], [-1.5821707972986028, 51.49406235674609 ], [-1.5880675848296217, 51.51344287094257 ], [-1.603077589454033, 51.51828799949168 ], [-1.6137990213286129, 51.536376479408396 ], [-1.655076534045743, 51.57642954208112 ], [-1.6765193977949018, 51.56932335354241 ], [-1.690457259231855, 51.605500313375835 ], [-1.6668701091077809, 51.6161595961839 ], [-1.6599011783893038, 51.63489409324049 ], [-1.679735827357276, 51.644907358908675 ], [-1.6990344047315187, 51.66945601022421 ], [-1.6968901183566034, 51.681084318742094 ], [-1.6481076033272668, 51.68399139587157 ], [-1.6861686864820236, 51.710155090036814 ], [-1.6867047580757522, 51.72856657852347 ], [-1.7006426195127062, 51.77055769261584 ], [-1.7194051252932194, 51.783155026843545 ], [-1.6936736887942292, 51.79413731822155 ], [-1.6802718989510046, 51.8070576610192 ], [-1.6867047580757522, 51.83451338946421 ], [-1.678663684169818, 51.84937178368151 ], [-1.6834883285133788, 51.86875229787799 ], [-1.667942252295239, 51.87618149498664 ], [-1.6577568920143877, 51.89717705203282 ], [-1.6357779566715003, 51.902022180581945 ], [-1.643282958983706, 51.92366375476801 ], [-1.619695808859631, 51.937553123275485 ], [-1.6288090259530232, 51.95305753463266 ], [-1.6625815363579486, 51.96403982601067 ], [-1.6657979659203228, 51.98761945161638 ], [-1.6298811691404813, 51.96985398026961 ], [-1.6121908065474253, 51.955318594622256 ], [-1.5918200859857246, 51.9704999974095 ], [-1.5494704300811355, 51.98083627164762 ], [-1.5290997095194347, 51.9924645801655 ], [-1.5108732753326501, 52.02153535146022 ], [-1.4974714854894255, 52.060942396993056 ], [-1.5017600582392578, 52.07160167980112 ], [-1.480317194490099, 52.093566262557125 ], [-1.4470807556789023, 52.09776537396637 ], [-1.4535136148036498, 52.1129467767536 ], [-1.4245657487422854, 52.11811491387267 ], [-1.3854325224000705, 52.09421227969701 ], [-1.3575567995261641, 52.10131846823572 ], [-1.3827521644314258, 52.127482162400966 ], [-1.3409385801205662, 52.144924625177794 ], [-1.331825363027174, 52.168504250783506 ], [-1.2766099888730897, 52.117145888162845 ], [-1.2530228387490148, 52.103902536795246 ], [-1.2873314207476687, 52.092597236847304 ], [-1.321103931152594, 52.08775210829818 ], [-1.3055578549344542, 52.07192468837106 ], [-1.3130628572466598, 52.05125213989482 ], [-1.297516781028519, 52.04285391707634 ], [-1.2782182036542764, 52.01410615435157 ], [-1.2873314207476687, 51.98955750303603 ], [-1.261063912654949, 51.98083627164762 ], [-1.2417653352807063, 51.98632741733662 ], [-1.1978074645949306, 51.97728317737826 ], [-1.1640349541900052, 51.993433605875325 ], [-1.1345510165349122, 51.997309708714624 ], [-1.119541011910501, 52.01636721434116 ], [-1.1361592313160989, 52.019920308610516 ], [-1.1222213698791457, 52.04479196849599 ], [-1.0530681342881083, 52.05965036271329 ], [-1.02626455460166, 52.07547778264042 ], [-0.9678327508852025, 52.070955662661234 ], [-0.9453177439485856, 52.076769816920184 ], [-0.9303077393241743, 52.043176925646286 ], [-0.9061845176063708, 52.02121234289028 ], [-0.8708037924202587, 52.04382294278617 ], [-0.8574020025770341, 52.06417248269247 ], [-0.8386394967965201, 52.06417248269247 ], [-0.8354230672341467, 52.079676894049655 ], [-0.8466805707024543, 52.09162821113748 ], [-0.8868859402321272, 52.114238811033374 ], [-0.8691955776390712, 52.13071224810038 ], [-0.8284541365156697, 52.13265029952002 ], [-0.8075473443602394, 52.15687594226562 ], [-0.7877126953922682, 52.15429187370609 ], [-0.7346416076130993, 52.17334937933263 ], [-0.7019412403956329, 52.19337591066899 ], [-0.6681687299907075, 52.1949909535187 ] ] ] ] } }, { @@ -269,7 +272,7 @@ var targetGeojson = `{ }, "geometry": { "type": "MultiPolygon", - "coordinates": [[[[-6.2996008221135495, 49.937484058199004 ], [-6.2760136719894755, 49.922625663981705 ], [-6.2878072470515125, 49.91002832975399 ], [-6.313002611956774, 49.913258415453406 ], [-6.313538683550503, 49.92747079253082 ], [-6.2996008221135495, 49.937484058199004 ] ] ], [[[-6.348383337142886, 49.96784686377348 ], [-6.321043685862708, 49.95363448669607 ], [-6.339270120049494, 49.94717431529724 ], [-6.348383337142886, 49.96784686377348 ] ] ], [[[-1.6657979659203228, 51.98761945161638 ], [-1.6625815363579486, 51.96403982601067 ], [-1.6288090259530232, 51.95305753463266 ], [-1.619695808859631, 51.937553123275485 ], [-1.643282958983706, 51.92366375476801 ], [-1.6357779566715003, 51.902022180581945 ], [-1.6577568920143877, 51.89717705203282 ], [-1.667942252295239, 51.87618149498664 ], [-1.6834883285133788, 51.86875229787799 ], [-1.678663684169818, 51.84937178368151 ], [-1.6867047580757522, 51.83451338946421 ], [-1.6802718989510046, 51.8070576610192 ], [-1.6936736887942292, 51.79413731822155 ], [-1.7194051252932194, 51.783155026843545 ], [-1.7006426195127062, 51.77055769261584 ], [-1.6867047580757522, 51.72856657852347 ], [-1.6861686864820236, 51.710155090036814 ], [-1.6481076033272668, 51.68399139587157 ], [-1.6968901183566034, 51.681084318742094 ], [-1.6990344047315187, 51.66945601022421 ], [-1.679735827357276, 51.644907358908675 ], [-1.6599011783893038, 51.63489409324049 ], [-1.6668701091077809, 51.6161595961839 ], [-1.690457259231855, 51.605500313375835 ], [-1.6765193977949018, 51.56932335354241 ], [-1.655076534045743, 51.57642954208112 ], [-1.6137990213286129, 51.536376479408396 ], [-1.603077589454033, 51.51828799949168 ], [-1.5880675848296217, 51.51344287094257 ], [-1.5821707972986028, 51.49406235674609 ], [-1.5237389935821453, 51.44141195984566 ], [-1.5457179289250336, 51.42267746278906 ], [-1.5553672176121545, 51.395544742914 ], [-1.4953271991145103, 51.36776600589904 ], [-1.4867500536148466, 51.349354517412394 ], [-1.4974714854894255, 51.33320408891532 ], [-1.527491494738248, 51.33837222603439 ], [-1.533388282269267, 51.31608463470844 ], [-1.525347208363332, 51.30704039475008 ], [-1.5344604254567251, 51.28701386341372 ], [-1.543037570956388, 51.24534575789129 ], [-1.5778822245487714, 51.255682032129414 ], [-1.6062940190164072, 51.25180592929012 ], [-1.6336336702965841, 51.217567020876345 ], [-1.6534683192645563, 51.220474098005816 ], [-1.6899211876381264, 51.214659943746874 ], [-1.6942097603879578, 51.20400066093881 ], [-1.6690143954826961, 51.19075730957122 ], [-1.6722308250450704, 51.17848298391345 ], [-1.6540043908582858, 51.155872384017556 ], [-1.663117607951678, 51.13003169842225 ], [-1.6261286679843785, 51.117434364194544 ], [-1.637386171452687, 51.092239695739124 ], [-1.6288090259530232, 51.08125740436112 ], [-1.6341697418903136, 51.04217336739822 ], [-1.5977168735167435, 51.007934458984444 ], [-1.6288090259530232, 50.99921322759603 ], [-1.6121908065474253, 50.97111148201114 ], [-1.6615093931704905, 50.945270796415834 ], [-1.6893851160443978, 50.95463804494413 ], [-1.7194051252932194, 50.97692563627008 ], [-1.739775845854921, 50.97660262770014 ], [-1.8078569382585004, 50.99210703905732 ], [-1.8357326611324067, 51.00954950183415 ], [-1.8528869521317333, 51.00502738185497 ], [-1.8737937442871635, 50.98435483337873 ], [-1.8866594625366586, 50.99953623616597 ], [-1.9279369752537896, 50.99759818474632 ], [-1.949915910596677, 50.98241678195908 ], [-1.9209680445353126, 50.9614212249129 ], [-1.9091744694732755, 50.945270796415834 ], [-1.8737937442871635, 50.91716905083094 ], [-1.8405573054759676, 50.93202744504824 ], [-1.8148258689769765, 50.922983205089885 ], [-1.8164340837581632, 50.90392569946335 ], [-1.8485983793819019, 50.89003633095587 ], [-1.850742665756818, 50.85870449967157 ], [-1.8292998020076592, 50.85547441397215 ], [-1.8078569382585004, 50.86451865393051 ], [-1.7912387188529015, 50.8370629254855 ], [-1.803568365508668, 50.82995673694679 ], [-1.8116094394146032, 50.808638171330664 ], [-1.7821255017595092, 50.765032014388595 ], [-1.7488890629483134, 50.77956740003595 ], [-1.7279822707928831, 50.750819637311174 ], [-1.6818801137321922, 50.751788663021 ], [-1.6926015456067711, 50.73725327737364 ], [-1.7247658412305098, 50.734023191674225 ], [-1.7692597835100141, 50.7165807288974 ], [-1.803568365508668, 50.7204568317367 ], [-1.8577115964752942, 50.71851878031705 ], [-1.8882676773178462, 50.713350643197984 ], [-1.932225548003621, 50.6962311889911 ], [-1.9584930560963407, 50.71561170318758 ], [-1.972430917533294, 50.71044356606851 ], [-2.016924859812799, 50.7110895832084 ], [-2.0399759383431446, 50.719164797456926 ], [-2.06302701687349, 50.7165807288974 ], [-2.078573093091631, 50.69332411186163 ], [-2.065707374842135, 50.6868639404628 ], [-2.0415841531243313, 50.70624445465928 ], [-2.018533074593986, 50.6813727947738 ], [-1.98529663578279, 50.67006749482585 ], [-1.9424109082844723, 50.670390503395794 ], [-1.9525962685653226, 50.65617812631838 ], [-1.933297691191079, 50.63098345786295 ], [-1.9531323401590512, 50.62258523504448 ], [-1.949915910596677, 50.60481976369771 ], [-1.9595651992837988, 50.590930395190234 ], [-2.02657414849992, 50.58899234377059 ], [-2.0576663009362006, 50.577041026682764 ], [-2.0635630884672196, 50.59319145517983 ], [-2.1048406011843497, 50.59674454944918 ], [-2.1343245388394436, 50.612571969376305 ], [-2.1825709822750508, 50.615479046505776 ], [-2.19865313008692, 50.622908243614425 ], [-2.2393945712103216, 50.616125063645654 ], [-2.273167081615247, 50.62226222647454 ], [-2.4195146267032563, 50.63647460355196 ], [-2.4522149939207236, 50.61418701222601 ], [-2.4500707075458075, 50.601266669428355 ], [-2.4725857144824244, 50.58447022379141 ], [-2.498317150981415, 50.59642154087924 ], [-2.5176157283556577, 50.61774010649536 ], [-2.5315535897926114, 50.61741709792542 ], [-2.460256067826658, 50.57090386385388 ], [-2.4334524881402095, 50.567673778154465 ], [-2.4157621255471535, 50.54926228966781 ], [-2.442565705233602, 50.52051452694303 ], [-2.4591839246392, 50.51437736411415 ], [-2.4479264211708918, 50.5570144953464 ], [-2.497781079387686, 50.59319145517983 ], [-2.5449553796358355, 50.61935514934507 ], [-2.626974333476368, 50.65973122058773 ], [-2.740085439753181, 50.70269136038992 ], [-2.793692599126078, 50.718195771747105 ], [-2.810310818531676, 50.71787276317716 ], [-2.8944740587471247, 50.73273115739446 ], [-2.927710497558321, 50.72917806312511 ], [-2.9534419340573117, 50.71431966890781 ], [-2.983998014899863, 50.70462941180957 ], [-3.0284919571793676, 50.69881525755063 ], [-3.079954830177349, 50.702368351819985 ], [-3.096036977989218, 50.68524889761309 ], [-3.1265930588317694, 50.6868639404628 ], [-3.1930659364541616, 50.68427987190327 ], [-3.231127019608919, 50.67943474335415 ], [-3.26704381638876, 50.66974448625591 ], [-3.30349668476233, 50.62969142358319 ], [-3.3490627702292923, 50.620001166484954 ], [-3.3855156386028624, 50.60675781511736 ], [-3.4160717194454135, 50.61580205507572 ], [-3.4160717194454135, 50.62969142358319 ], [-3.432689938851012, 50.646164860650195 ], [-3.445555657100507, 50.67006749482585 ], [-3.468606735630853, 50.68104978620386 ], [-3.446091728694236, 50.624846295034075 ], [-3.4428752991318623, 50.595775523739356 ], [-3.469142807224582, 50.574133949553286 ], [-3.4964824585047594, 50.54183309255916 ], [-3.5131006779103573, 50.50662515843556 ], [-3.5147088926915444, 50.48175349855008 ], [-3.4879053130050957, 50.46075794150389 ], [-3.5157810358790025, 50.45397476153513 ], [-3.5334713984720585, 50.463019001493485 ], [-3.557058548596133, 50.44266946158718 ], [-3.555986405408675, 50.408753561743346 ], [-3.4879053130050957, 50.39809427893528 ], [-3.516317107472731, 50.37096155906021 ], [-3.5152449642852734, 50.350612019153914 ], [-3.5361517564407032, 50.336722650646436 ], [-3.5650996225020677, 50.33607663350656 ], [-3.5715324816268152, 50.32670938497826 ], [-3.612273922750217, 50.31863417072972 ], [-3.6406857172178526, 50.29214746799454 ], [-3.6589121514046377, 50.242404148223585 ], [-3.649798934311245, 50.221731599747336 ], [-3.6814271583412546, 50.22237761688722 ], [-3.7168078835273666, 50.20558117125027 ], [-3.750044322338563, 50.21914753118781 ], [-3.7704150429002636, 50.22205460831728 ], [-3.7881054054933196, 50.20978028265951 ], [-3.8229500590857026, 50.21720947976816 ], [-3.8599389990530018, 50.23432893397505 ], [-3.860475070646731, 50.25435546531141 ], [-3.909793657269796, 50.29440852798413 ], [-3.9451743824559085, 50.297638613683546 ], [-3.9939568974852446, 50.30700586221184 ], [-4.020224405577965, 50.29473153655407 ], [-4.0443476272957675, 50.2934395022743 ], [-4.08508906841917, 50.317988153589845 ], [-4.111892648105618, 50.316050102170195 ], [-4.128510867511217, 50.34285981347532 ], [-4.120469793605282, 50.36127130196198 ], [-4.157458733572581, 50.360948293392035 ], [-4.185334456446487, 50.36708545622092 ], [-4.191767315571235, 50.390988090396576 ], [-4.205169105414459, 50.39938631321505 ], [-4.185334456446487, 50.43427123876871 ], [-4.211065892945478, 50.42393496453059 ], [-4.205705177008188, 50.407784536033525 ], [-4.2116019645392075, 50.39260313324628 ], [-4.201952675852086, 50.38711198755728 ], [-4.193375530352422, 50.353519096283385 ], [-4.170860523415805, 50.34382883918515 ], [-4.22017911003887, 50.32606336783838 ], [-4.244838403350403, 50.34221379633544 ], [-4.28289948650516, 50.3567491819828 ], [-4.308094851410422, 50.36127130196198 ], [-4.367598798314337, 50.360302276252156 ], [-4.3874334472823096, 50.36450138766139 ], [-4.436215962311646, 50.360948293392035 ], [-4.452298110123515, 50.34479786489497 ], [-4.497328123996748, 50.33736866778632 ], [-4.535389207151505, 50.32477133355861 ], [-4.577202791462366, 50.33155451352738 ], [-4.618480304179496, 50.32380230784879 ], [-4.6399231679286554, 50.328324427827965 ], [-4.682272823833244, 50.32218726499908 ], [-4.681736752239515, 50.33833769349614 ], [-4.705859973957319, 50.340598753485736 ], [-4.752498202611739, 50.33220053066726 ], [-4.766972135642421, 50.320895230719316 ], [-4.754106417392926, 50.30603683650202 ], [-4.780909997079374, 50.28988640800495 ], [-4.787878927797851, 50.24208113965364 ], [-4.802352860828533, 50.218824522617865 ], [-4.81950715182786, 50.23174486541552 ], [-4.86132073613872, 50.23497495111493 ], [-4.910639322761785, 50.20525816268033 ], [-4.957813623009935, 50.20235108555086 ], [-4.974431842415533, 50.18006349422491 ], [-4.972287556040617, 50.16455908286773 ], [-5.008740424414187, 50.139364414412306 ], [-5.028575073382159, 50.159067937178726 ], [-5.019997927882495, 50.17651039995556 ], [-5.031255431350804, 50.200413034131216 ], [-5.054842581474879, 50.19782896557168 ], [-5.056986867849794, 50.147762637230784 ], [-5.093439736223365, 50.126121063044714 ], [-5.08539866231743, 50.10932461740777 ], [-5.1046972396916726, 50.09446622319047 ], [-5.074677230442851, 50.08154588039282 ], [-5.05966722581844, 50.05473616908769 ], [-5.06985258609929, 50.034709637751334 ], [-5.096656165785738, 50.0266344235028 ], [-5.101480810129299, 50.00434683217685 ], [-5.156696184283383, 50.007576917876264 ], [-5.186180121938476, 49.97947517229137 ], [-5.185644050344748, 49.96300173522437 ], [-5.2156640595935695, 49.96041766666483 ], [-5.218880489155944, 49.971076949472895 ], [-5.245684068842392, 49.97559906945207 ], [-5.245147997248663, 49.98561233512025 ], [-5.268199075779009, 50.00596187502656 ], [-5.256405500716972, 50.02372734637333 ], [-5.290178011121897, 50.06604146903564 ], [-5.328239094276654, 50.088975077501466 ], [-5.357723031931747, 50.08929808607141 ], [-5.391495542336672, 50.10351046314882 ], [-5.419907336804308, 50.09898834316965 ], [-5.462793064302626, 50.12321398591524 ], [-5.496029503113822, 50.12870513160425 ], [-5.523905225987728, 50.126121063044714 ], [-5.547492376111803, 50.108032583128 ], [-5.533018443081121, 50.08865206893152 ], [-5.55446130683028, 50.059904306206754 ], [-5.575904170579439, 50.05215210052816 ], [-5.619325969671485, 50.05118307481834 ], [-5.654170623263869, 50.03793972345074 ], [-5.68472670410642, 50.03793972345074 ], [-5.695448135981, 50.05505917765763 ], [-5.714746713355242, 50.06313439190617 ], [-5.708849925824223, 50.077669777553524 ], [-5.692767778012354, 50.08283791467258 ], [-5.7050974246681205, 50.13419627729325 ], [-5.671860985856925, 50.16391306572785 ], [-5.628975258358607, 50.16778916856714 ], [-5.615037396921654, 50.18167853707462 ], [-5.591450246797579, 50.18910773418327 ], [-5.556069521611467, 50.208488248379744 ], [-5.498173789488738, 50.219793548327694 ], [-5.436525556209906, 50.1933068455925 ], [-5.401144831023794, 50.21688647119822 ], [-5.391495542336672, 50.22883778828605 ], [-5.33574409658886, 50.23982007966405 ], [-5.277848364466131, 50.274058988077826 ], [-5.250508713185953, 50.28181119375642 ], [-5.233890493780355, 50.30474480222225 ], [-5.235498708561542, 50.31831116215979 ], [-5.200654054969159, 50.32057222214937 ], [-5.1813554775949155, 50.340598753485736 ], [-5.155624041095925, 50.34770494202444 ], [-5.146510824002533, 50.375160670469455 ], [-5.148655110377448, 50.40067834749482 ], [-5.113810456785066, 50.408753561743346 ], [-5.088079020286075, 50.42102788740112 ], [-5.060203297412168, 50.42425797310053 ], [-5.042512934819112, 50.44428450443689 ], [-5.0398325768504675, 50.474001292871485 ], [-5.028575073382159, 50.50953223556503 ], [-5.030183288163346, 50.520191518373096 ], [-5.015173283538935, 50.54409415254875 ], [-4.9808647015402805, 50.54377114397881 ], [-4.972287556040617, 50.55766051248628 ], [-4.948164334322813, 50.555399452496694 ], [-4.90849503638687, 50.58447022379141 ], [-4.881155385106692, 50.58317818951164 ], [-4.8698978816383836, 50.59545251516941 ], [-4.82486786776515, 50.594806498029534 ], [-4.795920001703785, 50.598359592298884 ], [-4.770188565204795, 50.62226222647454 ], [-4.766972135642421, 50.656501134888316 ], [-4.7578589185490285, 50.67168253767556 ], [-4.732127482050038, 50.67297457195532 ], [-4.679592465864599, 50.70559843751939 ], [-4.654933172553066, 50.715288694617634 ], [-4.653861029365608, 50.739837345933175 ], [-4.617944232585767, 50.75308069730077 ], [-4.562192786837954, 50.7815054514556 ], [-4.553615641338291, 50.83221779693638 ], [-4.55897635727558, 50.87582395387846 ], [-4.566481359587786, 50.886483236686516 ], [-4.565409216400328, 50.910708879432114 ], [-4.546110639026085, 50.928474350778885 ], [-4.549327068588459, 50.93913363358695 ], [-4.53324492077659, 50.9652973277522 ], [-4.526812061651842, 51.01891675036245 ], [-4.4640916851855525, 51.02053179321216 ], [-4.425494530437066, 51.013748613243386 ], [-4.375103800626543, 50.990168987637674 ], [-4.345083791377721, 50.98887695335791 ], [-4.3038062786605895, 50.99727517617638 ], [-4.263064837537188, 51.03377514457975 ], [-4.238405544225655, 51.04152735025834 ], [-4.221787324820058, 51.06478396729411 ], [-4.179437668915469, 51.050248581646755 ], [-4.1810458836966555, 51.06639901014382 ], [-4.214818394101581, 51.07512024153223 ], [-4.221787324820058, 51.08448749006053 ], [-4.2223233964137865, 51.11775737276449 ], [-4.2389416158193844, 51.133261784121665 ], [-4.212138036132936, 51.16007149542679 ], [-4.214818394101581, 51.18978828386139 ], [-4.201416604258356, 51.200770575239396 ], [-4.177829454134281, 51.19754048953998 ], [-4.135479798229693, 51.20916879805787 ], [-4.097954786668665, 51.2117528666174 ], [-4.080264424075609, 51.21821303801622 ], [-4.050780486420516, 51.20755375520816 ], [-4.028265479483899, 51.21627498659658 ], [-3.947318668830824, 51.22176613228558 ], [-3.9387415233311605, 51.22887232082429 ], [-3.9038968697387775, 51.229841346534116 ], [-3.89210329467674, 51.22370418370523 ], [-3.8545782831157123, 51.23436346651329 ], [-3.8063318396801047, 51.23274842366359 ], [-3.785425047524675, 51.24631478360112 ], [-3.7698789713065346, 51.2375935522127 ], [-3.6406857172178526, 51.223058166565345 ], [-3.601552490875638, 51.220474098005816 ], [-3.578501412345292, 51.23113338081388 ], [-3.5334713984720585, 51.230487363673994 ], [-3.484152811848993, 51.21918206372605 ], [-3.472895308380685, 51.20949180662781 ], [-3.4418031559444042, 51.20658472949834 ], [-3.4117831466955817, 51.18397412960245 ], [-3.3361970519797968, 51.18332811246257 ], [-3.275620961888423, 51.17977501819321 ], [-3.256858456107909, 51.18785023244175 ], [-3.1802002182046665, 51.199801549529575 ], [-3.1560769964868625, 51.208199772348046 ], [-3.1255209156443113, 51.210783840907574 ], [-3.076202329021246, 51.20141659237928 ], [-3.0242033844295357, 51.21304490089717 ], [-2.999544091118003, 51.23694753507282 ], [-3.021523026460891, 51.26504928065771 ], [-3.011873737773769, 51.30704039475008 ], [-2.9925751603995265, 51.32060675468762 ], [-2.9829258717124048, 51.346447440282915 ], [-2.962555151150704, 51.3823013915464 ], [-2.940040144214087, 51.398128811473526 ], [-2.913236564527639, 51.395867751483934 ], [-2.895546201934583, 51.40685004286194 ], [-2.8794640541227134, 51.43139869417748 ], [-2.8489079732801623, 51.45562433692307 ], [-2.7995893866570967, 51.48534112535768 ], [-2.7733218785643774, 51.49470837388597 ], [-2.7336525806284335, 51.49438536531603 ], [-2.700416141817237, 51.51731897378186 ], [-2.672540418943331, 51.545743727936696 ], [-2.663963273443667, 51.57319945638171 ], [-2.6425204096945083, 51.58708882488918 ], [-2.628046476663826, 51.605500313375835 ], [-2.5990986106024616, 51.617774639033605 ], [-2.5792639616344895, 51.63489409324049 ], [-2.5583571694790597, 51.66654893309474 ], [-2.497245007793957, 51.693358644399865 ], [-2.4816989315758167, 51.725659501394 ], [-2.4516789223269946, 51.73922586133153 ], [-2.4323803449527515, 51.736641792772 ], [-2.382525686735957, 51.75828336695807 ], [-2.3841339015171443, 51.77507981259502 ], [-2.425947485828004, 51.76409752121701 ], [-2.4709774997012373, 51.74439399845059 ], [-2.498317150981415, 51.72404445854429 ], [-2.5052860816998916, 51.71047809860676 ], [-2.5969543242275455, 51.678500250182566 ], [-2.6253661186951813, 51.66041177026585 ], [-2.623757903913994, 51.65395159886703 ], [-2.6548500563502744, 51.6216507418729 ], [-2.6698600609746856, 51.64684541032832 ], [-2.6580664859126486, 51.67656219876292 ], [-2.672004347349602, 51.68173033588198 ], [-2.668787917787228, 51.70724801290734 ], [-2.6789732780680784, 51.71403119287611 ], [-2.680045421255536, 51.72469047568417 ], [-2.685942208786555, 51.72856657852347 ], [-2.685406137192826, 51.731796664222884 ], [-2.6752207769119756, 51.73438073278241 ], [-2.6709322041621437, 51.73696480134194 ], [-2.6693239893809566, 51.74277895560088 ], [-2.662891130256209, 51.75408425554883 ], [-2.680581492849265, 51.76894264976613 ], [-2.6714682757558728, 51.79510634393137 ], [-2.650561483600443, 51.826115166645735 ], [-2.6355514789760317, 51.840973560863034 ], [-2.604459326539751, 51.85453992080057 ], [-2.5615735990414334, 51.86423017789881 ], [-2.5224403726992186, 51.86487619503869 ], [-2.5085025112622654, 51.885225734944996 ], [-2.494028578231583, 51.88005759782593 ], [-2.440421418858686, 51.90234518915188 ], [-2.448462492764621, 51.918818626218886 ], [-2.466152855357677, 51.92786286617724 ], [-2.4645446405764897, 51.948535414653485 ], [-2.4902760770754804, 51.95499558605231 ], [-2.496708936200228, 51.9759911430985 ], [-2.4709774997012373, 51.994725640155096 ], [-2.4913482202629385, 52.00635394867298 ], [-2.4736578576698824, 52.02379641144981 ], [-2.4339885597339386, 52.01216810293192 ], [-2.4355967745151252, 51.9979557258545 ], [-2.402896407297658, 51.99601767443486 ], [-2.3927110470168076, 52.0128141200718 ], [-2.3525056774871347, 52.01346013721169 ], [-2.329454598956789, 52.006676957242924 ], [-2.3128363795511913, 51.97663716023838 ], [-2.2511881462723595, 51.9666238945702 ], [-2.2206320654298075, 51.995371657294974 ], [-2.1852513402436955, 51.99052652874585 ], [-2.1638084764945367, 51.997309708714624 ], [-2.1841791970562374, 52.01378314578163 ], [-2.1804266959001346, 52.04156188279658 ], [-2.16220026171335, 52.050606122754935 ], [-2.1182423910275743, 52.042207899936464 ], [-2.139685254776733, 52.02767251428911 ], [-2.1509427582450416, 52.006676957242924 ], [-2.1118095319028267, 52.01475217149145 ], [-2.0517695134051817, 52.00861500866257 ], [-1.9842244925953318, 52.035747728537636 ], [-1.9515241253778646, 52.037685779957286 ], [-1.9311534048161638, 52.03025658284864 ], [-1.9134630422231078, 52.04446895992605 ], [-1.8737937442871635, 52.024442428589694 ], [-1.8512787373505466, 52.008292000092624 ], [-1.8351965895386773, 52.00926102580245 ], [-1.826083372445285, 52.02928755713881 ], [-1.8346605179449487, 52.043176925646286 ], [-1.8571755248815656, 52.05222116560464 ], [-1.8689690999436026, 52.07386273979071 ], [-1.8464540930069857, 52.07935388547971 ], [-1.831980159976304, 52.07321672265083 ], [-1.80249622232121, 52.09679634825654 ], [-1.7676515687288274, 52.11262376818367 ], [-1.7547858504793323, 52.099380416816075 ], [-1.7279822707928831, 52.08839812543807 ], [-1.7306626287615279, 52.07353973122077 ], [-1.6899211876381264, 52.053190191314464 ], [-1.6947458319816873, 52.04059285708676 ], [-1.6566847488269305, 52.03219463426828 ], [-1.626664739578108, 52.03800878852723 ], [-1.6422108157962478, 52.01023005151227 ], [-1.6657979659203228, 51.997309708714624 ], [-1.6657979659203228, 51.98761945161638 ] ] ] ] + "coordinates": [[[[-6.2996008221135495, 49.937484058199004 ], [-6.2760136719894755, 49.922625663981705 ], [-6.2878072470515125, 49.91002832975399 ], [-6.313002611956774, 49.913258415453406 ], [-6.313538683550503, 49.92747079253082 ], [-6.2996008221135495, 49.937484058199004 ] ] ], [[[-6.348383337142886, 49.96784686377348 ], [-6.321043685862708, 49.95363448669607 ], [-6.339270120049494, 49.94717431529724 ], [-6.348383337142886, 49.96784686377348 ] ] ], [[[-1.6657979659203228, 51.98761945161638 ], [-1.6625815363579486, 51.96403982601067 ], [-1.6288090259530232, 51.95305753463266 ], [-1.619695808859631, 51.937553123275485 ], [-1.643282958983706, 51.92366375476801 ], [-1.6357779566715003, 51.902022180581945 ], [-1.6577568920143877, 51.89717705203282 ], [-1.667942252295239, 51.87618149498664 ], [-1.6834883285133788, 51.86875229787799 ], [-1.678663684169818, 51.84937178368151 ], [-1.6867047580757522, 51.83451338946421 ], [-1.6802718989510046, 51.8070576610192 ], [-1.6936736887942292, 51.79413731822155 ], [-1.7194051252932194, 51.783155026843545 ], [-1.7006426195127062, 51.77055769261584 ], [-1.6867047580757522, 51.72856657852347 ], [-1.6861686864820236, 51.710155090036814 ], [-1.6481076033272668, 51.68399139587157 ], [-1.6968901183566034, 51.681084318742094 ], [-1.6990344047315187, 51.66945601022421 ], [-1.679735827357276, 51.644907358908675 ], [-1.6599011783893038, 51.63489409324049 ], [-1.6668701091077809, 51.6161595961839 ], [-1.690457259231855, 51.605500313375835 ], [-1.6765193977949018, 51.56932335354241 ], [-1.655076534045743, 51.57642954208112 ], [-1.6137990213286129, 51.536376479408396 ], [-1.603077589454033, 51.51828799949168 ], [-1.5880675848296217, 51.51344287094257 ], [-1.5821707972986028, 51.49406235674609 ], [-1.5237389935821453, 51.44141195984566 ], [-1.5457179289250336, 51.42267746278906 ], [-1.5553672176121545, 51.395544742914 ], [-1.4953271991145103, 51.36776600589904 ], [-1.4867500536148466, 51.349354517412394 ], [-1.4974714854894255, 51.33320408891532 ], [-1.527491494738248, 51.33837222603439 ], [-1.533388282269267, 51.31608463470844 ], [-1.525347208363332, 51.30704039475008 ], [-1.5344604254567251, 51.28701386341372 ], [-1.543037570956388, 51.24534575789129 ], [-1.5778822245487714, 51.255682032129414 ], [-1.6062940190164072, 51.25180592929012 ], [-1.6336336702965841, 51.217567020876345 ], [-1.6534683192645563, 51.220474098005816 ], [-1.6899211876381264, 51.214659943746874 ], [-1.6942097603879578, 51.20400066093881 ], [-1.6690143954826961, 51.19075730957122 ], [-1.6722308250450704, 51.17848298391345 ], [-1.6540043908582858, 51.155872384017556 ], [-1.663117607951678, 51.13003169842225 ], [-1.6261286679843785, 51.117434364194544 ], [-1.637386171452687, 51.092239695739124 ], [-1.6288090259530232, 51.08125740436112 ], [-1.6341697418903136, 51.04217336739822 ], [-1.5977168735167435, 51.007934458984444 ], [-1.6288090259530232, 50.99921322759603 ], [-1.6121908065474253, 50.97111148201114 ], [-1.6615093931704905, 50.945270796415834 ], [-1.6893851160443978, 50.95463804494413 ], [-1.7194051252932194, 50.97692563627008 ], [-1.739775845854921, 50.97660262770014 ], [-1.8078569382585004, 50.99210703905732 ], [-1.8357326611324067, 51.00954950183415 ], [-1.8528869521317333, 51.00502738185497 ], [-1.8737937442871635, 50.98435483337873 ], [-1.8866594625366586, 50.99953623616597 ], [-1.9279369752537896, 50.99759818474632 ], [-1.949915910596677, 50.98241678195908 ], [-1.9209680445353126, 50.9614212249129 ], [-1.9091744694732755, 50.945270796415834 ], [-1.8737937442871635, 50.91716905083094 ], [-1.8405573054759676, 50.93202744504824 ], [-1.8148258689769765, 50.922983205089885 ], [-1.8164340837581632, 50.90392569946335 ], [-1.8485983793819019, 50.89003633095587 ], [-1.850742665756818, 50.85870449967157 ], [-1.8292998020076592, 50.85547441397215 ], [-1.8078569382585004, 50.86451865393051 ], [-1.7912387188529015, 50.8370629254855 ], [-1.803568365508668, 50.82995673694679 ], [-1.8116094394146032, 50.808638171330664 ], [-1.7821255017595092, 50.765032014388595 ], [-1.7488890629483134, 50.77956740003595 ], [-1.7279822707928831, 50.750819637311174 ], [-1.6818801137321922, 50.751788663021 ], [-1.6926015456067711, 50.73725327737364 ], [-1.7247658412305098, 50.734023191674225 ], [-1.7692597835100141, 50.7165807288974 ], [-1.803568365508668, 50.7204568317367 ], [-1.8577115964752942, 50.71851878031705 ], [-1.8882676773178462, 50.713350643197984 ], [-1.932225548003621, 50.6962311889911 ], [-1.9584930560963407, 50.71561170318758 ], [-1.972430917533294, 50.71044356606851 ], [-2.016924859812799, 50.7110895832084 ], [-2.0399759383431446, 50.719164797456926 ], [-2.06302701687349, 50.7165807288974 ], [-2.078573093091631, 50.69332411186163 ], [-2.065707374842135, 50.6868639404628 ], [-2.0415841531243313, 50.70624445465928 ], [-2.018533074593986, 50.6813727947738 ], [-1.98529663578279, 50.67006749482585 ], [-1.9424109082844723, 50.670390503395794 ], [-1.9525962685653226, 50.65617812631838 ], [-1.933297691191079, 50.63098345786295 ], [-1.9531323401590512, 50.62258523504448 ], [-1.949915910596677, 50.60481976369771 ], [-1.9595651992837988, 50.590930395190234 ], [-2.02657414849992, 50.58899234377059 ], [-2.0576663009362006, 50.577041026682764 ], [-2.0635630884672196, 50.59319145517983 ], [-2.1048406011843497, 50.59674454944918 ], [-2.1343245388394436, 50.612571969376305 ], [-2.1825709822750508, 50.615479046505776 ], [-2.19865313008692, 50.622908243614425 ], [-2.2393945712103216, 50.616125063645654 ], [-2.273167081615247, 50.62226222647454 ], [-2.4195146267032563, 50.63647460355196 ], [-2.4522149939207236, 50.61418701222601 ], [-2.4500707075458075, 50.601266669428355 ], [-2.4725857144824244, 50.58447022379141 ], [-2.498317150981415, 50.59642154087924 ], [-2.5176157283556577, 50.61774010649536 ], [-2.5315535897926114, 50.61741709792542 ], [-2.460256067826658, 50.57090386385388 ], [-2.4334524881402095, 50.567673778154465 ], [-2.4157621255471535, 50.54926228966781 ], [-2.442565705233602, 50.52051452694303 ], [-2.4591839246392, 50.51437736411415 ], [-2.4479264211708918, 50.5570144953464 ], [-2.497781079387686, 50.59319145517983 ], [-2.5449553796358355, 50.61935514934507 ], [-2.626974333476368, 50.65973122058773 ], [-2.740085439753181, 50.70269136038992 ], [-2.793692599126078, 50.718195771747105 ], [-2.810310818531676, 50.71787276317716 ], [-2.8944740587471247, 50.73273115739446 ], [-2.927710497558321, 50.72917806312511 ], [-2.9534419340573117, 50.71431966890781 ], [-2.983998014899863, 50.70462941180957 ], [-3.0284919571793676, 50.69881525755063 ], [-3.079954830177349, 50.702368351819985 ], [-3.096036977989218, 50.68524889761309 ], [-3.1265930588317694, 50.6868639404628 ], [-3.1930659364541616, 50.68427987190327 ], [-3.231127019608919, 50.67943474335415 ], [-3.26704381638876, 50.66974448625591 ], [-3.30349668476233, 50.62969142358319 ], [-3.3490627702292923, 50.620001166484954 ], [-3.3855156386028624, 50.60675781511736 ], [-3.4160717194454135, 50.61580205507572 ], [-3.4160717194454135, 50.62969142358319 ], [-3.432689938851012, 50.646164860650195 ], [-3.445555657100507, 50.67006749482585 ], [-3.468606735630853, 50.68104978620386 ], [-3.446091728694236, 50.624846295034075 ], [-3.4428752991318623, 50.595775523739356 ], [-3.469142807224582, 50.574133949553286 ], [-3.4964824585047594, 50.54183309255916 ], [-3.5131006779103573, 50.50662515843556 ], [-3.5147088926915444, 50.48175349855008 ], [-3.4879053130050957, 50.46075794150389 ], [-3.5157810358790025, 50.45397476153513 ], [-3.5334713984720585, 50.463019001493485 ], [-3.557058548596133, 50.44266946158718 ], [-3.555986405408675, 50.408753561743346 ], [-3.4879053130050957, 50.39809427893528 ], [-3.516317107472731, 50.37096155906021 ], [-3.5152449642852734, 50.350612019153914 ], [-3.5361517564407032, 50.336722650646436 ], [-3.5650996225020677, 50.33607663350656 ], [-3.5715324816268152, 50.32670938497826 ], [-3.612273922750217, 50.31863417072972 ], [-3.6406857172178526, 50.29214746799454 ], [-3.6589121514046377, 50.242404148223585 ], [-3.649798934311245, 50.221731599747336 ], [-3.6814271583412546, 50.22237761688722 ], [-3.7168078835273666, 50.20558117125027 ], [-3.750044322338563, 50.21914753118781 ], [-3.7704150429002636, 50.22205460831728 ], [-3.7881054054933196, 50.20978028265951 ], [-3.8229500590857026, 50.21720947976816 ], [-3.8599389990530018, 50.23432893397505 ], [-3.860475070646731, 50.25435546531141 ], [-3.909793657269796, 50.29440852798413 ], [-3.9451743824559085, 50.297638613683546 ], [-3.9939568974852446, 50.30700586221184 ], [-4.020224405577965, 50.29473153655407 ], [-4.0443476272957675, 50.2934395022743 ], [-4.08508906841917, 50.317988153589845 ], [-4.111892648105618, 50.316050102170195 ], [-4.128510867511217, 50.34285981347532 ], [-4.120469793605282, 50.36127130196198 ], [-4.157458733572581, 50.360948293392035 ], [-4.185334456446487, 50.36708545622092 ], [-4.191767315571235, 50.390988090396576 ], [-4.205169105414459, 50.39938631321505 ], [-4.185334456446487, 50.43427123876871 ], [-4.211065892945478, 50.42393496453059 ], [-4.205705177008188, 50.407784536033525 ], [-4.2116019645392075, 50.39260313324628 ], [-4.201952675852086, 50.38711198755728 ], [-4.193375530352422, 50.353519096283385 ], [-4.170860523415805, 50.34382883918515 ], [-4.22017911003887, 50.32606336783838 ], [-4.244838403350403, 50.34221379633544 ], [-4.28289948650516, 50.3567491819828 ], [-4.308094851410422, 50.36127130196198 ], [-4.367598798314337, 50.360302276252156 ], [-4.3874334472823096, 50.36450138766139 ], [-4.436215962311646, 50.360948293392035 ], [-4.452298110123515, 50.34479786489497 ], [-4.497328123996748, 50.33736866778632 ], [-4.535389207151505, 50.32477133355861 ], [-4.577202791462366, 50.33155451352738 ], [-4.618480304179496, 50.32380230784879 ], [-4.6399231679286554, 50.328324427827965 ], [-4.682272823833244, 50.32218726499908 ], [-4.681736752239515, 50.33833769349614 ], [-4.705859973957319, 50.340598753485736 ], [-4.752498202611739, 50.33220053066726 ], [-4.766972135642421, 50.320895230719316 ], [-4.754106417392926, 50.30603683650202 ], [-4.780909997079374, 50.28988640800495 ], [-4.787878927797851, 50.24208113965364 ], [-4.802352860828533, 50.218824522617865 ], [-4.81950715182786, 50.23174486541552 ], [-4.86132073613872, 50.23497495111493 ], [-4.910639322761785, 50.20525816268033 ], [-4.957813623009935, 50.20235108555086 ], [-4.974431842415533, 50.18006349422491 ], [-4.972287556040617, 50.16455908286773 ], [-5.008740424414187, 50.139364414412306 ], [-5.028575073382159, 50.159067937178726 ], [-5.019997927882495, 50.17651039995556 ], [-5.031255431350804, 50.200413034131216 ], [-5.054842581474879, 50.19782896557168 ], [-5.056986867849794, 50.147762637230784 ], [-5.093439736223365, 50.126121063044714 ], [-5.08539866231743, 50.10932461740777 ], [-5.1046972396916726, 50.09446622319047 ], [-5.074677230442851, 50.08154588039282 ], [-5.05966722581844, 50.05473616908769 ], [-5.06985258609929, 50.034709637751334 ], [-5.096656165785738, 50.0266344235028 ], [-5.101480810129299, 50.00434683217685 ], [-5.156696184283383, 50.007576917876264 ], [-5.186180121938476, 49.97947517229137 ], [-5.185644050344748, 49.96300173522437 ], [-5.2156640595935695, 49.96041766666483 ], [-5.218880489155944, 49.971076949472895 ], [-5.245684068842392, 49.97559906945207 ], [-5.245147997248663, 49.98561233512025 ], [-5.268199075779009, 50.00596187502656 ], [-5.256405500716972, 50.02372734637333 ], [-5.290178011121897, 50.06604146903564 ], [-5.328239094276654, 50.088975077501466 ], [-5.357723031931747, 50.08929808607141 ], [-5.391495542336672, 50.10351046314882 ], [-5.419907336804308, 50.09898834316965 ], [-5.462793064302626, 50.12321398591524 ], [-5.496029503113822, 50.12870513160425 ], [-5.523905225987728, 50.126121063044714 ], [-5.547492376111803, 50.108032583128 ], [-5.533018443081121, 50.08865206893152 ], [-5.55446130683028, 50.059904306206754 ], [-5.575904170579439, 50.05215210052816 ], [-5.619325969671485, 50.05118307481834 ], [-5.654170623263869, 50.03793972345074 ], [-5.68472670410642, 50.03793972345074 ], [-5.695448135981, 50.05505917765763 ], [-5.714746713355242, 50.06313439190617 ], [-5.708849925824223, 50.077669777553524 ], [-5.692767778012354, 50.08283791467258 ], [-5.7050974246681205, 50.13419627729325 ], [-5.671860985856925, 50.16391306572785 ], [-5.628975258358607, 50.16778916856714 ], [-5.615037396921654, 50.18167853707462 ], [-5.591450246797579, 50.18910773418327 ], [-5.556069521611467, 50.208488248379744 ], [-5.498173789488738, 50.219793548327694 ], [-5.436525556209906, 50.1933068455925 ], [-5.401144831023794, 50.21688647119822 ], [-5.391495542336672, 50.22883778828605 ], [-5.33574409658886, 50.23982007966405 ], [-5.277848364466131, 50.274058988077826 ], [-5.250508713185953, 50.28181119375642 ], [-5.233890493780355, 50.30474480222225 ], [-5.235498708561542, 50.31831116215979 ], [-5.200654054969159, 50.32057222214937 ], [-5.1813554775949155, 50.340598753485736 ], [-5.155624041095925, 50.34770494202444 ], [-5.146510824002533, 50.375160670469455 ], [-5.148655110377448, 50.40067834749482 ], [-5.113810456785066, 50.408753561743346 ], [-5.088079020286075, 50.42102788740112 ], [-5.060203297412168, 50.42425797310053 ], [-5.042512934819112, 50.44428450443689 ], [-5.0398325768504675, 50.474001292871485 ], [-5.028575073382159, 50.50953223556503 ], [-5.030183288163346, 50.520191518373096 ], [-5.015173283538935, 50.54409415254875 ], [-4.9808647015402805, 50.54377114397881 ], [-4.972287556040617, 50.55766051248628 ], [-4.948164334322813, 50.555399452496694 ], [-4.90849503638687, 50.58447022379141 ], [-4.881155385106692, 50.58317818951164 ], [-4.8698978816383836, 50.59545251516941 ], [-4.82486786776515, 50.594806498029534 ], [-4.795920001703785, 50.598359592298884 ], [-4.770188565204795, 50.62226222647454 ], [-4.766972135642421, 50.656501134888316 ], [-4.7578589185490285, 50.67168253767556 ], [-4.732127482050038, 50.67297457195532 ], [-4.679592465864599, 50.70559843751939 ], [-4.654933172553066, 50.715288694617634 ], [-4.653861029365608, 50.739837345933175 ], [-4.617944232585767, 50.75308069730077 ], [-4.562192786837954, 50.7815054514556 ], [-4.553615641338291, 50.83221779693638 ], [-4.55897635727558, 50.87582395387846 ], [-4.566481359587786, 50.886483236686516 ], [-4.565409216400328, 50.910708879432114 ], [-4.546110639026085, 50.928474350778885 ], [-4.549327068588459, 50.93913363358695 ], [-4.53324492077659, 50.9652973277522 ], [-4.526812061651842, 51.01891675036245 ], [-4.4640916851855525, 51.02053179321216 ], [-4.425494530437066, 51.013748613243386 ], [-4.375103800626543, 50.990168987637674 ], [-4.345083791377721, 50.98887695335791 ], [-4.3038062786605895, 50.99727517617638 ], [-4.263064837537188, 51.03377514457975 ], [-4.238405544225655, 51.04152735025834 ], [-4.221787324820058, 51.06478396729411 ], [-4.179437668915469, 51.050248581646755 ], [-4.1810458836966555, 51.06639901014382 ], [-4.214818394101581, 51.07512024153223 ], [-4.221787324820058, 51.08448749006053 ], [-4.2223233964137865, 51.11775737276449 ], [-4.2389416158193844, 51.133261784121665 ], [-4.212138036132936, 51.16007149542679 ], [-4.214818394101581, 51.18978828386139 ], [-4.201416604258356, 51.200770575239396 ], [-4.177829454134281, 51.19754048953998 ], [-4.135479798229693, 51.20916879805787 ], [-4.097954786668665, 51.2117528666174 ], [-4.080264424075609, 51.21821303801622 ], [-4.050780486420516, 51.20755375520816 ], [-4.028265479483899, 51.21627498659658 ], [-3.947318668830824, 51.22176613228558 ], [-3.9387415233311605, 51.22887232082429 ], [-3.9038968697387775, 51.229841346534116 ], [-3.89210329467674, 51.22370418370523 ], [-3.8545782831157123, 51.23436346651329 ], [-3.8063318396801047, 51.23274842366359 ], [-3.785425047524675, 51.24631478360112 ], [-3.7698789713065346, 51.2375935522127 ], [-3.6406857172178526, 51.223058166565345 ], [-3.601552490875638, 51.220474098005816 ], [-3.578501412345292, 51.23113338081388 ], [-3.5334713984720585, 51.230487363673994 ], [-3.484152811848993, 51.21918206372605 ], [-3.472895308380685, 51.20949180662781 ], [-3.4418031559444042, 51.20658472949834 ], [-3.4117831466955817, 51.18397412960245 ], [-3.3361970519797968, 51.18332811246257 ], [-3.275620961888423, 51.17977501819321 ], [-3.256858456107909, 51.18785023244175 ], [-3.1802002182046665, 51.199801549529575 ], [-3.1560769964868625, 51.208199772348046 ], [-3.1255209156443113, 51.210783840907574 ], [-3.076202329021246, 51.20141659237928 ], [-3.0242033844295357, 51.21304490089717 ], [-2.999544091118003, 51.23694753507282 ], [-3.021523026460891, 51.26504928065771 ], [-3.011873737773769, 51.30704039475008 ], [-2.9925751603995265, 51.32060675468762 ], [-2.9829258717124048, 51.346447440282915 ], [-2.962555151150704, 51.3823013915464 ], [-2.940040144214087, 51.398128811473526 ], [-2.913236564527639, 51.395867751483934 ], [-2.895546201934583, 51.40685004286194 ], [-2.8794640541227134, 51.43139869417748 ], [-2.8489079732801623, 51.45562433692307 ], [-2.7995893866570967, 51.48534112535768 ], [-2.7733218785643774, 51.49470837388597 ], [-2.7336525806284335, 51.49438536531603 ], [-2.700416141817237, 51.51731897378186 ], [-2.672540418943331, 51.545743727936696 ], [-2.663963273443667, 51.57319945638171 ], [-2.6425204096945083, 51.58708882488918 ], [-2.628046476663826, 51.605500313375835 ], [-2.5990986106024616, 51.617774639033605 ], [-2.5792639616344895, 51.63489409324049 ], [-2.5583571694790597, 51.66654893309474 ], [-2.497245007793957, 51.693358644399865 ], [-2.4816989315758167, 51.725659501394 ], [-2.4516789223269946, 51.73922586133153 ], [-2.4323803449527515, 51.736641792772 ], [-2.382525686735957, 51.75828336695807 ], [-2.3841339015171443, 51.77507981259502 ], [-2.425947485828004, 51.76409752121701 ], [-2.4709774997012373, 51.74439399845059 ], [-2.498317150981415, 51.72404445854429 ], [-2.5052860816998916, 51.71047809860676 ], [-2.5969543242275455, 51.678500250182566 ], [-2.6253661186951813, 51.66041177026585 ], [-2.623757903913994, 51.65395159886703 ], [-2.6548500563502744, 51.6216507418729 ], [-2.6698600609746856, 51.64684541032832 ], [-2.6580664859126486, 51.67656219876292 ], [-2.672004347349602, 51.68173033588198 ], [-2.668787917787228, 51.70724801290734 ], [-2.6789732780680784, 51.71403119287611 ], [-2.680045421255536, 51.72469047568417 ], [-2.685942208786555, 51.72856657852347 ], [-2.685406137192826, 51.731796664222884 ], [-2.6752207769119756, 51.73438073278241 ], [-2.6709322041621437, 51.73696480134194 ], [-2.6693239893809566, 51.74277895560088 ], [-2.662891130256209, 51.75408425554883 ], [-2.680581492849265, 51.76894264976613 ], [-2.6714682757558728, 51.79510634393137 ], [-2.650561483600443, 51.826115166645735 ], [-2.6355514789760317, 51.840973560863034 ], [-2.604459326539751, 51.85453992080057 ], [-2.5615735990414334, 51.86423017789881 ], [-2.5224403726992186, 51.86487619503869 ], [-2.5085025112622654, 51.885225734944996 ], [-2.494028578231583, 51.88005759782593 ], [-2.440421418858686, 51.90234518915188 ], [-2.448462492764621, 51.918818626218886 ], [-2.466152855357677, 51.92786286617724 ], [-2.4645446405764897, 51.948535414653485 ], [-2.4902760770754804, 51.95499558605231 ], [-2.496708936200228, 51.9759911430985 ], [-2.4709774997012373, 51.994725640155096 ], [-2.4913482202629385, 52.00635394867298 ], [-2.4736578576698824, 52.02379641144981 ], [-2.4339885597339386, 52.01216810293192 ], [-2.4355967745151252, 51.9979557258545 ], [-2.402896407297658, 51.99601767443486 ], [-2.3927110470168076, 52.0128141200718 ], [-2.3525056774871347, 52.01346013721169 ], [-2.329454598956789, 52.006676957242924 ], [-2.3128363795511913, 51.97663716023838 ], [-2.2511881462723595, 51.9666238945702 ], [-2.2206320654298075, 51.995371657294974 ], [-2.1852513402436955, 51.99052652874585 ], [-2.1638084764945367, 51.997309708714624 ], [-2.1841791970562374, 52.01378314578163 ], [-2.1804266959001346, 52.04156188279658 ], [-2.16220026171335, 52.050606122754935 ], [-2.1182423910275743, 52.042207899936464 ], [-2.139685254776733, 52.02767251428911 ], [-2.1509427582450416, 52.006676957242924 ], [-2.1118095319028267, 52.01475217149145 ], [-2.0517695134051817, 52.00861500866257 ], [-1.9842244925953318, 52.035747728537636 ], [-1.9515241253778646, 52.037685779957286 ], [-1.9311534048161638, 52.03025658284864 ], [-1.9134630422231078, 52.04446895992605 ], [-1.8737937442871635, 52.024442428589694 ], [-1.8512787373505466, 52.008292000092624 ], [-1.8351965895386773, 52.00926102580245 ], [-1.826083372445285, 52.02928755713881 ], [-1.8346605179449487, 52.043176925646286 ], [-1.8571755248815656, 52.05222116560464 ], [-1.8689690999436026, 52.07386273979071 ], [-1.8464540930069857, 52.07935388547971 ], [-1.831980159976304, 52.07321672265083 ], [-1.80249622232121, 52.09679634825654 ], [-1.7676515687288274, 52.11262376818367 ], [-1.7547858504793323, 52.099380416816075 ], [-1.7279822707928831, 52.08839812543807 ], [-1.7306626287615279, 52.07353973122077 ], [-1.6899211876381264, 52.053190191314464 ], [-1.6947458319816873, 52.04059285708676 ], [-1.6566847488269305, 52.03219463426828 ], [-1.626664739578108, 52.03800878852723 ], [-1.6422108157962478, 52.01023005151227 ], [-1.6657979659203228, 51.997309708714624 ], [-1.6657979659203228, 51.98761945161638 ] ] ] ] } } ] diff --git a/geometry.go b/geometry.go index 02475c6..c81da91 100644 --- a/geometry.go +++ b/geometry.go @@ -5,12 +5,12 @@ import ( "errors" "fmt" - "github.com/paulmach/go.geojson" + "github.com/paulmach/orb/geojson" ) type Geometry struct { ID string `json:"id,omitempty"` - Type geojson.GeometryType `json:"type"` + Type string `json:"type"` Properties map[string]interface{} `json:"properties"` BoundingBox []float64 `json:"bbox,omitempty"` @@ -29,7 +29,7 @@ func (g *Geometry) MarshalJSON() ([]byte, error) { // defining a struct here lets us define the order of the JSON elements. type geometry struct { ID string `json:"id,omitempty"` - Type geojson.GeometryType `json:"type"` + Type string `json:"type"` Properties map[string]interface{} `json:"properties"` BoundingBox []float64 `json:"bbox,omitempty"` Coordinates interface{} `json:"coordinates,omitempty"` @@ -45,19 +45,19 @@ func (g *Geometry) MarshalJSON() ([]byte, error) { } switch g.Type { - case geojson.GeometryPoint: + case geojson.TypePoint: geo.Coordinates = g.Point - case geojson.GeometryMultiPoint: + case geojson.TypeMultiPoint: geo.Coordinates = g.MultiPoint - case geojson.GeometryLineString: + case geojson.TypeLineString: geo.Arcs = g.LineString - case geojson.GeometryMultiLineString: + case geojson.TypeMultiLineString: geo.Arcs = g.MultiLineString - case geojson.GeometryPolygon: + case geojson.TypePolygon: geo.Arcs = g.Polygon - case geojson.GeometryMultiPolygon: + case geojson.TypeMultiPolygon: geo.Arcs = g.MultiPolygon - case geojson.GeometryCollection: + default: geo.Geometries = g.Geometries } @@ -83,7 +83,7 @@ func decodeGeometry(g *Geometry, object map[string]interface{}) error { } if s, ok := t.(string); ok { - g.Type = geojson.GeometryType(s) + g.Type = string(s) } else { return errors.New("type property not string") } @@ -98,19 +98,19 @@ func decodeGeometry(g *Geometry, object map[string]interface{}) error { var err error switch g.Type { - case geojson.GeometryPoint: + case geojson.TypePoint: g.Point, err = decodePosition(object["coordinates"]) - case geojson.GeometryMultiPoint: + case geojson.TypeMultiPoint: g.MultiPoint, err = decodePositionSet(object["coordinates"]) - case geojson.GeometryLineString: + case geojson.TypeLineString: g.LineString, err = decodeArcs(object["arcs"]) - case geojson.GeometryMultiLineString: + case geojson.TypeMultiLineString: g.MultiLineString, err = decodeArcsSet(object["arcs"]) - case geojson.GeometryPolygon: + case geojson.TypePolygon: g.Polygon, err = decodeArcsSet(object["arcs"]) - case geojson.GeometryMultiPolygon: + case geojson.TypeMultiPolygon: g.MultiPolygon, err = decodePolygonArcs(object["arcs"]) - case geojson.GeometryCollection: + default: g.Geometries, err = decodeGeometries(object["geometries"]) } diff --git a/join_test.go b/join_test.go index 84fdd2c..dda22af 100644 --- a/join_test.go +++ b/join_test.go @@ -4,7 +4,8 @@ import ( "testing" "github.com/cheekybits/is" - "github.com/paulmach/go.geojson" + orb "github.com/paulmach/orb" + "github.com/paulmach/orb/geojson" ) // See https://github.com/mbostock/topojson/blob/master/test/topology/join-test.js @@ -14,12 +15,12 @@ func TestHasJunctions(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, + }), } topo := &Topology{input: in} @@ -35,12 +36,12 @@ func TestNonJunctions(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {2, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -55,12 +56,12 @@ func TestJoinDuplicate(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("abc2", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("abc2", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -77,12 +78,12 @@ func TestJoinReversedDuplicate(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), } topo := &Topology{input: in} @@ -99,16 +100,16 @@ func TestJoinDuplicateRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), - NewTestFeature("abca2", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + }), + NewTestFeature("abca2", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -123,16 +124,16 @@ func TestJoinReversedDuplicateRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), - NewTestFeature("acba", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {2, 0}, {1, 0}, {0, 0}, + }), + NewTestFeature("acba", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -147,16 +148,16 @@ func TestJoinRotatedDuplicateRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), - NewTestFeature("bcab", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {2, 0}, {0, 0}, {1, 0}, + }), + NewTestFeature("bcab", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -171,14 +172,14 @@ func TestJoinRingLine(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcaLine", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {0, 0}, - })), - NewTestFeature("abcaPolygon", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("abcaLine", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, + }), + NewTestFeature("abcaPolygon", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -194,14 +195,14 @@ func TestJoinLineRingReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcaLine", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {0, 0}, - })), - NewTestFeature("bcabPolygon", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {2, 0}, {0, 0}, {1, 0}, + NewTestFeature("abcaLine", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, + }), + NewTestFeature("bcabPolygon", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -217,14 +218,14 @@ func TestJoinRingLineReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("bcabLine", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, {0, 0}, {1, 0}, - })), - NewTestFeature("abcaPolygon", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {2, 0}, {0, 0}, + NewTestFeature("bcabLine", orb.LineString{ + orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, orb.Point{1, 0}, + }), + NewTestFeature("abcaPolygon", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -240,12 +241,12 @@ func TestJoinOldArcExtends(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, + }), } topo := &Topology{input: in} @@ -263,12 +264,12 @@ func TestJoinOldArcExtendsReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, + }), } topo := &Topology{input: in} @@ -286,12 +287,12 @@ func TestJoinNewArcSharesStart(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("ade", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 1}, {2, 1}, - })), + NewTestFeature("ade", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 1}, orb.Point{2, 1}, + }), } topo := &Topology{input: in} @@ -309,11 +310,11 @@ func TestJoinRingNoJunctions(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("aba", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 0}, + NewTestFeature("aba", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -328,11 +329,11 @@ func TestJoinRingAANoJunctions(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("aa", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {0, 0}, + NewTestFeature("aa", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -347,11 +348,11 @@ func TestJoinRingANoJunctions(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("a", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, + NewTestFeature("a", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -366,12 +367,12 @@ func TestJoinNewLineSharesEnd(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("dec", geojson.NewLineStringGeometry([][]float64{ - {0, 1}, {1, 1}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("dec", orb.LineString{ + orb.Point{0, 1}, orb.Point{1, 1}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -389,12 +390,12 @@ func TestJoinNewLineExtends(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("ab", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, - })), - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("ab", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, + }), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -412,12 +413,12 @@ func TestJoinNewLineExtendsReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("ba", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {0, 0}, - })), - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("ba", orb.LineString{ + orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -435,12 +436,12 @@ func TestJoinNewStartsMiddle(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("bc", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("bc", orb.LineString{ + orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -458,12 +459,12 @@ func TestJoinNewStartsMiddleReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("bc", geojson.NewLineStringGeometry([][]float64{ - {1, 0}, {2, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("bc", orb.LineString{ + orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -481,12 +482,12 @@ func TestJoinNewLineDeviates(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("abd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("abd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, + }), } topo := &Topology{input: in} @@ -505,12 +506,12 @@ func TestJoinNewLineDeviatesReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("abd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("abd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, + }), } topo := &Topology{input: in} @@ -529,12 +530,12 @@ func TestJoinNewLineMerges(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("dbc", geojson.NewLineStringGeometry([][]float64{ - {3, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("dbc", orb.LineString{ + orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -553,12 +554,12 @@ func TestJoinNewLineMergesReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("cba", geojson.NewLineStringGeometry([][]float64{ - {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("dbc", geojson.NewLineStringGeometry([][]float64{ - {3, 0}, {1, 0}, {2, 0}, - })), + NewTestFeature("cba", orb.LineString{ + orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("dbc", orb.LineString{ + orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), } topo := &Topology{input: in} @@ -577,12 +578,12 @@ func TestJoinNewLineSharesMidpoint(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abc", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, - })), - NewTestFeature("dbe", geojson.NewLineStringGeometry([][]float64{ - {0, 1}, {1, 0}, {2, 1}, - })), + NewTestFeature("abc", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, + }), + NewTestFeature("dbe", orb.LineString{ + orb.Point{0, 1}, orb.Point{1, 0}, orb.Point{2, 1}, + }), } topo := &Topology{input: in} @@ -602,12 +603,12 @@ func TestJoinNewLineSkipsPoint(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcde", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, - })), - NewTestFeature("adbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("abcde", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), + NewTestFeature("adbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -626,12 +627,12 @@ func TestJoinNewLineSkipsPointReversed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("edcba", geojson.NewLineStringGeometry([][]float64{ - {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}, - })), - NewTestFeature("adbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("edcba", orb.LineString{ + orb.Point{4, 0}, orb.Point{3, 0}, orb.Point{2, 0}, orb.Point{1, 0}, orb.Point{0, 0}, + }), + NewTestFeature("adbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -650,9 +651,9 @@ func TestJoinSelfIntersectsMiddle(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcdbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {3, 0}, {1, 0}, {4, 0}, - })), + NewTestFeature("abcdbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -669,9 +670,9 @@ func TestJoinSelfIntersectsStart(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abacd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {0, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("abacd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -688,9 +689,9 @@ func TestJoinSelfIntersectsEnd(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcdbd", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {4, 0}, {3, 0}, {4, 0}, - })), + NewTestFeature("abcdbd", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{4, 0}, orb.Point{3, 0}, orb.Point{4, 0}, + }), } topo := &Topology{input: in} @@ -707,12 +708,12 @@ func TestJoinSelfIntersectsShares(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abcdbe", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {2, 0}, {3, 0}, {1, 0}, {4, 0}, - })), - NewTestFeature("fbg", geojson.NewLineStringGeometry([][]float64{ - {0, 1}, {1, 0}, {2, 1}, - })), + NewTestFeature("abcdbe", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{2, 0}, orb.Point{3, 0}, orb.Point{1, 0}, orb.Point{4, 0}, + }), + NewTestFeature("fbg", orb.LineString{ + orb.Point{0, 1}, orb.Point{1, 0}, orb.Point{2, 1}, + }), } topo := &Topology{input: in} @@ -732,9 +733,9 @@ func TestJoinLineClosed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {0, 1}, {0, 0}, - })), + NewTestFeature("abca", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, + }), } topo := &Topology{input: in} @@ -750,11 +751,11 @@ func TestJoinRingClosed(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -769,16 +770,16 @@ func TestJoinDuplicateRingsShare(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + }), + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -793,16 +794,16 @@ func TestJoinDuplicateRingsReversedShare(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("acba", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {0, 1}, {1, 0}, {0, 0}, + }), + NewTestFeature("acba", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{0, 1}, orb.Point{1, 0}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -817,16 +818,16 @@ func TestJoinCoincidentRings(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("bcab", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {0, 1}, {0, 0}, {1, 0}, + }), + NewTestFeature("bcab", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -841,16 +842,16 @@ func TestJoinCoincidentRings2(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("bacb", geojson.NewPolygonGeometry([][][]float64{ - { - {1, 0}, {0, 0}, {0, 1}, {1, 0}, + }), + NewTestFeature("bacb", orb.Polygon{ + orb.Ring{ + orb.Point{1, 0}, orb.Point{0, 0}, orb.Point{0, 1}, orb.Point{1, 0}, }, - })), + }), } topo := &Topology{input: in} @@ -865,16 +866,16 @@ func TestJoinCoincidentRingsShare(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("dbed", geojson.NewPolygonGeometry([][][]float64{ - { - {2, 1}, {1, 0}, {2, 2}, {2, 1}, + }), + NewTestFeature("dbed", orb.Polygon{ + orb.Ring{ + orb.Point{2, 1}, orb.Point{1, 0}, orb.Point{2, 2}, orb.Point{2, 1}, }, - })), + }), } topo := &Topology{input: in} @@ -890,14 +891,14 @@ func TestJoinCoincidentRingLine(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("abca", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {1, 0}, {0, 1}, {0, 0}, + NewTestFeature("abca", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, }, - })), - NewTestFeature("dbe", geojson.NewLineStringGeometry([][]float64{ - {2, 1}, {1, 0}, {2, 2}, - })), + }), + NewTestFeature("dbe", orb.LineString{ + orb.Point{2, 1}, orb.Point{1, 0}, orb.Point{2, 2}, + }), } topo := &Topology{input: in} diff --git a/pointfeature_test.go b/pointfeature_test.go index 3f2ce5e..a9bee2a 100644 --- a/pointfeature_test.go +++ b/pointfeature_test.go @@ -2,17 +2,19 @@ package topojson import ( "testing" - "github.com/paulmach/go.geojson" + "github.com/cheekybits/is" + "github.com/paulmach/orb" + "github.com/paulmach/orb/geojson" ) func TestPointFeature(t *testing.T) { is := is.New(t) fc := geojson.NewFeatureCollection() - f := geojson.NewPointFeature([]float64{0, 0}) - f.SetProperty("id", "point") - fc.AddFeature(f) + f := geojson.NewFeature(orb.Point{0, 0}) + f.ID = "point" + fc.Append(f) topo := NewTopology(fc, nil) @@ -23,11 +25,11 @@ func TestMultiPointFeature(t *testing.T) { is := is.New(t) fc := geojson.NewFeatureCollection() - f := geojson.NewMultiPointFeature([]float64{0, 0}, []float64{1, 1}) - f.SetProperty("id", "multipoint") - fc.AddFeature(f) + f := geojson.NewFeature(orb.MultiPoint{orb.Point{0, 0}, orb.Point{1, 1}}) + f.ID = "multipoint" + fc.Append(f) topo := NewTopology(fc, nil) - is.Equal([][]float64{{0, 0},{1, 1}}, topo.Objects["multipoint"].MultiPoint) -} \ No newline at end of file + is.Equal([][]float64{{0, 0}, {1, 1}}, topo.Objects["multipoint"].MultiPoint) +} diff --git a/postquantize.go b/postquantize.go index 1baf112..d79e6f7 100644 --- a/postquantize.go +++ b/postquantize.go @@ -1,6 +1,8 @@ package topojson -import geojson "github.com/paulmach/go.geojson" +import ( + "github.com/paulmach/orb" +) func (t *Topology) postQuantize() { q0 := t.opts.PreQuantize @@ -48,19 +50,28 @@ func (t *Topology) postQuantize() { } for i, arc := range t.Arcs { - t.Arcs[i] = q.quantizeLine(arc, true) + a := make(orb.LineString, len(arc)) + for i, v := range arc { + a[i] = orb.Point{v[0], v[1]} + } + b := q.quantizeLine(a, true) + c := make([][]float64, len(b)) + for i, v := range b { + c[i] = []float64{v[0], v[1]} + } + t.Arcs[i] = c } } -func (t *Topology) postQuantizeGeometry(q *quantize, g *geojson.Geometry) { - switch g.Type { - case geojson.GeometryCollection: - for _, geom := range g.Geometries { +func (t *Topology) postQuantizeGeometry(q *quantize, g orb.Geometry) { + switch v := g.(type) { + default: + for _, geom := range g.(orb.Collection) { t.postQuantizeGeometry(q, geom) } - case geojson.GeometryPoint: - g.Point = q.quantizePoint(g.Point) - case geojson.GeometryMultiPoint: - g.MultiPoint = q.quantizeLine(g.MultiPoint, false) + case orb.Point: + v = q.quantizePoint(v) + case orb.LineString: + v = q.quantizeLine(v, false) } } diff --git a/prequantize.go b/prequantize.go index acdbd4c..03f3f2c 100644 --- a/prequantize.go +++ b/prequantize.go @@ -1,6 +1,8 @@ package topojson -import geojson "github.com/paulmach/go.geojson" +import ( + "github.com/paulmach/orb" +) func (t *Topology) preQuantize() { if t.opts.PreQuantize == 0 { @@ -31,31 +33,29 @@ func (t *Topology) preQuantize() { q := newQuantize(-x0, -y0, kx, ky) for _, f := range t.input { - t.preQuantizeGeometry(q, f.Geometry) + t.preQuantizeGeometry(q, &f.Geometry) } t.Transform = q.Transform } -func (t *Topology) preQuantizeGeometry(q *quantize, g *geojson.Geometry) { - switch g.Type { - case geojson.GeometryCollection: - for _, geom := range g.Geometries { - t.preQuantizeGeometry(q, geom) - } - case geojson.GeometryPoint: - g.Point = q.quantizePoint(g.Point) - case geojson.GeometryMultiPoint: - g.MultiPoint = q.quantizeLine(g.MultiPoint, false) - case geojson.GeometryLineString: - g.LineString = q.quantizeLine(g.LineString, true) - case geojson.GeometryMultiLineString: - g.MultiLineString = q.quantizeMultiLine(g.MultiLineString, true) - case geojson.GeometryPolygon: - g.Polygon = q.quantizeMultiLine(g.Polygon, true) - case geojson.GeometryMultiPolygon: - for i, poly := range g.MultiPolygon { - g.MultiPolygon[i] = q.quantizeMultiLine(poly, true) +func (t *Topology) preQuantizeGeometry(q *quantize, g *orb.Geometry) { + switch v := (*g).(type) { + case orb.Collection: + for _, g := range v { + t.preQuantizeGeometry(q, &g) } + case orb.Point: + *g = q.quantizePoint(v) + case orb.MultiPoint: + *g = q.quantizeMultiPoint(v, false) + case orb.LineString: + *g = q.quantizeLine(v, true) + case orb.MultiLineString: + *g = q.quantizeMultiLine(v, true) + case orb.Polygon: + *g = q.quantizePolygon(v, true) + case orb.MultiPolygon: + *g = q.quantizeMultiPolygon(v, true) } } diff --git a/prequantize_test.go b/prequantize_test.go index edd4bed..594f6f3 100644 --- a/prequantize_test.go +++ b/prequantize_test.go @@ -4,7 +4,8 @@ import ( "testing" "github.com/cheekybits/is" - geojson "github.com/paulmach/go.geojson" + orb "github.com/paulmach/orb" + geojson "github.com/paulmach/orb/geojson" ) // Sets the quantization transform @@ -34,13 +35,13 @@ func TestPreQuantizeConverts(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {0, 1}, {0, 0}, - })), + NewTestFeature("foo", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, + }), } - expected := [][]float64{ - {0, 0}, {9999, 0}, {0, 9999}, {0, 0}, + expected := orb.LineString{ + orb.Point{0, 0}, orb.Point{9999, 0}, orb.Point{0, 9999}, orb.Point{0, 0}, } topo := &Topology{ @@ -58,7 +59,7 @@ func TestPreQuantizeConverts(t *testing.T) { Scale: [2]float64{float64(1) / 9999, float64(1) / 9999}, Translate: [2]float64{0, 0}, }) - is.Equal(topo.input[0].Geometry.LineString, expected) + is.Equal(topo.input[0].Geometry, expected) } // Observes the quantization parameter @@ -66,12 +67,12 @@ func TestPreQuantizeObserves(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {0, 1}, {0, 0}, - })), + NewTestFeature("foo", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, + }), } - expected := [][]float64{ + expected := orb.LineString{ {0, 0}, {9, 0}, {0, 9}, {0, 0}, } @@ -85,8 +86,7 @@ func TestPreQuantizeObserves(t *testing.T) { topo.bounds() topo.preQuantize() - - is.Equal(topo.input[0].Geometry.LineString, expected) + is.Equal(topo.input[0].Geometry, expected) } // Observes the bounding box @@ -94,9 +94,9 @@ func TestPreQuantizeObservesBB(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {1, 0}, {0, 1}, {0, 0}, - })), + NewTestFeature("foo", orb.LineString{ + orb.Point{0, 0}, orb.Point{1, 0}, orb.Point{0, 1}, orb.Point{0, 0}, + }), } topo := &Topology{ BoundingBox: []float64{-1, -1, 2, 2}, @@ -109,10 +109,10 @@ func TestPreQuantizeObservesBB(t *testing.T) { topo.preQuantize() - expected := [][]float64{ + expected := orb.LineString{ {3, 3}, {6, 3}, {3, 6}, {3, 3}, } - is.Equal(topo.input[0].Geometry.LineString, expected) + is.Equal(topo.input[0].Geometry, expected) } // Applies to points as well as arcs @@ -120,10 +120,9 @@ func TestPreQuantizeAppliesToPoints(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewMultiPointGeometry([][]float64{ + NewTestFeature("foo", orb.MultiPoint{ {0, 0}, {1, 0}, {0, 1}, {0, 0}, - }...)), - } + })} topo := &Topology{ input: in, opts: &TopologyOptions{ @@ -135,11 +134,10 @@ func TestPreQuantizeAppliesToPoints(t *testing.T) { topo.bounds() topo.preQuantize() - expected := [][]float64{ + expected := orb.MultiPoint{ {0, 0}, {9999, 0}, {0, 9999}, {0, 0}, } - - is.Equal(topo.input[0].Geometry.MultiPoint, expected) + is.Equal(topo.input[0].Geometry, expected) } // Skips coincident points in lines @@ -147,9 +145,9 @@ func TestPreQuantizeSkipsCoincidencesInLines(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewLineStringGeometry([][]float64{ - {0, 0}, {0.9, 0.9}, {1.1, 1.1}, {2, 2}, - })), + NewTestFeature("foo", orb.LineString{ + orb.Point{0, 0}, orb.Point{0.9, 0.9}, orb.Point{1.1, 1.1}, orb.Point{2, 2}, + }), } topo := &Topology{ input: in, @@ -162,11 +160,10 @@ func TestPreQuantizeSkipsCoincidencesInLines(t *testing.T) { topo.bounds() topo.preQuantize() - expected := [][]float64{ + expected := orb.LineString{ {0, 0}, {1, 1}, {2, 2}, } - - is.Equal(topo.input[0].Geometry.LineString, expected) + is.Equal(topo.input[0].Geometry, expected) } // Skips coincident points in polygons @@ -174,11 +171,11 @@ func TestPreQuantizeSkipsCoincidencesInPolygons(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("polygon", geojson.NewPolygonGeometry([][][]float64{ - { - {0, 0}, {0.9, 0.9}, {1.1, 1.1}, {2, 2}, {0, 0}, + NewTestFeature("polygon", orb.Polygon{ + orb.Ring{ + orb.Point{0, 0}, orb.Point{0.9, 0.9}, orb.Point{1.1, 1.1}, orb.Point{2, 2}, orb.Point{0, 0}, }, - })), + }), } topo := &Topology{ input: in, @@ -191,13 +188,13 @@ func TestPreQuantizeSkipsCoincidencesInPolygons(t *testing.T) { topo.bounds() topo.preQuantize() - expected := [][][]float64{ - { + expected := orb.Polygon{ + orb.Ring{ {0, 0}, {1, 1}, {2, 2}, {0, 0}, }, } - is.Equal(topo.input[0].Geometry.Polygon, expected) + is.Equal(topo.input[0].Geometry, expected) } // Does not skip coincident points in points @@ -205,9 +202,9 @@ func TestPreQuantizeDoesntSkipInPoints(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("multipoint", geojson.NewMultiPointGeometry([][]float64{ + NewTestFeature("multipoint", orb.MultiPoint{ {0, 0}, {0.9, 0.9}, {1.1, 1.1}, {2, 2}, {0, 0}, - }...)), + }), } topo := &Topology{ input: in, @@ -220,11 +217,11 @@ func TestPreQuantizeDoesntSkipInPoints(t *testing.T) { topo.bounds() topo.preQuantize() - expected := [][]float64{ + expected := orb.MultiPoint{ {0, 0}, {1, 1}, {1, 1}, {2, 2}, {0, 0}, } - is.Equal(topo.input[0].Geometry.MultiPoint, expected) + is.Equal(topo.input[0].Geometry, expected) } // Includes closing point in degenerate lines @@ -232,9 +229,9 @@ func TestPreQuantizeIncludesClosingLine(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("foo", geojson.NewLineStringGeometry([][]float64{ - {1, 1}, {1, 1}, {1, 1}, - })), + NewTestFeature("foo", orb.LineString{ + orb.Point{1, 1}, orb.Point{1, 1}, orb.Point{1, 1}, + }), } topo := &Topology{ BoundingBox: []float64{0, 0, 2, 2}, @@ -247,11 +244,11 @@ func TestPreQuantizeIncludesClosingLine(t *testing.T) { topo.preQuantize() - expected := [][]float64{ + expected := []orb.Point{ {1, 1}, {1, 1}, } - is.Equal(topo.input[0].Geometry.LineString, expected) + is.Equal(topo.input[0].Geometry, expected) } // Includes closing point in degenerate polygons @@ -259,11 +256,11 @@ func TestPreQuantizeIncludesClosingPolygon(t *testing.T) { is := is.New(t) in := []*geojson.Feature{ - NewTestFeature("polygon", geojson.NewPolygonGeometry([][][]float64{ - { - {0.9, 1}, {1.1, 1}, {1.01, 1}, {0.9, 1}, + NewTestFeature("polygon", orb.Polygon{ + orb.Ring{ + orb.Point{0.9, 1}, orb.Point{1.1, 1}, orb.Point{1.01, 1}, orb.Point{0.9, 1}, }, - })), + }), } topo := &Topology{ BoundingBox: []float64{0, 0, 2, 2}, @@ -276,11 +273,11 @@ func TestPreQuantizeIncludesClosingPolygon(t *testing.T) { topo.preQuantize() - expected := [][][]float64{ - { - {1, 1}, {1, 1}, {1, 1}, {1, 1}, + expected := orb.Polygon{ + orb.Ring{ + {1, 1}, {1, 1}, }, } - is.Equal(topo.input[0].Geometry.Polygon, expected) + is.Equal(topo.input[0].Geometry, expected) } diff --git a/quantize.go b/quantize.go index 66a671f..2d6739e 100644 --- a/quantize.go +++ b/quantize.go @@ -1,6 +1,10 @@ package topojson -import "math" +import ( + "math" + + "github.com/paulmach/orb" +) type quantize struct { Transform *Transform @@ -22,22 +26,62 @@ func newQuantize(dx, dy, kx, ky float64) *quantize { } } -func (q *quantize) quantizePoint(p []float64) []float64 { +func (q *quantize) quantizePoint(p orb.Point) orb.Point { x := round((p[0] + q.dx) * q.kx) y := round((p[1] + q.dy) * q.ky) - return []float64{x, y} + return orb.Point{x, y} +} + +func (q *quantize) quantizeMultiPoint(in orb.MultiPoint, skipEqual bool) orb.MultiPoint { + out := orb.MultiPoint{} + + var last []float64 + + for _, p := range in { + pt := q.quantizePoint(p) + if !pointEquals([]float64{pt[0], pt[1]}, last) || !skipEqual { + out = append(out, pt) + last = []float64{pt[0], pt[1]} + } + } + + if len(out) < 2 { + out = append(out, out[0]) + } + + return out +} + +func (q *quantize) quantizeLine(in orb.LineString, skipEqual bool) orb.LineString { + out := orb.LineString{} + + var last []float64 + + for _, p := range in { + pt := q.quantizePoint(p) + if !pointEquals([]float64{pt[0], pt[1]}, last) || !skipEqual { + out = append(out, pt) + last = []float64{pt[0], pt[1]} + } + } + + if len(out) < 2 { + out = append(out, out[0]) + } + + return out } -func (q *quantize) quantizeLine(in [][]float64, skipEqual bool) [][]float64 { - out := make([][]float64, 0, len(in)) +func (q *quantize) quantizeRing(in orb.Ring, skipEqual bool) orb.Ring { + out := orb.Ring{} var last []float64 for _, p := range in { pt := q.quantizePoint(p) - if !pointEquals(pt, last) || !skipEqual { + if !pointEquals([]float64{pt[0], pt[1]}, last) || !skipEqual { out = append(out, pt) - last = pt + last = []float64{pt[0], pt[1]} } } @@ -48,8 +92,8 @@ func (q *quantize) quantizeLine(in [][]float64, skipEqual bool) [][]float64 { return out } -func (q *quantize) quantizeMultiLine(in [][][]float64, skipEqual bool) [][][]float64 { - out := make([][][]float64, len(in)) +func (q *quantize) quantizeMultiLine(in orb.MultiLineString, skipEqual bool) orb.MultiLineString { + out := make(orb.MultiLineString, len(in)) for i, line := range in { line = q.quantizeLine(line, skipEqual) for len(line) < 4 { @@ -57,7 +101,22 @@ func (q *quantize) quantizeMultiLine(in [][][]float64, skipEqual bool) [][][]flo } out[i] = line } + return out +} + +func (q *quantize) quantizePolygon(in orb.Polygon, skipEqual bool) orb.Polygon { + out := make(orb.Polygon, len(in)) + for i, ring := range in { + out[i] = q.quantizeRing(ring, skipEqual) + } + return out +} +func (q *quantize) quantizeMultiPolygon(in orb.MultiPolygon, skipEqual bool) orb.MultiPolygon { + out := make(orb.MultiPolygon, len(in)) + for i, ring := range in { + out[i] = q.quantizePolygon(ring, skipEqual) + } return out } diff --git a/removeempty.go b/removeempty.go index fc35bdb..25ab80c 100644 --- a/removeempty.go +++ b/removeempty.go @@ -1,6 +1,8 @@ package topojson -import geojson "github.com/paulmach/go.geojson" +import ( + geojson "github.com/paulmach/orb/geojson" +) func (t *Topology) removeEmpty() { objs := make(map[string]*Geometry, len(t.Objects)) @@ -15,7 +17,7 @@ func (t *Topology) removeEmpty() { func (t *Topology) removeEmptyObjects(obj *Geometry) *Geometry { switch obj.Type { - case geojson.GeometryCollection: + case "GeometryCollection": geoms := make([]*Geometry, 0, len(obj.Geometries)) for _, g := range obj.Geometries { geom := t.removeEmptyObjects(g) @@ -27,11 +29,11 @@ func (t *Topology) removeEmptyObjects(obj *Geometry) *Geometry { return nil } obj.Geometries = geoms - case geojson.GeometryLineString: + case geojson.TypeLineString: if len(obj.LineString) == 0 { return nil } - case geojson.GeometryMultiLineString: + case geojson.TypeMultiLineString: linestrings := make([][]int, 0, len(obj.MultiLineString)) for _, ls := range obj.MultiLineString { if len(ls) > 0 { @@ -45,17 +47,17 @@ func (t *Topology) removeEmptyObjects(obj *Geometry) *Geometry { if len(linestrings) == 1 { obj.LineString = linestrings[0] obj.MultiLineString = nil - obj.Type = geojson.GeometryLineString + obj.Type = geojson.TypeLineString } else { obj.MultiLineString = linestrings } - case geojson.GeometryPolygon: + case geojson.TypePolygon: rings := t.removeEmptyPolygon(obj.Polygon) if rings == nil { return nil } obj.Polygon = rings - case geojson.GeometryMultiPolygon: + case geojson.TypeMultiPolygon: polygons := make([][][]int, 0, len(obj.MultiPolygon)) for _, polygon := range obj.MultiPolygon { rings := t.removeEmptyPolygon(polygon) @@ -69,7 +71,7 @@ func (t *Topology) removeEmptyObjects(obj *Geometry) *Geometry { if len(polygons) == 1 { obj.Polygon = polygons[0] obj.MultiPolygon = nil - obj.Type = geojson.GeometryPolygon + obj.Type = geojson.TypePolygon } else { obj.MultiPolygon = polygons } diff --git a/topojson_test.go b/topojson_test.go index 2ae7b01..d097e2a 100644 --- a/topojson_test.go +++ b/topojson_test.go @@ -3,12 +3,13 @@ package topojson import ( "fmt" - "github.com/paulmach/go.geojson" + orb "github.com/paulmach/orb" + "github.com/paulmach/orb/geojson" ) -func NewTestFeature(id string, geom *geojson.Geometry) *geojson.Feature { +func NewTestFeature(id string, geom orb.Geometry) *geojson.Feature { feature := geojson.NewFeature(geom) - feature.SetProperty("id", id) + feature.ID = id return feature } diff --git a/topology.go b/topology.go index 28508c7..aaa1db4 100644 --- a/topology.go +++ b/topology.go @@ -3,7 +3,7 @@ package topojson import ( "encoding/json" - "github.com/paulmach/go.geojson" + "github.com/paulmach/orb/geojson" ) type Topology struct { @@ -127,7 +127,7 @@ func pointEquals(a, b []float64) bool { type topologyObject struct { ID string - Type geojson.GeometryType + Type string Properties map[string]interface{} BoundingBox []float64 diff --git a/topology_test.go b/topology_test.go index 4ea3576..ee97acf 100644 --- a/topology_test.go +++ b/topology_test.go @@ -3,22 +3,24 @@ package topojson import ( "testing" + "github.com/paulmach/orb" + "github.com/cheekybits/is" - "github.com/paulmach/go.geojson" + "github.com/paulmach/orb/geojson" ) func TestTopology(t *testing.T) { is := is.New(t) - poly := geojson.NewPolygonFeature([][][]float64{ - { + poly := geojson.NewFeature(orb.Polygon{ + orb.Ring{ {0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}, }, }) - poly.SetProperty("id", "poly") + poly.ID = "poly" fc := geojson.NewFeatureCollection() - fc.AddFeature(poly) + fc.Append(poly) topo := NewTopology(fc, nil) is.NotNil(topo) @@ -30,7 +32,7 @@ func TestTopology(t *testing.T) { func TestFull(t *testing.T) { is := is.New(t) - in := []byte(`{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"id":"road"},"geometry":{"type":"LineString","coordinates":[[4.707126617431641,50.88714360752515],[4.708242416381835,50.886683361842216],[4.708693027496338,50.886514152727386],[4.70914363861084,50.886321253586765],[4.709406495094299,50.88633140619302],[4.709567427635193,50.88636524819791],[4.709604978561401,50.88647354244835],[4.709545969963074,50.88664275171071],[4.708666205406189,50.88698116839158],[4.707368016242981,50.88743464288961]]}}]}`) + in := []byte(`{"type":"FeatureCollection","features":[{"type":"Feature", "id":"road", "properties":{"id":"road"},"geometry":{"type":"LineString","coordinates":[[4.707126617431641,50.88714360752515],[4.708242416381835,50.886683361842216],[4.708693027496338,50.886514152727386],[4.70914363861084,50.886321253586765],[4.709406495094299,50.88633140619302],[4.709567427635193,50.88636524819791],[4.709604978561401,50.88647354244835],[4.709545969963074,50.88664275171071],[4.708666205406189,50.88698116839158],[4.707368016242981,50.88743464288961]]}}]}`) out := []byte(`{"type":"Topology","bbox":[4.707126617431641,50.886321253586765,4.709604978561401,50.88743464288961],"objects":{"road":{"id":"road","properties":{"id":"road"},"type":"LineString","arcs":[0]}},"arcs":[[[0,7385],[4502,-4133],[1818,-1520],[1818,-1732],[1060,91],[650,304],[151,973],[-238,1519],[-3549,3039],[-5238,4073]]],"transform":{"scale":[2.478608990659808e-7,1.1135006529096161e-7],"translate":[4.707126617431641,50.886321253586765]}}`) fc, err := geojson.UnmarshalFeatureCollection(in) @@ -52,15 +54,15 @@ func TestMultiFeatures(t *testing.T) { is := is.New(t) fc := geojson.NewFeatureCollection() - f1 := geojson.NewPolygonFeature([][][]float64{ + f1 := geojson.NewFeature(orb.Polygon{ {{0, 0}, {1, 1}, {2, 0}, {1, -1}, {0, 0}}, {{0.25, 0}, {0.75, -0.25}, {0.75, 0.25}, {0.25, 0}}, }) - fc.AddFeature(f1) - f2 := geojson.NewPolygonFeature([][][]float64{ + fc.Append(f1) + f2 := geojson.NewFeature(orb.Polygon{ {{0, 0}, {1, 1}, {2, 0}, {1, 2}, {0, 0}}, }) - fc.AddFeature(f2) + fc.Append(f2) topo := NewTopology(fc, nil) @@ -71,11 +73,11 @@ func TestCopyBounds(t *testing.T) { is := is.New(t) fc := geojson.NewFeatureCollection() - f := NewTestFeature("one", geojson.NewPolygonGeometry([][][]float64{ - {{0, 0}, {1, 1}, {2, 0}, {1, 2}, {0, 0}}, - })) - f.BoundingBox = []float64{0, 0, 2, 2} - fc.AddFeature(f) + f := NewTestFeature("one", orb.Polygon{ + orb.Ring{{0, 0}, {1, 1}, {2, 0}, {1, 2}, {0, 0}}, + }) + f.BBox = []float64{0, 0, 2, 2} + fc.Append(f) topo := NewTopology(fc, nil) is.NotNil(topo) diff --git a/unpackobjects.go b/unpackobjects.go index 579e87e..1d4dfa0 100644 --- a/unpackobjects.go +++ b/unpackobjects.go @@ -1,7 +1,7 @@ package topojson import ( - "github.com/paulmach/go.geojson" + "github.com/paulmach/orb/geojson" ) type arcEntry struct { @@ -29,21 +29,21 @@ func (t *Topology) unpackObject(o *topologyObject) *Geometry { } switch o.Type { - case geojson.GeometryCollection: + default: for _, geom := range o.Geometries { obj.Geometries = append(obj.Geometries, t.unpackObject(geom)) } - case geojson.GeometryLineString: + case geojson.TypeLineString: obj.LineString = t.lookupArc(o.Arc) - case geojson.GeometryMultiLineString: + case geojson.TypeMultiLineString: obj.MultiLineString = t.lookupArcs(o.Arcs) - case geojson.GeometryPolygon: + case geojson.TypePolygon: obj.Polygon = t.lookupArcs(o.Arcs) - case geojson.GeometryMultiPolygon: + case geojson.TypeMultiPolygon: obj.MultiPolygon = t.lookupMultiArcs(o.MultiArcs) - case geojson.GeometryPoint: + case geojson.TypePoint: obj.Point = o.Point - case geojson.GeometryMultiPoint: + case geojson.TypeMultiPoint: obj.MultiPoint = o.MultiPoint }