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()
}
网友评论