func test() { g1 := geos.Must(geos.FromWKT("LINESTRING(0 0, 3 3, 3 2, 4 2, 7 5)")) g2 := geos.Must(geos.FromWKT("LINESTRING(0 10, 1 0, 0 10, 10 10)")) g3 := geos.Must(geos.FromWKT("POINT(5 5)")) g4 := geos.Must(g3.Buffer(1)) g5 := geos.Must(geos.FromWKT("MULTIPOINT(5 6, 6 6, 3 8, 7 8)")) example("test.png", g1, g2, g4, g3, g5) }
func ex9() { wkt := []string{ "LINESTRING (2 10, 3 10, 4 9, 5 8)", "LINESTRING (5 8, 6 6, 6 5)", "LINESTRING (6 5, 9 6, 10 7, 11 9)", "LINESTRING (11 9, 11 10, 10 11)", "LINESTRING (6 5, 3 4, 2 3)", "LINESTRING (2 3, 1.5 2.5, 1 1, 1 0)", "LINESTRING (1 0, 0 0, 0 -1, 1 -2)", "LINESTRING (1 -2, 2 -2, 3 -1, 3 0, 1 0)", "LINESTRING (6 5, 6 3, 6.5 2.5)", "LINESTRING (6.5 2.5, 7.5 2, 8.5 1.5)", "LINESTRING (8.5 1.5, 9 0.5, 10 0.5, 11 1.5)", } var linestrings []*geos.Geometry for i := range wkt { linestrings = append(linestrings, geos.Must(geos.FromWKT(wkt[i]))) } example("example9-unmerged-linestrings.png", linestrings...) merged := geos.Must(geos.Must(geos.NewCollection(geos.MULTILINESTRING, linestrings...)).LineMerge()) example("example9-merged-linestrings.png", merged) }
func ex8() { l := geos.Must(geos.FromWKT("LINESTRING (0 2, 6 2, 3 4, 4.5 8, 1 8, 3 0)")) b := geos.Must(l.Buffer(0.5)) example("example8-buffer.png", b, l) }
func ex2() { a := geos.Must(geos.FromWKT("LINEARRING (0 3, 2 3, 3 1, 1 0, 0 1.5, 0 3)")) b := geos.Must(geos.FromWKT("LINEARRING (1 2, 1.5 4, 3.5 4, 4.5 2.5, 1 2)")) example("example2-a-b.png", a, b) }
func ex1() { example("example1.png", geos.Must(geos.FromWKT("LINESTRING (0 0, 10 10, 20 20)"))) }
func ex10() { l := geos.Must(geos.FromWKT("LINESTRING (0 2, 6 2, 3 4, 4.5 8, 1 8, 3 0)")) b := geos.Must(l.ConvexHull()) example("example10-convex-hull.png", b, l) }
ex3() ex4() ex5() ex6() ex7() ex8() ex9() ex10() } func ex1() { example("example1.png", geos.Must(geos.FromWKT("LINESTRING (0 0, 10 10, 20 20)"))) } var ( a = geos.Must(geos.FromWKT("POLYGON ((0 3, 2 3, 3 1, 1 0, 0 1.5, 0 3))")) b = geos.Must(geos.FromWKT("POLYGON ((1 2, 1.5 4, 3.5 4, 4.5 2.5, 1 2))")) ) func ex2() { a := geos.Must(geos.FromWKT("LINEARRING (0 3, 2 3, 3 1, 1 0, 0 1.5, 0 3)")) b := geos.Must(geos.FromWKT("LINEARRING (1 2, 1.5 4, 3.5 4, 4.5 2.5, 1 2)")) example("example2-a-b.png", a, b) } func ex3() { example("example3-intersection.png", a, b, geos.Must(a.Intersection(b))) } func ex4() { example("example4-union.png", a, b, geos.Must(a.Union(b)))
func ExampleGeometry_LineInterpolatePoint() { line := geos.Must(geos.FromWKT("LINESTRING(25 50, 100 125, 150 190)")) pt := geos.Must(line.LineInterpolatePoint(0.20)) fmt.Println(pt) // Output: POINT (51.5974135047432014 76.5974135047432014) }