sgeom
func main() {
line0_str := "LINESTRING(116.40495300292967 39.926785883895654,116.3975715637207 39.9295502919)\n"
line1_str := "LINESTRING(116.37310981750488 39.92099342895789,116.39928817749023 39.9174387253541)"
line0, _ := sgeom.UnmarshalWKT(line0_str)
line1, _ := sgeom.UnmarshalWKT(line1_str)
fmt.Println(sgeom.Distance(line0, line1))
line2, _:= line0.AsLineString()
fmt.Println(line2.Coordinates())
}
tgeom
geom3,_ := wkt.Unmarshal("LINESTRING (0 0, 7 7, 19 19)")
li,_ :=geom3.(*tgeom.LineString)
fmt.Println(li.FlatCoords())
package main
func main() {
polygon := space.Polygon{{{116.39439582824706, 39.93284110825641},
{116.38675689697266, 39.92494288320867}, {116.40563964843749, 39.93020846782819},
{116.39439582824706, 39.93284110825641}}}
line0 := space.LineString{{116.40495300292967, 39.926785883895654}, {116.3975715637207, 39.9295502919}}
line1 := space.LineString{{116.37310981750488, 39.92099342895789}, {116.39928817749023, 39.9174387253541}}
b1, _ := G.Intersects(polygon, line0)
b2, _ := G.Intersects(polygon, line1)
fmt.Println(b1, b2)
buffer := G.Buffer(polygon, 2, 4)
fmt.Println(wkt.MarshalString(buffer))
fmt.Println(G.Contains(buffer,line0))
}
网友评论