I use this lib to read the shapefile.DBF and store it as a map Attribute. when I try to get the Value of I had stored, I get nil,I use value,ok := Attribute["OBJECTID"],it return nil,false.I store it like this:
for indFields, v := range fields {
featureAttributes[v.String()] = shpreader.Attribute(indFields)
}
And when I do it like this:
func (f Feature) GetAttrByName(name string) string {
for k, v := range f.Attributes {
if k == name {
return v
}
}
mylog.Error.Printf("获取%s的值失败", name)
return ""
}
it can work again.just slightly perplexed.Why is that?
I use this lib to read the shapefile.DBF and store it as a map Attribute. when I try to get the Value of I had stored, I get nil,I use
value,ok := Attribute["OBJECTID"]
,it returnnil,false
.I store it like this:And when I do it like this:
it can work again.just slightly perplexed.Why is that?