twpayne / go-geom

Package geom implements efficient geometry types for geospatial applications.
BSD 2-Clause "Simplified" License
839 stars 104 forks source link

geom.Bounds implementing geom.T #234

Closed thomascoquet closed 10 months ago

thomascoquet commented 12 months ago

Hi,

First of all, thanks for the library.

I was using the geom.Bounds object recently and was thinking that it would be a nice addition if it implemented the geom.T interface.

For example, one could set a SRID for a Bounds object (why shouldn't it have one? ;-) ). Could behave as a polygon with four vertices for FlatCoords(), Ends(), Endss().

Happy to submit a PR if you're interested. Thomas

twpayne commented 12 months ago

This is unlikely to be possible as Bounds uses a different underlying representation to a geom.T and its coordinates are not stored directly.

If you want to convert a Bounds to a geom.T you can use the existing Bounds.Polygon method.