osm
osm copied to clipboard
Way.Nodes only contains node IDs with no additional information
Description
When retrieving data for ways using the osmpbf package, the Way.Nodes array only contains node IDs, with all other fields such as Version, ChangesetID, Lat, and Lon being zero. This occurs despite expecting these fields to be populated with respective node data.
Steps to Reproduce
- Use the following code snippet to extract way and node information from w128897900.osh.pbf.gz:
package main
import (
"context"
"fmt"
"os"
"time"
"github.com/paulmach/osm"
"github.com/paulmach/osm/osmpbf"
)
func main() {
oshFile, _ := os.Open("path/to/w128897900.osh.pbf")
pbfScanner := osmpbf.New(context.Background(), oshFile, 16)
for pbfScanner.Scan() {
osmItem := pbfScanner.Object()
if osmItem.ObjectID().Ref() != 128897900 {
continue
}
var way *osm.Way = osmItem.(*osm.Way)
var timeStamp, _ = time.Parse(time.RFC3339, "2011-12-20T10:59:34Z")
if way.Timestamp.Before(timeStamp) {
continue
}
for _, node := range way.Nodes {
fmt.Println(node.ID, node.Version, node.ChangesetID, node.Lat, node.Lon)
}
return
}
}
Expected Behavior
Each node retrieved in the Way.Nodes slice should have complete information, including ID, Version, ChangesetID, Latitude, and Longitude.
Actual Behavior
The output only includes node IDs, with other fields showing zero values:
1423178779 0 0 0 0
1476261275 0 0 0 0
1466158512 0 0 0 0
1476261292 0 0 0 0
1423178791 0 0 0 0
1481172885 0 0 0 0
...
Environment
- Library Version: v0.8.0
- Go Version: 1.22.2
- Operating System: Debian GNU/Linux 12 (bookworm) Kernel: 6.1.0-20-amd64, Architecture: x86-64