godal

作者: hehehehe | 来源:发表于2022-02-20 17:44 被阅读0次
    package main
    
    import (
        "fmt"
        "github.com/airbusgeo/godal"
    )
    
    func main33() {
    
        godal.RegisterAll()
    
        hDS, err := godal.Open("/Users/xxx/Downloads/sw_2022_q1/level2/beijing/road/Rbeijing.shp", godal.VectorOnly())
        if err != nil {
            panic(err)
        }
    
        layers := hDS.Layers()
        fmt.Println("len(layers)", len(layers))
    
        for _, layer := range layers {
            layer.ResetReading()
            fmt.Println(layer.FeatureCount())
            for {
                feat := layer.NextFeature()
                if feat == nil {
                    break
                }
                fields := feat.Fields()
                fmt.Printf("%v\n", fields)
    
                geom := feat.Geometry()
                wkt, _ := geom.WKT()
                fmt.Printf("geom: %s\n", wkt)
    
                geom.Close()
    
                feat.Close()
                break
    
            }
        }
    
        hDS.Close()
    
    }
    
    

    相关文章

      网友评论

          本文标题:godal

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