I kept getting invalid geometry type for Polygon: 18580565393411 (0x10e620000003) until I did a fix similar to the one for linestring (Commit 948e081)
I went for this:
index fcfd9ac..d461f67 100644
--- a/polygon.go
+++ b/polygon.go
@@ -78,8 +78,9 @@ func (p *Polygon) Scan(val any) error {
return err
}
- if wkbGeometryType != 3 {
- return fmt.Errorf("invalid geometry type for Polygon: %d", wkbGeometryType)
+ geometryType := wkbGeometryType & 0x1FFFFFFF // Mask out SRID flag
+ if geometryType != 3 {
+ return fmt.Errorf("invalid masked geometry type for Polygon: %d", geometryType)
}
var numRings uint32
But I could imagine that the splitting it into two 32bit reads and checking the SRID might be a better way to go.
I kept getting invalid geometry type for Polygon: 18580565393411 (0x10e620000003) until I did a fix similar to the one for linestring (Commit 948e081)
I went for this:
But I could imagine that the splitting it into two 32bit reads and checking the SRID might be a better way to go.