美文网首页
golang geo

golang geo

作者: hehehehe | 来源:发表于2022-01-19 13:07 被阅读0次

    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))
    
    }
    

    相关文章

      网友评论

          本文标题:golang geo

          本文链接:https://www.haomeiwen.com/subject/uosrhrtx.html